Fix a few old-style function declarations in compat/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2009-08-19 10:30:55 +02:00
parent f95b4f00a6
commit 91b2237325
5 changed files with 81 additions and 179 deletions

View File

@@ -130,10 +130,7 @@ extern int errno;
/* This function doesn't exist on most systems. */
# if !defined HAVE___STRCHRNUL && !defined _LIBC
static char *
__strchrnul (s, c)
const char *s;
int c;
static char * __strchrnul (const char *s, int c)
{
char *result = strchr (s, c);
if (result == NULL)
@@ -153,13 +150,8 @@ __strchrnul (s, c)
static int internal_fnmatch __P ((const char *pattern, const char *string,
int no_leading_period, int flags))
internal_function;
static int
internal_function
internal_fnmatch (pattern, string, no_leading_period, flags)
const char *pattern;
const char *string;
int no_leading_period;
int flags;
static int internal_function internal_fnmatch (const char *pattern,
const char *string, int no_leading_period, int flags)
{
register const char *p = pattern, *n = string;
register unsigned char c;
@@ -476,11 +468,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
}
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
int fnmatch (const char *pattern, const char *string, int flags)
{
return internal_fnmatch (pattern, string, flags & FNM_PERIOD, flags);
}

View File

@@ -80,7 +80,7 @@ static inline int getppid(void)
{ return 1; }
static inline void sync(void)
{}
static inline int getuid()
static inline int getuid(void)
{ return 1; }
static inline struct passwd *getpwnam(const char *name)
{ return NULL; }

View File

@@ -1802,7 +1802,7 @@ struct win32_mlock_t
static MLOCK_T malloc_global_mutex = { 0, 0, 0};
static FORCEINLINE long win32_getcurrentthreadid() {
static FORCEINLINE long win32_getcurrentthreadid(void) {
#ifdef _MSC_VER
#if defined(_M_IX86)
long *threadstruct=(long *)__readfsdword(0x18);

View File

@@ -159,8 +159,8 @@ struct mallinfo nedmallinfo(void) THROWSPEC { return nedpmallinfo(0); }
#endif
int nedmallopt(int parno, int value) THROWSPEC { return nedpmallopt(0, parno, value); }
int nedmalloc_trim(size_t pad) THROWSPEC { return nedpmalloc_trim(0, pad); }
void nedmalloc_stats() THROWSPEC { nedpmalloc_stats(0); }
size_t nedmalloc_footprint() THROWSPEC { return nedpmalloc_footprint(0); }
void nedmalloc_stats(void) THROWSPEC { nedpmalloc_stats(0); }
size_t nedmalloc_footprint(void) THROWSPEC { return nedpmalloc_footprint(0); }
void **nedindependent_calloc(size_t elemsno, size_t elemsize, void **chunks) THROWSPEC { return nedpindependent_calloc(0, elemsno, elemsize, chunks); }
void **nedindependent_comalloc(size_t elems, size_t *sizes, void **chunks) THROWSPEC { return nedpindependent_comalloc(0, elems, sizes, chunks); }

View File

@@ -64,8 +64,7 @@ extern char *re_syntax_table;
static char re_syntax_table[CHAR_SET_SIZE];
static void
init_syntax_once ()
static void init_syntax_once(void)
{
register int c;
static int done = 0;
@@ -380,10 +379,7 @@ typedef enum
} while (0)
#ifdef DEBUG
static void
extract_number (dest, source)
int *dest;
unsigned char *source;
static void extract_number(int *dest, unsigned char *source)
{
int temp = SIGN_EXTEND_CHAR (*(source + 1));
*dest = *source & 0377;
@@ -407,10 +403,8 @@ extract_number (dest, source)
} while (0)
#ifdef DEBUG
static void
extract_number_and_incr (destination, source)
int *destination;
unsigned char **source;
static void extract_number_and_incr(int *destination,
unsigned char **source)
{
extract_number (destination, *source);
*source += 2;
@@ -455,9 +449,7 @@ extern void printchar ();
/* Print the fastmap in human-readable form. */
void
print_fastmap (fastmap)
char *fastmap;
void print_fastmap(char *fastmap)
{
unsigned was_a_range = 0;
unsigned i = 0;
@@ -487,10 +479,8 @@ print_fastmap (fastmap)
/* Print a compiled pattern string in human-readable form, starting at
the START pointer into it and ending just before the pointer END. */
void
print_partial_compiled_pattern (start, end)
unsigned char *start;
unsigned char *end;
void print_partial_compiled_pattern(unsigned char *start,
unsigned char *end)
{
int mcnt, mcnt2;
unsigned char *p = start;
@@ -695,9 +685,7 @@ print_partial_compiled_pattern (start, end)
}
void
print_compiled_pattern (bufp)
struct re_pattern_buffer *bufp;
void print_compiled_pattern(struct re_pattern_buffer *bufp)
{
unsigned char *buffer = bufp->buffer;
@@ -722,13 +710,9 @@ print_compiled_pattern (bufp)
}
void
print_double_string (where, string1, size1, string2, size2)
const char *where;
const char *string1;
const char *string2;
int size1;
int size2;
void print_double_string(const char *where,
const char *string1, int size1,
const char *string2, int size2)
{
unsigned this_char;
@@ -777,9 +761,7 @@ reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS;
The argument SYNTAX is a bit mask comprised of the various bits
defined in regex.h. We return the old syntax. */
reg_syntax_t
re_set_syntax (syntax)
reg_syntax_t syntax;
reg_syntax_t re_set_syntax(reg_syntax_t syntax)
{
reg_syntax_t ret = re_syntax_options;
@@ -1031,12 +1013,9 @@ typedef struct
The `fastmap' and `newline_anchor' fields are neither
examined nor set. */
static reg_errcode_t
regex_compile (pattern, size, syntax, bufp)
const char *pattern;
int size;
reg_syntax_t syntax;
struct re_pattern_buffer *bufp;
static reg_errcode_t regex_compile(const char *pattern,
int size, reg_syntax_t syntax,
struct re_pattern_buffer *bufp)
{
/* We fetch characters from PATTERN here. Even though PATTERN is
`char *' (i.e., signed), we declare these variables as unsigned, so
@@ -2036,11 +2015,8 @@ regex_compile (pattern, size, syntax, bufp)
/* Store OP at LOC followed by two-byte integer parameter ARG. */
static void
store_op1 (op, loc, arg)
re_opcode_t op;
unsigned char *loc;
int arg;
static void store_op1(re_opcode_t op, unsigned char *loc,
int arg)
{
*loc = (unsigned char) op;
STORE_NUMBER (loc + 1, arg);
@@ -2049,11 +2025,8 @@ store_op1 (op, loc, arg)
/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
static void
store_op2 (op, loc, arg1, arg2)
re_opcode_t op;
unsigned char *loc;
int arg1, arg2;
static void store_op2(re_opcode_t op, unsigned char *loc,
int arg1, int arg2)
{
*loc = (unsigned char) op;
STORE_NUMBER (loc + 1, arg1);
@@ -2064,12 +2037,8 @@ store_op2 (op, loc, arg1, arg2)
/* Copy the bytes from LOC to END to open up three bytes of space at LOC
for OP followed by two-byte integer parameter ARG. */
static void
insert_op1 (op, loc, arg, end)
re_opcode_t op;
unsigned char *loc;
int arg;
unsigned char *end;
static void insert_op1(re_opcode_t op, unsigned char *loc,
int arg, unsigned char *end)
{
register unsigned char *pfrom = end;
register unsigned char *pto = end + 3;
@@ -2083,12 +2052,8 @@ insert_op1 (op, loc, arg, end)
/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
static void
insert_op2 (op, loc, arg1, arg2, end)
re_opcode_t op;
unsigned char *loc;
int arg1, arg2;
unsigned char *end;
static void insert_op2(re_opcode_t op, unsigned char *loc,
int arg1, int arg2, unsigned char *end)
{
register unsigned char *pfrom = end;
register unsigned char *pto = end + 5;
@@ -2104,10 +2069,8 @@ insert_op2 (op, loc, arg1, arg2, end)
after an alternative or a begin-subexpression. We assume there is at
least one character before the ^. */
static boolean
at_begline_loc_p (pattern, p, syntax)
const char *pattern, *p;
reg_syntax_t syntax;
static boolean at_begline_loc_p(const char *pattern,
const char *p, reg_syntax_t syntax)
{
const char *prev = p - 2;
boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
@@ -2123,10 +2086,8 @@ at_begline_loc_p (pattern, p, syntax)
/* The dual of at_begline_loc_p. This one is for $. We assume there is
at least one character after the $, i.e., `P < PEND'. */
static boolean
at_endline_loc_p (p, pend, syntax)
const char *p, *pend;
int syntax;
static boolean at_endline_loc_p(const char *p,
const char *pend, int syntax)
{
const char *next = p;
boolean next_backslash = *next == '\\';
@@ -2145,10 +2106,8 @@ at_endline_loc_p (p, pend, syntax)
/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
false if it's not. */
static boolean
group_in_compile_stack (compile_stack, regnum)
compile_stack_type compile_stack;
regnum_t regnum;
static boolean group_in_compile_stack(compile_stack_type
compile_stack, regnum_t regnum)
{
int this_element;
@@ -2173,12 +2132,9 @@ group_in_compile_stack (compile_stack, regnum)
We use these short variable names so we can use the same macros as
`regex_compile' itself. */
static reg_errcode_t
compile_range (p_ptr, pend, translate, syntax, b)
const char **p_ptr, *pend;
char *translate;
reg_syntax_t syntax;
unsigned char *b;
static reg_errcode_t compile_range(const char **p_ptr,
const char *pend, char *translate,
reg_syntax_t syntax, unsigned char *b)
{
unsigned this_char;
@@ -2505,9 +2461,7 @@ typedef struct
Returns 0 if we succeed, -2 if an internal error. */
int
re_compile_fastmap (bufp)
struct re_pattern_buffer *bufp;
int re_compile_fastmap(struct re_pattern_buffer *bufp)
{
int j, k;
fail_stack_type fail_stack;
@@ -2790,12 +2744,10 @@ re_compile_fastmap (bufp)
PATTERN_BUFFER will allocate its own register data, without
freeing the old data. */
void
re_set_registers (bufp, regs, num_regs, starts, ends)
struct re_pattern_buffer *bufp;
struct re_registers *regs;
unsigned num_regs;
regoff_t *starts, *ends;
void re_set_registers(struct re_pattern_buffer *bufp,
struct re_registers *regs,
unsigned num_regs,
regoff_t *starts, regoff_t *ends)
{
if (num_regs)
{
@@ -2817,12 +2769,10 @@ re_set_registers (bufp, regs, num_regs, starts, ends)
/* Like re_search_2, below, but only one string is specified, and
doesn't let you say where to stop matching. */
int
re_search (bufp, string, size, startpos, range, regs)
struct re_pattern_buffer *bufp;
const char *string;
int size, startpos, range;
struct re_registers *regs;
int re_search(struct re_pattern_buffer *bufp,
const char *string, int size,
int startpos, int range,
struct re_registers *regs)
{
return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
regs, size);
@@ -2850,15 +2800,11 @@ re_search (bufp, string, size, startpos, range, regs)
found, -1 if no match, or -2 if error (such as failure
stack overflow). */
int
re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
struct re_pattern_buffer *bufp;
const char *string1, *string2;
int size1, size2;
int startpos;
int range;
struct re_registers *regs;
int stop;
int re_search_2(struct re_pattern_buffer *bufp,
const char *string1, int size1,
const char *string2, int size2,
int startpos, int range,
struct re_registers *regs, int stop)
{
int val;
register char *fastmap = bufp->fastmap;
@@ -3109,12 +3055,9 @@ typedef union
#ifndef emacs /* Emacs never uses this. */
/* re_match is like re_match_2 except it takes only a single string. */
int
re_match (bufp, string, size, pos, regs)
struct re_pattern_buffer *bufp;
const char *string;
int size, pos;
struct re_registers *regs;
int re_match(struct re_pattern_buffer *bufp,
const char *string, int size, int pos,
struct re_registers *regs)
{
return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size);
}
@@ -3134,14 +3077,10 @@ re_match (bufp, string, size, pos, regs)
failure stack overflowing). Otherwise, we return the length of the
matched substring. */
int
re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
struct re_pattern_buffer *bufp;
const char *string1, *string2;
int size1, size2;
int pos;
struct re_registers *regs;
int stop;
int re_match_2(struct re_pattern_buffer *bufp,
const char *string1, int size1,
const char *string2, int size2,
int pos, struct re_registers *regs, int stop)
{
/* General temporaries. */
int mcnt;
@@ -4330,10 +4269,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
We don't handle duplicates properly (yet). */
static boolean
group_match_null_string_p (p, end, reg_info)
unsigned char **p, *end;
register_info_type *reg_info;
static boolean group_match_null_string_p(unsigned char **p,
unsigned char *end,
register_info_type *reg_info)
{
int mcnt;
/* Point to after the args to the start_memory. */
@@ -4439,10 +4377,9 @@ group_match_null_string_p (p, end, reg_info)
It expects P to be the first byte of a single alternative and END one
byte past the last. The alternative can contain groups. */
static boolean
alt_match_null_string_p (p, end, reg_info)
unsigned char *p, *end;
register_info_type *reg_info;
static boolean alt_match_null_string_p(unsigned char *p,
unsigned char *end,
register_info_type *reg_info)
{
int mcnt;
unsigned char *p1 = p;
@@ -4476,10 +4413,9 @@ alt_match_null_string_p (p, end, reg_info)
Sets P to one after the op and its arguments, if any. */
static boolean
common_op_match_null_string_p (p, end, reg_info)
unsigned char **p, *end;
register_info_type *reg_info;
static boolean common_op_match_null_string_p(unsigned char **p,
unsigned char *end,
register_info_type *reg_info)
{
int mcnt;
boolean ret;
@@ -4564,13 +4500,8 @@ common_op_match_null_string_p (p, end, reg_info)
/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
bytes; nonzero otherwise. */
static int
bcmp_translate(
unsigned char *s1,
unsigned char *s2,
int len,
char *translate
)
static int bcmp_translate(unsigned char *s1, unsigned char *s2,
int len, char *translate)
{
register unsigned char *p1 = s1, *p2 = s2;
while (len)
@@ -4592,11 +4523,8 @@ bcmp_translate(
We call regex_compile to do the actual compilation. */
const char *
re_compile_pattern (pattern, length, bufp)
const char *pattern;
int length;
struct re_pattern_buffer *bufp;
const char *re_compile_pattern(const char *pattern,
int length, struct re_pattern_buffer *bufp)
{
reg_errcode_t ret;
@@ -4625,9 +4553,7 @@ re_compile_pattern (pattern, length, bufp)
/* BSD has one and only one pattern buffer. */
static struct re_pattern_buffer re_comp_buf;
char *
re_comp (s)
const char *s;
char *re_comp(const char *s)
{
reg_errcode_t ret;
@@ -4663,9 +4589,7 @@ re_comp (s)
}
int
re_exec (s)
const char *s;
int re_exec(const char *s)
{
const int len = strlen (s);
return
@@ -4711,11 +4635,7 @@ re_exec (s)
It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
the return codes and their meanings.) */
int
regcomp (preg, pattern, cflags)
regex_t *preg;
const char *pattern;
int cflags;
int regcomp(regex_t *preg, const char *pattern, int cflags)
{
reg_errcode_t ret;
unsigned syntax
@@ -4786,13 +4706,9 @@ regcomp (preg, pattern, cflags)
We return 0 if we find a match and REG_NOMATCH if not. */
int
regexec (preg, string, nmatch, pmatch, eflags)
const regex_t *preg;
const char *string;
size_t nmatch;
regmatch_t pmatch[];
int eflags;
int regexec(const regex_t *preg, const char *string,
size_t nmatch, regmatch_t pmatch[],
int eflags)
{
int ret;
struct re_registers regs;
@@ -4892,9 +4808,7 @@ regerror(int errcode, const regex_t *preg,
/* Free dynamically allocated space used by PREG. */
void
regfree (preg)
regex_t *preg;
void regfree(regex_t *preg)
{
if (preg->buffer != NULL)
free (preg->buffer);