numparam/general.h, remove redundant memory management functions
This commit is contained in:
parent
a6f530b95c
commit
7ea4e99842
|
|
@ -42,7 +42,6 @@ char *stupcase(char *s);
|
|||
|
||||
/***** primitive input-output ***/
|
||||
int yes_or_no(void);
|
||||
char rc(void);
|
||||
|
||||
int freadstr(FILE *f, SPICE_DSTRINGPTR dstr_p);
|
||||
|
||||
|
|
@ -50,6 +49,3 @@ double np_round(double d); // sjb to avoid clash with round() in math.h
|
|||
double np_trunc(double x); // sjb to avoid clash with trunc() in math.h
|
||||
double absf(double x); /* abs */
|
||||
long absi(long i);
|
||||
|
||||
void *new(size_t sz);
|
||||
void dispose(void *p);
|
||||
|
|
|
|||
|
|
@ -507,30 +507,6 @@ stupcase(char *s)
|
|||
}
|
||||
|
||||
|
||||
/***** pointer tricks: app won't use naked malloc(), free() ****/
|
||||
|
||||
void
|
||||
dispose(void *p)
|
||||
{
|
||||
if (p != NULL)
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
new(size_t sz)
|
||||
{
|
||||
void *p = tmalloc(sz);
|
||||
|
||||
if (p == NULL) { /* fatal error */
|
||||
printf(" new() failure. Program halted.\n");
|
||||
controlled_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/***** elementary math *******/
|
||||
|
||||
double
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ nupa_init(char *srcfile)
|
|||
linecountS = 0;
|
||||
incontrolS = 0;
|
||||
placeholder = 0;
|
||||
dicoS = (dico_t *) new(sizeof(dico_t));
|
||||
dicoS = TMALLOC(dico_t, 1);
|
||||
initdico(dicoS);
|
||||
|
||||
dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1);
|
||||
|
|
@ -470,14 +470,14 @@ nupa_del_dicoS(void)
|
|||
return;
|
||||
|
||||
for (i = dynmaxline; i >= 0; i--)
|
||||
dispose(dicoS->dynrefptr[i]);
|
||||
txfree(dicoS->dynrefptr[i]);
|
||||
|
||||
dispose(dicoS->dynrefptr);
|
||||
dispose(dicoS->dyncategory);
|
||||
dispose(dicoS->inst_name);
|
||||
txfree(dicoS->dynrefptr);
|
||||
txfree(dicoS->dyncategory);
|
||||
txfree(dicoS->inst_name);
|
||||
nghash_free(dicoS->symbols[0], del_attrib, NULL);
|
||||
dispose(dicoS->symbols);
|
||||
dispose(dicoS);
|
||||
txfree(dicoS->symbols);
|
||||
txfree(dicoS);
|
||||
dicoS = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue