remove some no-op end of string tests from regex parser
authorRich Felker <dalias@aerifal.cx>
Sun, 13 May 2012 21:20:01 +0000 (17:20 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 13 May 2012 21:20:01 +0000 (17:20 -0400)
these are cruft from the original code which used an explicit string
length rather than null termination. i blindly converted all the
checks to null terminator checks, without noticing that in several
cases, the subsequent switch statement would automatically handle the
null byte correctly.

src/regex/regcomp.c

index 712ca80..322a5e6 100644 (file)
@@ -1052,8 +1052,6 @@ tre_parse(tre_parse_ctx_t *ctx)
          }
 
        case PARSE_UNION:
-         if (!*ctx->re)
-           break;
          switch (*ctx->re)
            {
            case CHAR_PIPE:
@@ -1086,8 +1084,6 @@ tre_parse(tre_parse_ctx_t *ctx)
 
        case PARSE_POSTFIX:
          /* Parse postfix operators. */
-         if (!*ctx->re)
-           break;
          switch (*ctx->re)
            {
            case CHAR_PLUS: