version 1.22, 2020/06/10 21:02:33 |
version 1.23, 2020/06/10 21:03:36 |
|
|
Array *ap; |
Array *ap; |
Cell **tp; |
Cell **tp; |
|
|
ap = (Array *) malloc(sizeof(Array)); |
ap = malloc(sizeof(*ap)); |
tp = (Cell **) calloc(n, sizeof(Cell *)); |
tp = calloc(n, sizeof(*tp)); |
if (ap == NULL || tp == NULL) |
if (ap == NULL || tp == NULL) |
FATAL("out of space in makesymtab"); |
FATAL("out of space in makesymtab"); |
ap->nelem = 0; |
ap->nelem = 0; |
|
|
(void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); |
(void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); |
return(p); |
return(p); |
} |
} |
p = (Cell *) malloc(sizeof(Cell)); |
p = malloc(sizeof(*p)); |
if (p == NULL) |
if (p == NULL) |
FATAL("out of space for symbol table at %s", n); |
FATAL("out of space for symbol table at %s", n); |
p->nval = tostring(n); |
p->nval = tostring(n); |
|
|
Cell *cp, *op, **np; |
Cell *cp, *op, **np; |
|
|
nsz = GROWTAB * tp->size; |
nsz = GROWTAB * tp->size; |
np = (Cell **) calloc(nsz, sizeof(Cell *)); |
np = calloc(nsz, sizeof(*np)); |
if (np == NULL) /* can't do it, but can keep running. */ |
if (np == NULL) /* can't do it, but can keep running. */ |
return; /* someone else will run out later. */ |
return; /* someone else will run out later. */ |
for (i = 0; i < tp->size; i++) { |
for (i = 0; i < tp->size; i++) { |
|
|
fldno = atoi(vp->nval); |
fldno = atoi(vp->nval); |
if (fldno > *NF) |
if (fldno > *NF) |
newfld(fldno); |
newfld(fldno); |
DPRINTF( ("setting field %d to %s (%p)\n", fldno, s, (void *) s) ); |
DPRINTF( ("setting field %d to %s (%p)\n", fldno, s, s) ); |
} else if (isrec(vp)) { |
} else if (isrec(vp)) { |
donefld = 0; /* mark $1... invalid */ |
donefld = 0; /* mark $1... invalid */ |
donerec = 1; |
donerec = 1; |
|
|
vp->fmt = NULL; |
vp->fmt = NULL; |
setfree(vp); |
setfree(vp); |
DPRINTF( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", |
DPRINTF( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", |
(void*)vp, NN(vp->nval), t, (void *) t, vp->tval, donerec, donefld) ); |
(void*)vp, NN(vp->nval), t, t, vp->tval, donerec, donefld) ); |
vp->sval = t; |
vp->sval = t; |
if (&vp->fval == NF) { |
if (&vp->fval == NF) { |
donerec = 0; /* mark $0 invalid */ |
donerec = 0; /* mark $0 invalid */ |
|
|
} |
} |
done: |
done: |
DPRINTF( ("getsval %p: %s = \"%s (%p)\", t=%o\n", |
DPRINTF( ("getsval %p: %s = \"%s (%p)\", t=%o\n", |
(void*)vp, NN(vp->nval), vp->sval, (void *) vp->sval, vp->tval) ); |
(void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); |
return(vp->sval); |
return(vp->sval); |
} |
} |
|
|
|
|
|
|
char *tostring(const char *s) /* make a copy of string s */ |
char *tostring(const char *s) /* make a copy of string s */ |
{ |
{ |
char *p; |
char *p = strdup(s); |
|
|
p = strdup(s); |
|
if (p == NULL) |
if (p == NULL) |
FATAL("out of space in tostring on %s", s); |
FATAL("out of space in tostring on %s", s); |
return p; |
return(p); |
} |
} |
|
|
Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */ |
Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */ |
|
|
{ |
{ |
const char *os = is; |
const char *os = is; |
int c, n; |
int c, n; |
uschar *s = (uschar *) is; |
const uschar *s = (const uschar *) is; |
uschar *buf, *bp; |
uschar *buf, *bp; |
|
|
if ((buf = (uschar *) malloc(strlen(is)+3)) == NULL) |
if ((buf = malloc(strlen(is)+3)) == NULL) |
FATAL( "out of space in qstring(%s)", s); |
FATAL( "out of space in qstring(%s)", s); |
for (bp = buf; (c = *s) != delim; s++) { |
for (bp = buf; (c = *s) != delim; s++) { |
if (c == '\n') |
if (c == '\n') |