@matheusbsbs / matheus-bagliano / commits / 178b33157a
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Aug 19, 2010 at 15:31 UTC 178b33157aba98e34f641408105be54f42cbe5bc
2 files changed +55 -69
compat/regex/regcomp.c
+9 -14
@@ -230,10 +230,9 @@ btowc (int c)
230 are set in BUFP on entry. */
231
232 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)
236 {
237 reg_errcode_t ret;
238
@@ -271,8 +270,7 @@ reg_syntax_t re_syntax_options;
270 defined in regex.h. We return the old syntax. */
271
272 reg_syntax_t
274 -re_set_syntax (syntax)
275 - reg_syntax_t syntax;
273 +re_set_syntax (reg_syntax_t syntax)
274 {
275 reg_syntax_t ret = re_syntax_options;
276
@@ -284,8 +282,7 @@ weak_alias (__re_set_syntax, re_set_syntax)
282 #endif
283
284 int
287 -re_compile_fastmap (bufp)
288 - struct re_pattern_buffer *bufp;
285 +re_compile_fastmap (struct re_pattern_buffer *bufp)
286 {
287 re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
288 char *fastmap = bufp->fastmap;
@@ -484,10 +481,9 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
481 the return codes and their meanings.) */
482
483 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)
487 {
488 reg_errcode_t ret;
489 reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
@@ -650,8 +646,7 @@ free_dfa_content (re_dfa_t *dfa)
646 /* Free dynamically allocated space used by PREG. */
647
648 void
653 -regfree (preg)
654 - regex_t *preg;
649 +regfree (regex_t *preg)
650 {
651 re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
652 if (BE (dfa != NULL, 1))
compat/regex/regexec.c
+46 -55
@@ -218,12 +218,12 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx)
218 We return 0 if we find a match and REG_NOMATCH if not. */
219
220 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)
227 {
228 reg_errcode_t err;
229 int start, length;
@@ -303,11 +303,11 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
303 match was found and -2 indicates an internal error. */
304
305 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)
311 {
312 return re_search_stub (bufp, string, length, start, 0, length, regs, 1);
313 }
@@ -316,11 +316,10 @@ weak_alias (__re_match, re_match)
316 #endif
317
318 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)
323 {
324 return re_search_stub (bufp, string, length, start, range, length, regs, 0);
325 }
@@ -329,11 +328,10 @@ weak_alias (__re_search, re_search)
328 #endif
329
330 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)
335 {
336 return re_search_2_stub (bufp, string1, length1, string2, length2,
337 start, 0, regs, stop, 1);
@@ -343,11 +341,10 @@ weak_alias (__re_match_2, re_match_2)
341 #endif
342
343 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)
348 {
349 return re_search_2_stub (bufp, string1, length1, string2, length2,
350 start, range, regs, stop, 0);
@@ -357,12 +354,11 @@ weak_alias (__re_search_2, re_search_2)
354 #endif
355
356 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)
362 {
363 const char *str;
364 int rval;
@@ -402,11 +398,10 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs,
398 otherwise the position of the match is returned. */
399
400 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)
405 {
406 reg_errcode_t result;
407 regmatch_t *pmatch;
@@ -490,10 +485,9 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
485 }
486
487 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)
491 {
492 int rval = REGS_REALLOCATE;
493 int i;
@@ -570,11 +564,11 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated)
564 freeing the old data. */
565
566 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)
572 {
573 if (num_regs)
574 {
@@ -621,13 +615,11 @@ re_exec (s)
615 (START + RANGE >= 0 && START + RANGE <= LENGTH) */
616
617 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)
623 {
624 reg_errcode_t err;
625 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,
939 }
940
941 static reg_errcode_t
950 -prune_impossible_nodes (mctx)
951 - re_match_context_t *mctx;
942 +prune_impossible_nodes (re_match_context_t *mctx)
943 {
944 const re_dfa_t *const dfa = mctx->dfa;
945 int halt_node, match_last;