Skip to content

Commit 178b331

Browse files
committed
compat/regex: get rid of old-style definition
These files mostly used ANSI style function definitions, but with small number of old-style ones. Convert them to consistently use ANSI style. Signed-off-by: Junio C Hamano <[email protected]>
1 parent b50f370 commit 178b331

File tree

2 files changed

+55
-69
lines changed

2 files changed

+55
-69
lines changed

compat/regex/regcomp.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,9 @@ btowc (int c)
230230
are set in BUFP on entry. */
231231

232232
const char *
233-
re_compile_pattern (pattern, length, bufp)
234-
const char *pattern;
235-
size_t length;
236-
struct re_pattern_buffer *bufp;
233+
re_compile_pattern (const char *pattern,
234+
size_t length,
235+
struct re_pattern_buffer *bufp)
237236
{
238237
reg_errcode_t ret;
239238

@@ -271,8 +270,7 @@ reg_syntax_t re_syntax_options;
271270
defined in regex.h. We return the old syntax. */
272271

273272
reg_syntax_t
274-
re_set_syntax (syntax)
275-
reg_syntax_t syntax;
273+
re_set_syntax (reg_syntax_t syntax)
276274
{
277275
reg_syntax_t ret = re_syntax_options;
278276

@@ -284,8 +282,7 @@ weak_alias (__re_set_syntax, re_set_syntax)
284282
#endif
285283

286284
int
287-
re_compile_fastmap (bufp)
288-
struct re_pattern_buffer *bufp;
285+
re_compile_fastmap (struct re_pattern_buffer *bufp)
289286
{
290287
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
291288
char *fastmap = bufp->fastmap;
@@ -484,10 +481,9 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
484481
the return codes and their meanings.) */
485482

486483
int
487-
regcomp (preg, pattern, cflags)
488-
regex_t *__restrict preg;
489-
const char *__restrict pattern;
490-
int cflags;
484+
regcomp (regex_t *__restrict preg,
485+
const char *__restrict pattern,
486+
int cflags)
491487
{
492488
reg_errcode_t ret;
493489
reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
@@ -650,8 +646,7 @@ free_dfa_content (re_dfa_t *dfa)
650646
/* Free dynamically allocated space used by PREG. */
651647

652648
void
653-
regfree (preg)
654-
regex_t *preg;
649+
regfree (regex_t *preg)
655650
{
656651
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
657652
if (BE (dfa != NULL, 1))

compat/regex/regexec.c

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx)
218218
We return 0 if we find a match and REG_NOMATCH if not. */
219219

220220
int
221-
regexec (preg, string, nmatch, pmatch, eflags)
222-
const regex_t *__restrict preg;
223-
const char *__restrict string;
224-
size_t nmatch;
225-
regmatch_t pmatch[];
226-
int eflags;
221+
regexec (
222+
const regex_t *__restrict preg,
223+
const char *__restrict string,
224+
size_t nmatch,
225+
regmatch_t pmatch[],
226+
int eflags)
227227
{
228228
reg_errcode_t err;
229229
int start, length;
@@ -303,11 +303,11 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
303303
match was found and -2 indicates an internal error. */
304304

305305
int
306-
re_match (bufp, string, length, start, regs)
307-
struct re_pattern_buffer *bufp;
308-
const char *string;
309-
int length, start;
310-
struct re_registers *regs;
306+
re_match (struct re_pattern_buffer *bufp,
307+
const char *string,
308+
int length,
309+
int start,
310+
struct re_registers *regs)
311311
{
312312
return re_search_stub (bufp, string, length, start, 0, length, regs, 1);
313313
}
@@ -316,11 +316,10 @@ weak_alias (__re_match, re_match)
316316
#endif
317317

318318
int
319-
re_search (bufp, string, length, start, range, regs)
320-
struct re_pattern_buffer *bufp;
321-
const char *string;
322-
int length, start, range;
323-
struct re_registers *regs;
319+
re_search (struct re_pattern_buffer *bufp,
320+
const char *string,
321+
int length, int start, int range,
322+
struct re_registers *regs)
324323
{
325324
return re_search_stub (bufp, string, length, start, range, length, regs, 0);
326325
}
@@ -329,11 +328,10 @@ weak_alias (__re_search, re_search)
329328
#endif
330329

331330
int
332-
re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop)
333-
struct re_pattern_buffer *bufp;
334-
const char *string1, *string2;
335-
int length1, length2, start, stop;
336-
struct re_registers *regs;
331+
re_match_2 (struct re_pattern_buffer *bufp,
332+
const char *string1, int length1,
333+
const char *string2, int length2, int start,
334+
struct re_registers *regs, int stop)
337335
{
338336
return re_search_2_stub (bufp, string1, length1, string2, length2,
339337
start, 0, regs, stop, 1);
@@ -343,11 +341,10 @@ weak_alias (__re_match_2, re_match_2)
343341
#endif
344342

345343
int
346-
re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop)
347-
struct re_pattern_buffer *bufp;
348-
const char *string1, *string2;
349-
int length1, length2, start, range, stop;
350-
struct re_registers *regs;
344+
re_search_2 (struct re_pattern_buffer *bufp,
345+
const char *string1, int length1,
346+
const char *string2, int length2, int start,
347+
int range, struct re_registers *regs, int stop)
351348
{
352349
return re_search_2_stub (bufp, string1, length1, string2, length2,
353350
start, range, regs, stop, 0);
@@ -357,12 +354,11 @@ weak_alias (__re_search_2, re_search_2)
357354
#endif
358355

359356
static int
360-
re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
361-
stop, ret_len)
362-
struct re_pattern_buffer *bufp;
363-
const char *string1, *string2;
364-
int length1, length2, start, range, stop, ret_len;
365-
struct re_registers *regs;
357+
re_search_2_stub (struct re_pattern_buffer *bufp,
358+
const char *string1, int length1,
359+
const char *string2, int length2, int start,
360+
int range, struct re_registers *regs,
361+
int stop, int ret_len)
366362
{
367363
const char *str;
368364
int rval;
@@ -402,11 +398,10 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
402398
otherwise the position of the match is returned. */
403399

404400
static int
405-
re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
406-
struct re_pattern_buffer *bufp;
407-
const char *string;
408-
int length, start, range, stop, ret_len;
409-
struct re_registers *regs;
401+
re_search_stub (struct re_pattern_buffer *bufp,
402+
const char *string, int length, int start,
403+
int range, int stop,
404+
struct re_registers *regs, int ret_len)
410405
{
411406
reg_errcode_t result;
412407
regmatch_t *pmatch;
@@ -490,10 +485,9 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
490485
}
491486

492487
static unsigned
493-
re_copy_regs (regs, pmatch, nregs, regs_allocated)
494-
struct re_registers *regs;
495-
regmatch_t *pmatch;
496-
int nregs, regs_allocated;
488+
re_copy_regs (struct re_registers *regs,
489+
regmatch_t *pmatch,
490+
int nregs, int regs_allocated)
497491
{
498492
int rval = REGS_REALLOCATE;
499493
int i;
@@ -570,11 +564,11 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
570564
freeing the old data. */
571565

572566
void
573-
re_set_registers (bufp, regs, num_regs, starts, ends)
574-
struct re_pattern_buffer *bufp;
575-
struct re_registers *regs;
576-
unsigned num_regs;
577-
regoff_t *starts, *ends;
567+
re_set_registers (struct re_pattern_buffer *bufp,
568+
struct re_registers *regs,
569+
unsigned num_regs,
570+
regoff_t *starts,
571+
regoff_t *ends)
578572
{
579573
if (num_regs)
580574
{
@@ -621,13 +615,11 @@ re_exec (s)
621615
(START + RANGE >= 0 && START + RANGE <= LENGTH) */
622616

623617
static reg_errcode_t
624-
re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
625-
eflags)
626-
const regex_t *preg;
627-
const char *string;
628-
int length, start, range, stop, eflags;
629-
size_t nmatch;
630-
regmatch_t pmatch[];
618+
re_search_internal (const regex_t *preg,
619+
const char *string,
620+
int length, int start, int range, int stop,
621+
size_t nmatch, regmatch_t pmatch[],
622+
int eflags)
631623
{
632624
reg_errcode_t err;
633625
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
@@ -947,8 +939,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
947939
}
948940

949941
static reg_errcode_t
950-
prune_impossible_nodes (mctx)
951-
re_match_context_t *mctx;
942+
prune_impossible_nodes (re_match_context_t *mctx)
952943
{
953944
const re_dfa_t *const dfa = mctx->dfa;
954945
int halt_node, match_last;

0 commit comments

Comments
 (0)