Track spec parse buffer position by offset instead of pointer

- Preliminaries for dynamically reallocating the buffer
This commit is contained in:
Panu Matilainen 2012-07-31 11:12:27 +03:00
parent 66ed9fc616
commit 0c737f72b2
2 changed files with 4 additions and 4 deletions

View File

@ -160,12 +160,12 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi)
if (!(spec->nextline && *spec->nextline)) {
int pc = 0, bc = 0, nc = 0;
char *from, *to, *p;
to = spec->lbufPtr ? spec->lbufPtr : spec->lbuf;
to = spec->lbuf + spec->lbufOff;
from = ofi->readPtr;
ch = ' ';
while (from && *from && ch != '\n')
ch = *to++ = *from++;
spec->lbufPtr = to;
spec->lbufOff = to - spec->lbuf;
*to = '\0';
ofi->readPtr = from;
@ -199,7 +199,7 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi)
spec->nextline = "";
return 1;
}
spec->lbufPtr = spec->lbuf;
spec->lbufOff = 0;
/* Don't expand macros (eg. %define) in false branch of %if clause */
if (spec->readStack->reading &&

View File

@ -42,7 +42,7 @@ struct rpmSpec_s {
struct OpenFileInfo * fileStack;
char lbuf[10*BUFSIZ];
char *lbufPtr;
size_t lbufOff;
char nextpeekc;
char * nextline;
char * line;