Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Eliminate some usage of VOID and its variants. Remove unnecessary #undef's |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | novem |
Files: | files | file ages | folders |
SHA1: |
173d15f828eed9faf25b3928575f721e |
User & Date: | jan.nijtmans 2013-03-22 14:38:18 |
Context
2013-04-03
| ||
20:55 | merge trunk check-in: 025e044267 user: jan.nijtmans tags: novem | |
2013-03-22
| ||
14:38 | Eliminate some usage of VOID and its variants. Remove unnecessary #undef's check-in: 173d15f828 user: jan.nijtmans tags: novem | |
14:15 | merge trunk check-in: d836fd6c98 user: jan.nijtmans tags: novem | |
Changes
Changes to generic/regc_lex.c.
︙ | ︙ | |||
440 441 442 443 444 445 446 | if (!(v->cflags®_ADVF)) { RETV(PLAIN, c); } NOTE(REG_UNONPOSIX); if (ATEOS()) { FAILW(REG_EESCAPE); } | | | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | if (!(v->cflags®_ADVF)) { RETV(PLAIN, c); } NOTE(REG_UNONPOSIX); if (ATEOS()) { FAILW(REG_EESCAPE); } (void)lexescape(v); switch (v->nexttype) { /* not all escapes okay here */ case PLAIN: return 1; break; case CCLASS: switch (v->nextvalue) { case 'd': |
︙ | ︙ | |||
699 700 701 702 703 704 705 | if (!(v->cflags®_ADVF)) {/* only AREs have non-trivial escapes */ if (iscalnum(*v->now)) { NOTE(REG_UBSALNUM); NOTE(REG_UUNSPEC); } RETV(PLAIN, *v->now++); } | | | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | if (!(v->cflags®_ADVF)) {/* only AREs have non-trivial escapes */ if (iscalnum(*v->now)) { NOTE(REG_UBSALNUM); NOTE(REG_UUNSPEC); } RETV(PLAIN, *v->now++); } (void)lexescape(v); if (ISERR()) { FAILW(REG_EESCAPE); } if (v->nexttype == CCLASS) {/* fudge at lexical level */ switch (v->nextvalue) { case 'd': lexnest(v, backd, ENDOF(backd)); break; case 'D': lexnest(v, backD, ENDOF(backD)); break; |
︙ | ︙ | |||
1126 1127 1128 1129 1130 1131 1132 | NOTE(REG_UNONPOSIX); } } /* - newline - return the chr for a newline * This helps confine use of CHR to this source file. | | | | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | NOTE(REG_UNONPOSIX); } } /* - newline - return the chr for a newline * This helps confine use of CHR to this source file. ^ static chr newline(void); */ static chr newline(void) { return CHR('\n'); } /* - ch - return the chr sequence for regc_locale.c's fake collating element ch * This helps confine use of CHR to this source file. Beware that the caller * knows how long the sequence is. ^ #ifdef REG_DEBUG ^ static const chr *ch(void); ^ #endif */ #ifdef REG_DEBUG static const chr * ch(void) { static const chr chstr[] = { CHR('c'), CHR('h'), CHR('\0') }; |
︙ | ︙ |
Changes to generic/regc_locale.c.
︙ | ︙ | |||
1164 1165 1166 1167 1168 1169 1170 | ^ static int cmp(const chr *, const chr *, size_t); */ static int /* 0 for equal, nonzero for unequal */ cmp( const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { | | | 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 | ^ static int cmp(const chr *, const chr *, size_t); */ static int /* 0 for equal, nonzero for unequal */ cmp( const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { return memcmp((void*)(x), (void*)(y), len*sizeof(chr)); } /* - casecmp - case-independent chr-substring compare * REG_ICASE backrefs need this. It should preferably be efficient. * Note that it does not need to report anything except equal/unequal. * Note also that the length is exact, and the comparison should not |
︙ | ︙ |
Changes to generic/regc_nfa.c.
︙ | ︙ | |||
613 614 615 616 617 618 619 | assert(oldState->nins == 0); assert(oldState->ins == NULL); } /* - copyins - copy in arcs of a state to another state * Either all arcs, or only non-empty ones as determined by all value. | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | assert(oldState->nins == 0); assert(oldState->ins == NULL); } /* - copyins - copy in arcs of a state to another state * Either all arcs, or only non-empty ones as determined by all value. ^ static void copyins(struct nfa *, struct state *, struct state *, int); */ static void copyins( struct nfa *nfa, struct state *oldState, struct state *newState, int all) |
︙ | ︙ | |||
656 657 658 659 660 661 662 | freearc(nfa, a); } } /* - copyouts - copy out arcs of a state to another state * Either all arcs, or only non-empty ones as determined by all value. | | | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | freearc(nfa, a); } } /* - copyouts - copy out arcs of a state to another state * Either all arcs, or only non-empty ones as determined by all value. ^ static void copyouts(struct nfa *, struct state *, struct state *, int); */ static void copyouts( struct nfa *nfa, struct state *oldState, struct state *newState, int all) |
︙ | ︙ |
Changes to generic/regcomp.c.
︙ | ︙ | |||
78 79 80 81 82 83 84 | static void lexnest(struct vars *, const chr *, const chr *); static void lexword(struct vars *); static int next(struct vars *); static int lexescape(struct vars *); static int lexdigits(struct vars *, int, int, int); static int brenext(struct vars *, pchr); static void skip(struct vars *); | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | static void lexnest(struct vars *, const chr *, const chr *); static void lexword(struct vars *); static int next(struct vars *); static int lexescape(struct vars *); static int lexdigits(struct vars *, int, int, int); static int brenext(struct vars *, pchr); static void skip(struct vars *); static chr newline(void); #ifdef REG_DEBUG static const chr *ch(void); #endif static chr chrnamed(struct vars *, const chr *, const chr *, pchr); /* === regc_color.c === */ static void initcm(struct vars *, struct colormap *); static void freecm(struct colormap *); static void cmtreefree(struct colormap *, union tree *, int); static color setcolor(struct colormap *, pchr, pcolor); |
︙ | ︙ | |||
324 325 326 327 328 329 330 | v->cv2 = NULL; v->lacons = NULL; v->nlacons = 0; re->re_magic = REMAGIC; re->re_info = 0; /* bits get set during parse */ re->re_csize = sizeof(chr); re->re_guts = NULL; | | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | v->cv2 = NULL; v->lacons = NULL; v->nlacons = 0; re->re_magic = REMAGIC; re->re_info = 0; /* bits get set during parse */ re->re_csize = sizeof(chr); re->re_guts = NULL; re->re_fns = (void*)(&functions); /* * More complex setup, malloced things. */ re->re_guts = (void*)(MALLOC(sizeof(struct guts))); if (re->re_guts == NULL) { return freev(v, REG_ESPACE); } g = (struct guts *) re->re_guts; g->tree = NULL; initcm(v, &g->cmap); v->cm = &g->cmap; |
︙ | ︙ | |||
417 418 419 420 421 422 423 | fprintf(debug, "\n\n\n========= SEARCH ==========\n"); } /* * Can sacrifice main NFA now, so use it as work area. */ | | | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | fprintf(debug, "\n\n\n========= SEARCH ==========\n"); } /* * Can sacrifice main NFA now, so use it as work area. */ (void) optimize(v->nfa, debug); CNOERR(); makesearch(v, v->nfa); CNOERR(); compact(v->nfa, &g->search); CNOERR(); /* |
︙ | ︙ | |||
1870 1871 1872 1873 1874 1875 1876 | struct vars *v, struct subre *t, FILE *f) /* for debug output */ { assert(t != NULL && t->begin != NULL); if (t->left != NULL) { | | | | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 | struct vars *v, struct subre *t, FILE *f) /* for debug output */ { assert(t != NULL && t->begin != NULL); if (t->left != NULL) { (void) nfatree(v, t->left, f); } if (t->right != NULL) { (void) nfatree(v, t->right, f); } return nfanode(v, t, f); } /* - nfanode - do one NFA for nfatree |
︙ | ︙ |
Changes to generic/regcustom.h.
︙ | ︙ | |||
32 33 34 35 36 37 38 | #include "regex.h" /* * Overrides for regguts.h definitions, if any. */ | < | | | < < < < | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include "regex.h" /* * Overrides for regguts.h definitions, if any. */ #define MALLOC(n) ((void*)(attemptckalloc(n))) #define FREE(p) ckfree((void*)(p)) #define REALLOC(p,n) ((void*)(attemptckrealloc((void*)(p),n))) /* * Do not insert extras between the "begin" and "end" lines - this chunk is * automatically extracted to be fitted into regex.h. */ /* --- begin --- */ /* Ensure certain things don't sneak in from system headers. */ #ifdef __REG_WIDE_T #undef __REG_WIDE_T #endif #ifdef __REG_WIDE_COMPILE #undef __REG_WIDE_COMPILE #endif #ifdef __REG_WIDE_EXEC #undef __REG_WIDE_EXEC #endif #ifdef __REG_REGOFF_T #undef __REG_REGOFF_T #endif #ifdef __REG_NOFRONT #undef __REG_NOFRONT #endif #ifdef __REG_NOCHAR #undef __REG_NOCHAR #endif /* Interface types */ #define __REG_WIDE_T Tcl_UniChar #define __REG_REGOFF_T long /* Not really right, but good enough... */ /* Names and declarations */ #define __REG_WIDE_COMPILE TclReComp #define __REG_WIDE_EXEC TclReExec #define __REG_NOFRONT /* Don't want regcomp() and regexec() */ #define __REG_NOCHAR /* Or the char versions */ #define regfree TclReFree #define regerror TclReError |
︙ | ︙ |
Changes to generic/regex.h.
︙ | ︙ | |||
88 89 90 91 92 93 94 | #endif #ifdef __REG_WIDE_EXEC #undef __REG_WIDE_EXEC #endif #ifdef __REG_REGOFF_T #undef __REG_REGOFF_T #endif | < < < < | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #endif #ifdef __REG_WIDE_EXEC #undef __REG_WIDE_EXEC #endif #ifdef __REG_REGOFF_T #undef __REG_REGOFF_T #endif #ifdef __REG_NOFRONT #undef __REG_NOFRONT #endif #ifdef __REG_NOCHAR #undef __REG_NOCHAR #endif /* interface types */ #define __REG_WIDE_T Tcl_UniChar #define __REG_REGOFF_T long /* not really right, but good enough... */ /* names and declarations */ #define __REG_WIDE_COMPILE TclReComp #define __REG_WIDE_EXEC TclReExec #define __REG_NOFRONT /* don't want regcomp() and regexec() */ #define __REG_NOCHAR /* or the char versions */ #define regfree TclReFree #define regerror TclReError |
︙ | ︙ | |||
125 126 127 128 129 130 131 | */ #ifdef __REG_REGOFF_T typedef __REG_REGOFF_T regoff_t; #else typedef long regoff_t; #endif | < < < < < < < < < < | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | */ #ifdef __REG_REGOFF_T typedef __REG_REGOFF_T regoff_t; #else typedef long regoff_t; #endif /* * other interface types */ /* the biggie, a compiled RE (or rather, a front end to same) */ typedef struct { int re_magic; /* magic number */ |
︙ | ︙ | |||
230 231 232 233 234 235 236 | #define REG_STARTEND 0004 /* backward compatibility kludge */ #define REG_FTRACE 0010 /* none of your business */ #define REG_MTRACE 0020 /* none of your business */ #define REG_SMALL 0040 /* none of your business */ /* * misc generics (may be more functions here eventually) | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | #define REG_STARTEND 0004 /* backward compatibility kludge */ #define REG_FTRACE 0010 /* none of your business */ #define REG_MTRACE 0020 /* none of your business */ #define REG_SMALL 0040 /* none of your business */ /* * misc generics (may be more functions here eventually) ^ void regfree(regex_t *); */ /* * error reporting * Be careful if modifying the list of error codes -- the table used by * regerror() is generated automatically from this file! * |
︙ | ︙ | |||
291 292 293 294 295 296 297 | #endif #ifndef __REG_NOFRONT int regexec(regex_t *, const char *, size_t, regmatch_t [], int); #endif #ifdef __REG_WIDE_T MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | #endif #ifndef __REG_NOFRONT int regexec(regex_t *, const char *, size_t, regmatch_t [], int); #endif #ifdef __REG_WIDE_T MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, const __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif MODULE_SCOPE void regfree(regex_t *); MODULE_SCOPE size_t regerror(int, const regex_t *, char *, size_t); /* automatically gathered by fwd; do not hand-edit */ /* =====^!^===== end forwards =====^!^===== */ /* * more C++ voodoo */ |
︙ | ︙ |
Changes to generic/regexec.c.
︙ | ︙ | |||
40 41 42 43 44 45 46 | }; struct sset { /* state set */ unsigned *states; /* pointer to bitvector */ unsigned hash; /* hash of bitvector */ #define HASH(bv, nw) (((nw) == 1) ? *(bv) : hash(bv, nw)) #define HIT(h,bv,ss,nw) ((ss)->hash == (h) && ((nw) == 1 || \ | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | }; struct sset { /* state set */ unsigned *states; /* pointer to bitvector */ unsigned hash; /* hash of bitvector */ #define HASH(bv, nw) (((nw) == 1) ? *(bv) : hash(bv, nw)) #define HIT(h,bv,ss,nw) ((ss)->hash == (h) && ((nw) == 1 || \ memcmp((void*)(bv), (void*)((ss)->states), (nw)*sizeof(unsigned)) == 0)) int flags; #define STARTER 01 /* the initial state set */ #define POSTSTATE 02 /* includes the goal state */ #define LOCKED 04 /* locked in cache */ #define NOPROGRESS 010 /* zero-progress state set */ struct arcp ins; /* chain of inarcs pointing here */ chr *lastseen; /* last entered on arrival here */ |
︙ | ︙ | |||
272 273 274 275 276 277 278 | /* * Copy (portion of) match vector over if necessary. */ if (st == REG_OKAY && v->pmatch != pmatch && nmatch > 0) { zapSubexpressions(pmatch, nmatch); n = (nmatch < v->nmatch) ? nmatch : v->nmatch; | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | /* * Copy (portion of) match vector over if necessary. */ if (st == REG_OKAY && v->pmatch != pmatch && nmatch > 0) { zapSubexpressions(pmatch, nmatch); n = (nmatch < v->nmatch) ? nmatch : v->nmatch; memcpy((void*)(pmatch), (void*)(v->pmatch), n*sizeof(regmatch_t)); } /* * Clean up. */ if (v->pmatch != pmatch && v->pmatch != mat) { |
︙ | ︙ |
Changes to generic/regguts.h.
︙ | ︙ | |||
45 46 47 48 49 50 51 | #ifndef NDEBUG #define NDEBUG /* no assertions */ #endif #endif /* !REG_DEBUG */ #include <assert.h> #endif | < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #ifndef NDEBUG #define NDEBUG /* no assertions */ #endif #endif /* !REG_DEBUG */ #include <assert.h> #endif /* memory allocation */ #ifndef MALLOC #define MALLOC(n) malloc(n) #endif #ifndef REALLOC #define REALLOC(p, n) realloc((void*)(p), n) #endif #ifndef FREE #define FREE(p) free((void*)(p)) #endif /* want size of a char in bits, and max value in bounded quantifiers */ #ifndef _POSIX2_RE_DUP_MAX #define _POSIX2_RE_DUP_MAX 255 /* normally from <limits.h> */ #endif |
︙ | ︙ | |||
362 363 364 365 366 367 368 | /* * table of function pointers for generic manipulation functions. A regex_t's * re_fns points to one of these. */ struct fns { | | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | /* * table of function pointers for generic manipulation functions. A regex_t's * re_fns points to one of these. */ struct fns { void (*free)(regex_t *); }; /* * the insides of a regex_t, hidden behind a void * */ struct guts { int magic; #define GUTSMAGIC 0xfed9 int cflags; /* copy of compile flags */ long info; /* copy of re_info */ size_t nsub; /* copy of re_nsub */ struct subre *tree; struct cnfa search; /* for fast preliminary search */ int ntree; struct colormap cmap; int (*compare) (const chr *, const chr *, size_t); struct subre *lacons; /* lookahead-constraint vector */ int nlacons; /* size of lacons */ }; /* * Magic for allocating a variable workspace. This default version is * stack-hungry. |
︙ | ︙ |
Changes to generic/tclBasic.c.
︙ | ︙ | |||
6191 6192 6193 6194 6195 6196 6197 | * The value of the Tcl_obj is appended to the errorInfo field. If we are * just starting to log an error, errorInfo is initialized from the error * message in the interpreter's result. * *---------------------------------------------------------------------- */ | < | 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 | * The value of the Tcl_obj is appended to the errorInfo field. If we are * just starting to log an error, errorInfo is initialized from the error * message in the interpreter's result. * *---------------------------------------------------------------------- */ void Tcl_AppendObjToErrorInfo( Tcl_Interp *interp, /* Interpreter to which error information * pertains. */ Tcl_Obj *objPtr) /* Message to record. */ { int length; |
︙ | ︙ |
Changes to generic/tclDecls.h.
︙ | ︙ | |||
3724 3725 3726 3727 3728 3729 3730 | #define Tcl_UntraceVar(interp, varName, flags, proc, clientData) \ Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData) #define Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) \ Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData) #define Tcl_UpVar(interp, frameName, varName, localName, flags) \ Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) | < < < | 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 | #define Tcl_UntraceVar(interp, varName, flags, proc, clientData) \ Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData) #define Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) \ Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData) #define Tcl_UpVar(interp, frameName, varName, localName, flags) \ Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) /* * Deprecated Tcl procedures: */ #ifndef TCL_NO_DEPRECATED # define Tcl_EvalObj(interp,objPtr) \ Tcl_EvalObjEx((interp),(objPtr),0) |
︙ | ︙ |
Changes to generic/tclIntDecls.h.
︙ | ︙ | |||
1205 1206 1207 1208 1209 1210 1211 | #define TclSetSlaveCancelFlags \ (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */ #endif /* defined(USE_TCL_STUBS) */ /* !END!: Do not edit above this line. */ | < < < | 1205 1206 1207 1208 1209 1210 1211 1212 | #define TclSetSlaveCancelFlags \ (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */ #endif /* defined(USE_TCL_STUBS) */ /* !END!: Do not edit above this line. */ #endif /* _TCLINTDECLS */ |