Date: Sun, 11 Sep 2011 20:11:00 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225488 - in user/gabor/grep/trunk: . regex Message-ID: <201109112011.p8BKB0E7093851@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Sun Sep 11 20:11:00 2011 New Revision: 225488 URL: http://svn.freebsd.org/changeset/base/225488 Log: - Recover to WARNS=6 Modified: user/gabor/grep/trunk/Makefile user/gabor/grep/trunk/regex/tre-fastmatch.c Modified: user/gabor/grep/trunk/Makefile ============================================================================== --- user/gabor/grep/trunk/Makefile Sun Sep 11 19:55:49 2011 (r225487) +++ user/gabor/grep/trunk/Makefile Sun Sep 11 20:11:00 2011 (r225488) @@ -15,8 +15,6 @@ bsdgrep.1: grep.1 .endif SRCS= file.c grep.c queue.c util.c -WARNS=3 - # Extra files ported backported form some regex improvements .PATH: ${.CURDIR}/regex SRCS+= fastmatch.c hashtable.c tre-fastmatch.c xmalloc.c Modified: user/gabor/grep/trunk/regex/tre-fastmatch.c ============================================================================== --- user/gabor/grep/trunk/regex/tre-fastmatch.c Sun Sep 11 19:55:49 2011 (r225487) +++ user/gabor/grep/trunk/regex/tre-fastmatch.c Sun Sep 11 20:11:00 2011 (r225488) @@ -149,7 +149,8 @@ static int fastcmp(const void *, const b bc = (r == HASH_OK) ? bc : fg->defBc; \ DPRINT(("tre_fast_match: mismatch on character %lc, " \ "BC %d, GS %d\n", \ - ((tre_char_t *)startptr)[mismatch + 1], bc, gs)); \ + ((const tre_char_t *)startptr)[mismatch + 1], \ + bc, gs)); \ break; \ default: \ if (!fg->hasdot) \ @@ -159,10 +160,11 @@ static int fastcmp(const void *, const b v = fg->len - 1 - mismatch; \ gs = fg->sbmGs[mismatch]; \ } \ - bc = fg->qsBc[((unsigned char *)str_byte)[j + fg->len]]; \ + bc = fg->qsBc[((const unsigned char *)str_byte)[j + fg->len]];\ DPRINT(("tre_fast_match: mismatch on character %c, " \ "BC %d, GS %d\n", \ - ((unsigned char *)startptr)[mismatch + 1], bc, gs)); \ + ((const unsigned char *)startptr)[mismatch + 1], \ + bc, gs)); \ } \ if (fg->hasdot) \ shift = bc; \ @@ -343,7 +345,7 @@ static int fastcmp(const void *, const b #define _CALC_BMGS(arr, pat, plen) \ { \ - int f, g; \ + int f = 0, g; \ \ int *suff = xmalloc(plen * sizeof(int)); \ if (suff == NULL) \ @@ -386,16 +388,12 @@ static int fastcmp(const void *, const b */ #define SAVE_PATTERN(src, srclen, dst, dstlen) \ dstlen = srclen; \ - if (dstlen == 0) \ - dst = TRE_CHAR(""); \ - else \ - { \ - dst = xmalloc((dstlen + 1) * sizeof(tre_char_t)); \ - if (dst == NULL) \ - return REG_ESPACE; \ - memcpy(dst, src, dstlen * sizeof(tre_char_t)); \ - dst[dstlen] = TRE_CHAR('\0'); \ - } + dst = xmalloc((dstlen + 1) * sizeof(tre_char_t)); \ + if (dst == NULL) \ + return REG_ESPACE; \ + if (dstlen > 0) \ + memcpy(dst, src, dstlen * sizeof(tre_char_t)); \ + dst[dstlen] = TRE_CHAR('\0'); /* * Initializes pattern compiling. @@ -411,8 +409,17 @@ static int fastcmp(const void *, const b if (n == 0) \ { \ fg->matchall = true; \ - fg->pattern = ""; \ - fg->wpattern = TRE_CHAR(""); \ + fg->pattern = xmalloc(1); \ + if (!fg->pattern) \ + return REG_ESPACE; \ + fg->pattern[0] = '\0'; \ + fg->wpattern = xmalloc(sizeof(tre_char_t)); \ + if (!fg->wpattern) \ + { \ + xfree(fg->pattern); \ + return REG_ESPACE; \ + } \ + fg->wpattern[0] = TRE_CHAR('\0'); \ DPRINT(("Matching every input\n")); \ return REG_OK; \ } \ @@ -614,7 +621,7 @@ badpat: STORE_MBS_PAT; if (fg->wescmap != NULL) { - bool escaped = false; + escaped = false; fg->escmap = xmalloc(fg->len * sizeof(bool)); if (!fg->escmap) @@ -724,9 +731,9 @@ badpat: */ int tre_match_fast(const fastmatch_t *fg, const void *data, size_t len, - tre_str_type_t type, int nmatch, regmatch_t pmatch[], int eflags) + tre_str_type_t type, int nmatch __unused, regmatch_t pmatch[], int eflags) { - unsigned int j = 0, shift, u = 0, v; + unsigned int j = 0, shift, u = 0, v = 0; int ret = REG_NOMATCH; int mismatch; const char *str_byte = data;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109112011.p8BKB0E7093851>