Skip to content

Commit

Permalink
Use ANSI prototypes in funcs.h declarations.
Browse files Browse the repository at this point in the history
Fix const issues.
Remove register declarations.
  • Loading branch information
gwsw committed Apr 5, 2017
1 parent eea49fc commit ceda5a2
Show file tree
Hide file tree
Showing 42 changed files with 332 additions and 323 deletions.
4 changes: 2 additions & 2 deletions Makefile.aut
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DISTFILES = \
install.sh defines.h.in mkinstalldirs \
less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \
less.hlp \
mkfuncs.awk mkhelp.c \
mkfuncs.pl mkhelp.c \
mkutable $(UNICODE_FILES) \
${DISTFILES_W}

Expand Down Expand Up @@ -61,7 +61,7 @@ ${srcdir}/configure: ${srcdir}/configure.ac \

funcs.h: ${SRC:%=${srcdir}/%}
-mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
perl ${srcdir}/mkfuncs.pl ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi

lint:
Expand Down
4 changes: 0 additions & 4 deletions Makefile.dsg
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ installcheck:
TAGS:
etags *.c *.h

newfuncs:
command.com /c if exist funcs.h del funcs.h
${AWK} -f mkfuncs.awk ${OBJ:.${O}=.c} > funcs.h

clean:
command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f

Expand Down
8 changes: 4 additions & 4 deletions brac.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
*/
public void
match_brac(obrac, cbrac, forwdir, n)
register int obrac;
register int cbrac;
int obrac;
int cbrac;
int forwdir;
int n;
{
register int c;
register int nest;
int c;
int nest;
POSITION pos;
int (*chget)();

Expand Down
42 changes: 21 additions & 21 deletions ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ static int ch_addbuf();
int
ch_get()
{
register struct buf *bp;
register struct bufnode *bn;
register int n;
register int slept;
register int h;
struct buf *bp;
struct bufnode *bn;
int n;
int slept;
int h;
POSITION pos;
POSITION len;

Expand Down Expand Up @@ -412,8 +412,8 @@ end_logfile()
public void
sync_logfile()
{
register struct buf *bp;
register struct bufnode *bn;
struct buf *bp;
struct bufnode *bn;
int warned = FALSE;
BLOCKNUM block;
BLOCKNUM nblocks;
Expand Down Expand Up @@ -450,9 +450,9 @@ sync_logfile()
buffered(block)
BLOCKNUM block;
{
register struct buf *bp;
register struct bufnode *bn;
register int h;
struct buf *bp;
struct bufnode *bn;
int h;

h = BUFHASH(block);
FOR_BUFS_IN_CHAIN(h, bn)
Expand All @@ -470,7 +470,7 @@ buffered(block)
*/
public int
ch_seek(pos)
register POSITION pos;
POSITION pos;
{
BLOCKNUM new_block;
POSITION len;
Expand Down Expand Up @@ -537,8 +537,8 @@ ch_end_seek()
public int
ch_end_buffer_seek()
{
register struct buf *bp;
register struct bufnode *bn;
struct buf *bp;
struct bufnode *bn;
POSITION buf_pos;
POSITION end_pos;

Expand All @@ -565,8 +565,8 @@ ch_end_buffer_seek()
public int
ch_beg_seek()
{
register struct bufnode *bn;
register struct bufnode *firstbn;
struct bufnode *bn;
struct bufnode *firstbn;

/*
* Try a plain ch_seek first.
Expand Down Expand Up @@ -625,7 +625,7 @@ ch_tell()
public int
ch_forw_get()
{
register int c;
int c;

if (thisfile == NULL)
return (EOI);
Expand Down Expand Up @@ -688,7 +688,7 @@ ch_setbufspace(bufspace)
public void
ch_flush()
{
register struct bufnode *bn;
struct bufnode *bn;

if (thisfile == NULL)
return;
Expand Down Expand Up @@ -755,8 +755,8 @@ ch_flush()
static int
ch_addbuf()
{
register struct buf *bp;
register struct bufnode *bn;
struct buf *bp;
struct bufnode *bn;

/*
* Allocate and initialize a new buffer and link it
Expand All @@ -780,7 +780,7 @@ ch_addbuf()
static void
init_hashtbl()
{
register int h;
int h;

for (h = 0; h < BUFHASH_SIZE; h++)
{
Expand All @@ -795,7 +795,7 @@ init_hashtbl()
static void
ch_delbufs()
{
register struct bufnode *bn;
struct bufnode *bn;

while (ch_bufhead != END_OF_CHAIN)
{
Expand Down
28 changes: 14 additions & 14 deletions charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public int binattr = AT_STANDOUT;
ichardef(s)
char *s;
{
register char *cp;
register int n;
register char v;
char *cp;
int n;
char v;

n = 0;
v = 0;
Expand Down Expand Up @@ -183,11 +183,11 @@ ichardef(s)
*/
static int
icharset(name, no_error)
register char *name;
char *name;
int no_error;
{
register struct charset *p;
register struct cs_alias *a;
struct charset *p;
struct cs_alias *a;

if (name == NULL || *name == '\0')
return (0);
Expand Down Expand Up @@ -227,7 +227,7 @@ icharset(name, no_error)
static void
ilocale()
{
register int c;
int c;

for (c = 0; c < (int) sizeof(chardef); c++)
{
Expand Down Expand Up @@ -479,7 +479,7 @@ prutfchar(ch)
*/
public int
utf_len(ch)
char ch;
unsigned char ch;
{
if ((ch & 0x80) == 0)
return 1;
Expand All @@ -502,7 +502,7 @@ utf_len(ch)
*/
public int
is_utf8_well_formed(s, slen)
unsigned char *s;
char *s;
int slen;
{
int i;
Expand All @@ -511,7 +511,7 @@ is_utf8_well_formed(s, slen)
if (IS_UTF8_INVALID(s[0]))
return (0);

len = utf_len((char) s[0]);
len = utf_len(s[0]);
if (len > slen)
return (0);
if (len == 1)
Expand Down Expand Up @@ -539,7 +539,7 @@ is_utf8_well_formed(s, slen)
*/
public int
utf_bin_count(data, len)
unsigned char *data;
char *data;
int len;
{
int bin_count = 0;
Expand Down Expand Up @@ -568,7 +568,7 @@ utf_bin_count(data, len)
*/
public LWCHAR
get_wchar(p)
char *p;
constant char *p;
{
switch (utf_len(p[0]))
{
Expand Down Expand Up @@ -672,7 +672,7 @@ put_wchar(pp, ch)
step_char(pp, dir, limit)
char **pp;
signed int dir;
char *limit;
constant char *limit;
{
LWCHAR ch;
int len;
Expand All @@ -691,7 +691,7 @@ step_char(pp, dir, limit)
if (p + len > limit)
{
ch = 0;
p = limit;
p = (char *) limit;
} else
{
ch = get_wchar(p);
Expand Down
38 changes: 19 additions & 19 deletions cmdbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@ struct mlist
*/
struct mlist mlist_search =
{ &mlist_search, &mlist_search, &mlist_search, NULL, 0 };
public void * constant ml_search = (void *) &mlist_search;
public void *ml_search = (void *) &mlist_search;

struct mlist mlist_examine =
{ &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 };
public void * constant ml_examine = (void *) &mlist_examine;
public void *ml_examine = (void *) &mlist_examine;

#if SHELL_ESCAPE || PIPEC
struct mlist mlist_shell =
{ &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 };
public void * constant ml_shell = (void *) &mlist_shell;
public void *ml_shell = (void *) &mlist_shell;
#endif

#else /* CMD_HISTORY */

/* If CMD_HISTORY is off, these are just flags. */
public void * constant ml_search = (void *)1;
public void * constant ml_examine = (void *)2;
public void *ml_search = (void *)1;
public void *ml_examine = (void *)2;
#if SHELL_ESCAPE || PIPEC
public void * constant ml_shell = (void *)3;
public void *ml_shell = (void *)3;
#endif

#endif /* CMD_HISTORY */
Expand Down Expand Up @@ -134,14 +134,14 @@ clear_cmd()
*/
public void
cmd_putstr(s)
char *s;
constant char *s;
{
LWCHAR prev_ch = 0;
LWCHAR ch;
char *endline = s + strlen(s);
constant char *endline = s + strlen(s);
while (*s != '\0')
{
char *ns = s;
char *ns = (char *) s;
int width;
ch = step_char(&ns, +1, endline);
while (s < ns)
Expand Down Expand Up @@ -255,7 +255,7 @@ cmd_step_left(pp, pwidth, bswidth)
*/
static void
cmd_repaint(old_cp)
char *old_cp;
constant char *old_cp;
{
/*
* Repaint the line from the current position.
Expand Down Expand Up @@ -316,8 +316,8 @@ cmd_home()
static void
cmd_lshift()
{
char *s;
char *save_cp;
constant char *s;
constant char *save_cp;
int cols;

/*
Expand All @@ -335,7 +335,7 @@ cmd_lshift()
while (*s != '\0')
{
int width;
char *ns = s;
constant char *ns = s;
cmd_step_right(&ns, &width, NULL);
if (width > 0)
break;
Expand All @@ -354,8 +354,8 @@ cmd_lshift()
static void
cmd_rshift()
{
char *s;
char *save_cp;
constant char *s;
constant char *save_cp;
int cols;

/*
Expand Down Expand Up @@ -486,7 +486,7 @@ cmd_ichar(cs, clen)
static int
cmd_erase()
{
register char *s;
char *s;
int clen;

if (cp == cmdbuf)
Expand Down Expand Up @@ -654,7 +654,7 @@ set_mlist(mlist, cmdflags)
cmd_updown(action)
int action;
{
char *s;
constant char *s;
struct mlist *ml;

if (curr_mlist == NULL)
Expand Down Expand Up @@ -716,7 +716,7 @@ cmd_updown(action)
public void
cmd_addhist(mlist, cmd, modified)
struct mlist *mlist;
char *cmd;
constant char *cmd;
int modified;
{
#if CMD_HISTORY
Expand Down Expand Up @@ -933,7 +933,7 @@ delimit_word()
char *p;
int delim_quoted = 0;
int meta_quoted = 0;
char *esc = get_meta_escape();
constant char *esc = get_meta_escape();
int esclen = (int) strlen(esc);
#endif

Expand Down
Loading

0 comments on commit ceda5a2

Please sign in to comment.