Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Code cleanup: less (size_t) casts |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | utf-max-6 |
Files: | files | file ages | folders |
SHA3-256: |
ab3bc46fe1ed572616eeaea3d944606c |
User & Date: | jan.nijtmans 2019-03-08 19:51:26.603 |
Context
2019-03-08
| ||
21:27 | Make -DTCL_UTF_MAX=6-build work on win32. Add travis builds to prove it. check-in: 1df1b22fad user: jan.nijtmans tags: core-8-branch | |
19:51 | Code cleanup: less (size_t) casts Closed-Leaf check-in: ab3bc46fe1 user: jan.nijtmans tags: utf-max-6 | |
2019-03-07
| ||
22:02 | Fixes for TCL_UTF_MAX=6, (gcc compiler warnings). Also make everything work on win32/win64. Patch ad... check-in: 650574e0fb user: jan.nijtmans tags: utf-max-6 | |
Changes
Changes to generic/regcomp.c.
︙ | ︙ | |||
206 207 208 209 210 211 212 | int cflags; /* copy of compile flags */ int lasttype; /* type of previous token */ int nexttype; /* type of next token */ chr nextvalue; /* value (if any) of next token */ int lexcon; /* lexical context type (see lex.c) */ int nsubexp; /* subexpression count */ struct subre **subs; /* subRE pointer vector */ | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | int cflags; /* copy of compile flags */ int lasttype; /* type of previous token */ int nexttype; /* type of next token */ chr nextvalue; /* value (if any) of next token */ int lexcon; /* lexical context type (see lex.c) */ int nsubexp; /* subexpression count */ struct subre **subs; /* subRE pointer vector */ int nsubs; /* length of vector */ struct subre *sub10[10]; /* initial vector, enough for most */ struct nfa *nfa; /* the NFA */ struct colormap *cm; /* character color map */ color nlcolor; /* color of newline */ struct state *wordchrs; /* state in nfa holding word-char outarcs */ struct subre *tree; /* subexpression tree */ struct subre *treechain; /* all tree nodes allocated */ |
︙ | ︙ | |||
283 284 285 286 287 288 289 | regex_t *re, const chr *string, size_t len, int flags) { AllocVars(v); struct guts *g; | | < | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | regex_t *re, const chr *string, size_t len, int flags) { AllocVars(v); struct guts *g; int i, j; FILE *debug = (flags®_PROGRESS) ? stdout : NULL; #define CNOERR() { if (ISERR()) return freev(v, v->err); } /* * Sanity checks. */ |
︙ | ︙ | |||
473 474 475 476 477 478 479 | */ static void moresubs( struct vars *v, int wanted) /* want enough room for this one */ { struct subre **p; | | | | | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | */ static void moresubs( struct vars *v, int wanted) /* want enough room for this one */ { struct subre **p; int n; assert(wanted > 0 && wanted >= v->nsubs); n = wanted * 3 / 2 + 1; if (v->subs == v->sub10) { p = (struct subre **) MALLOC(n * sizeof(struct subre *)); if (p != NULL) { memcpy(p, v->subs, v->nsubs * sizeof(struct subre *)); } } else { p = (struct subre **) REALLOC(v->subs, n*sizeof(struct subre *)); } if (p == NULL) { ERR(REG_ESPACE); return; } v->subs = p; for (p = &v->subs[v->nsubs]; v->nsubs < n; p++, v->nsubs++) { *p = NULL; } assert(v->nsubs == n); assert(wanted < v->nsubs); } /* - freev - free vars struct's substructures where necessary * Optionally does error-number setting, and always returns error code (if * any), to make error-handling code terser. ^ static int freev(struct vars *, int); |
︙ | ︙ | |||
950 951 952 953 954 955 956 | */ case '(': /* value flags as capturing or non */ cap = (type == LACON) ? 0 : v->nextvalue; if (cap) { v->nsubexp++; subno = v->nsubexp; | | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | */ case '(': /* value flags as capturing or non */ cap = (type == LACON) ? 0 : v->nextvalue; if (cap) { v->nsubexp++; subno = v->nsubexp; if (subno >= v->nsubs) { moresubs(v, subno); } assert(subno < v->nsubs); } else { atomtype = PLAIN; /* something that's not '(' */ } NEXT(); /* * Need new endpoints because tree will contain pointers. |
︙ | ︙ |
Changes to generic/regexec.c.
︙ | ︙ | |||
168 169 170 171 172 173 174 | rm_detail_t *details, size_t nmatch, regmatch_t pmatch[], int flags) { AllocVars(v); int st, backref; | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | rm_detail_t *details, size_t nmatch, regmatch_t pmatch[], int flags) { AllocVars(v); int st, backref; int n; int i; #define LOCALMAT 20 regmatch_t mat[LOCALMAT]; #define LOCALDFAS 40 struct dfa *subdfas[LOCALDFAS]; /* * Sanity checks. |
︙ | ︙ | |||
232 233 234 235 236 237 238 | v->pmatch = pmatch; } v->details = details; v->start = (chr *)string; v->stop = (chr *)string + len; v->err = 0; assert(v->g->ntree >= 0); | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | v->pmatch = pmatch; } v->details = details; v->start = (chr *)string; v->stop = (chr *)string + len; v->err = 0; assert(v->g->ntree >= 0); n = v->g->ntree; if (n <= LOCALDFAS) v->subdfas = subdfas; else v->subdfas = (struct dfa **) MALLOC(n * sizeof(struct dfa *)); if (v->subdfas == NULL) { if (v->pmatch != pmatch && v->pmatch != mat) FREE(v->pmatch); |
︙ | ︙ | |||
274 275 276 277 278 279 280 | /* * Clean up. */ if (v->pmatch != pmatch && v->pmatch != mat) { FREE(v->pmatch); } | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | /* * Clean up. */ if (v->pmatch != pmatch && v->pmatch != mat) { FREE(v->pmatch); } n = v->g->ntree; for (i = 0; i < n; i++) { if (v->subdfas[i] != NULL) freeDFA(v->subdfas[i]); } if (v->subdfas != subdfas) FREE(v->subdfas); FreeVars(v); |
︙ | ︙ |