From d72dac96e1e6fba8153b5c38c698b0fe487b939f Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Tue, 14 Jun 2011 10:42:55 +1000 Subject: Minor code cleanups Some unused variables Signed-off-by: Steve Bennett --- jim-exec.c | 19 ++++++++++--------- jimregexp.c | 10 ++-------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/jim-exec.c b/jim-exec.c index 5c9b49f..4315cd7 100644 --- a/jim-exec.c +++ b/jim-exec.c @@ -865,15 +865,6 @@ badargs: (void)signal(SIGPIPE, SIG_IGN); } - /* - * Enlarge the wait table if there isn't enough space for a new - * entry. - */ - if (table->used == table->size) { - table->size += WAIT_TABLE_GROW_BY; - table->info = Jim_Realloc(table->info, table->size * sizeof(*table->info)); - } - /* Need to do this befor vfork() */ if (pipe_dup_err) { errorId = outputId; @@ -911,6 +902,16 @@ badargs: } /* parent */ + + /* + * Enlarge the wait table if there isn't enough space for a new + * entry. + */ + if (table->used == table->size) { + table->size += WAIT_TABLE_GROW_BY; + table->info = Jim_Realloc(table->info, table->size * sizeof(*table->info)); + } + table->info[table->used].pid = pid; table->info[table->used].flags = 0; table->used++; diff --git a/jimregexp.c b/jimregexp.c index 141db92..b138cb1 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -1269,14 +1269,11 @@ static int regmatchsimplerepeat(regex_t *preg, int scan, int matchmin) static int regmatchrepeat(regex_t *preg, int scan, int matchmin) { - const char *save; int *scanpt = preg->program + scan; int max = scanpt[2]; int min = scanpt[3]; - save = preg->reginput; - /* Have we reached min? */ if (scanpt[4] < min) { /* No, so get another one */ @@ -1305,7 +1302,6 @@ static int regmatchrepeat(regex_t *preg, int scan, int matchmin) return 0; } /* maximal, so try this branch again */ - save = preg->reginput; if (scanpt[4] < max) { scanpt[4]++; if (regmatch(preg, scan + 5)) { @@ -1313,10 +1309,8 @@ static int regmatchrepeat(regex_t *preg, int scan, int matchmin) } scanpt[4]--; } - /* At this point we are at max with no match. Back up by one and try the other branch */ - preg->reginput = save; - int ret = regmatch(preg, regnext(preg, scan)); - return ret; + /* At this point we are at max with no match. Try the other branch */ + return regmatch(preg, regnext(preg, scan)); } /* -- cgit v1.1