Track spec parse buffer position by offset instead of pointer
- Preliminaries for dynamically reallocating the buffer
This commit is contained in:
parent
66ed9fc616
commit
0c737f72b2
|
@ -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 &&
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue