Vendor import of bwk's 23-Oct-2007 release.
This includes fixes for FreeBSD PR's: bin/104795, bin/100443
This commit is contained in:
parent
addad6af5a
commit
d2f6e49220
@ -25,6 +25,14 @@ THIS SOFTWARE.
|
||||
This file lists all bug fixes, changes, etc., made since the AWK book
|
||||
was sent to the printers in August, 1987.
|
||||
|
||||
Oct 23, 2007:
|
||||
minor fix in lib.c: increase inputFS to 100, change malloc
|
||||
for fields to n+1.
|
||||
|
||||
fixed memory fault caused by out of order test in setsval.
|
||||
|
||||
thanks to david o'brien, freebsd, for both fixes.
|
||||
|
||||
May 1, 2007:
|
||||
fiddle in makefile to fix for BSD make; thanks to igor sobrado.
|
||||
|
||||
|
@ -40,7 +40,7 @@ char *fields;
|
||||
int fieldssize = RECSIZE;
|
||||
|
||||
Cell **fldtab; /* pointers to Cells */
|
||||
char inputFS[10] = " ";
|
||||
char inputFS[100] = " ";
|
||||
|
||||
#define MAXFLD 2
|
||||
int nfields = MAXFLD; /* last allocated slot for $i */
|
||||
@ -58,7 +58,7 @@ static Cell dollar1 = { OCELL, CFLD, NULL, "", 0.0, FLD|STR|DONTFREE };
|
||||
void recinit(unsigned int n)
|
||||
{
|
||||
if ( (record = (char *) malloc(n)) == NULL
|
||||
|| (fields = (char *) malloc(n)) == NULL
|
||||
|| (fields = (char *) malloc(n+1)) == NULL
|
||||
|| (fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *))) == NULL
|
||||
|| (fldtab[0] = (Cell *) malloc(sizeof(Cell))) == NULL )
|
||||
FATAL("out of space for $0 and fields");
|
||||
|
@ -332,10 +332,10 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */
|
||||
donerec = 1;
|
||||
}
|
||||
t = tostring(s); /* in case it's self-assign */
|
||||
vp->tval &= ~NUM;
|
||||
vp->tval |= STR;
|
||||
if (freeable(vp))
|
||||
xfree(vp->sval);
|
||||
vp->tval &= ~NUM;
|
||||
vp->tval |= STR;
|
||||
vp->tval &= ~DONTFREE;
|
||||
dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n",
|
||||
vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user