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 712ca80db976ed6c9332d205e623d8c6ac68b6a6..322a5e67c437c2cd838240bd67e3100be2a3ab3c 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: