From: Tim Kientzle Date: Sun, 22 Feb 2009 06:41:48 +0000 (-0500) Subject: Track first and last parsed token. X-Git-Tag: v2.7.0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff832ccac673dbf6e7c65f37f7ff2a57f2a47a8f;p=thirdparty%2Flibarchive.git Track first and last parsed token. SVN-Revision: 695 --- diff --git a/tar/getdate.c b/tar/getdate.c index 3e32f1359..e521810dd 100644 --- a/tar/getdate.c +++ b/tar/getdate.c @@ -115,7 +115,7 @@ static time_t yyRelSeconds; struct token { int token; time_t value; }; static struct token tokens[256]; -struct token *tokenp; +struct token *tokenp, *lasttoken; #line 100 "getdate.y" typedef union { @@ -775,10 +775,10 @@ get_date(char *p) yyHaveTime = 0; yyHaveZone = 0; - tokenp = tokens; - while ((tokenp->token = nexttoken(&p, &tokenp->value)) != 0) { - ++tokenp; - if (tokenp > tokens + 255) + lasttoken = tokens; + while ((lasttoken->token = nexttoken(&p, &lasttoken->value)) != 0) { + ++lasttoken; + if (lasttoken > tokens + 255) return -1; } tokenp = tokens; diff --git a/tar/getdate.y b/tar/getdate.y index 9ba2cf36e..1dd5af67f 100644 --- a/tar/getdate.y +++ b/tar/getdate.y @@ -93,7 +93,7 @@ static time_t yyRelSeconds; struct token { int token; time_t value; }; static struct token tokens[256]; -struct token *tokenp; +struct token *tokenp, *lasttoken; %} @@ -801,10 +801,10 @@ get_date(char *p) yyHaveTime = 0; yyHaveZone = 0; - tokenp = tokens; - while ((tokenp->token = nexttoken(&p, &tokenp->value)) != 0) { - ++tokenp; - if (tokenp > tokens + 255) + lasttoken = tokens; + while ((lasttoken->token = nexttoken(&p, &lasttoken->value)) != 0) { + ++lasttoken; + if (lasttoken > tokens + 255) return -1; } tokenp = tokens;