"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/regex.c" between
flex-2.6.3.tar.gz and flex-2.6.4.tar.gz

About: Flex ("Fast Lexical Analyzer") is a tool for generating scanners/tokenizers.

regex.c  (flex-2.6.3):regex.c  (flex-2.6.4)
skipping to change at line 55 skipping to change at line 55
* @param regex Same as for regcomp(). * @param regex Same as for regcomp().
* @param cflags Same as for regcomp(). * @param cflags Same as for regcomp().
*/ */
void flex_regcomp(regex_t *preg, const char *regex, int cflags) void flex_regcomp(regex_t *preg, const char *regex, int cflags)
{ {
int err; int err;
memset (preg, 0, sizeof (regex_t)); memset (preg, 0, sizeof (regex_t));
if ((err = regcomp (preg, regex, cflags)) != 0) { if ((err = regcomp (preg, regex, cflags)) != 0) {
const size_t errbuf_sz = 200; const size_t errbuf_sz = 200;
char *errbuf, *rxerr; char *errbuf;
int n;
errbuf = malloc(errbuf_sz * sizeof(char)); errbuf = malloc(errbuf_sz * sizeof(char));
if (!errbuf) if (!errbuf)
flexfatal(_("Unable to allocate buffer to report regcomp" )); flexfatal(_("Unable to allocate buffer to report regcomp" ));
rxerr = malloc(errbuf_sz * sizeof(char)); n = snprintf(errbuf, errbuf_sz, "regcomp for \"%s\" failed: ", re
if (!rxerr) gex);
flexfatal(_("Unable to allocate buffer for regerror")); regerror(err, preg, errbuf+n, errbuf_sz-(size_t)n);
regerror (err, preg, rxerr, errbuf_sz);
snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", reg
ex, rxerr);
flexfatal (errbuf); flexfatal (errbuf); /* never returns - no need to free(errbuf) */
free(errbuf);
free(rxerr);
} }
} }
/** Extract a copy of the match, or NULL if no match. /** Extract a copy of the match, or NULL if no match.
* @param m A match as returned by regexec(). * @param m A match as returned by regexec().
* @param src The source string that was passed to regexec(). * @param src The source string that was passed to regexec().
* @return The allocated string. * @return The allocated string.
*/ */
char *regmatch_dup (regmatch_t * m, const char *src) char *regmatch_dup (regmatch_t * m, const char *src)
{ {
 End of changes. 3 change blocks. 
11 lines changed or deleted 7 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS