mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 05:47:42 +02:00
numparam/general.h, remove redundant memory management functions
This commit is contained in:
@@ -42,7 +42,6 @@ char *stupcase(char *s);
|
|||||||
|
|
||||||
/***** primitive input-output ***/
|
/***** primitive input-output ***/
|
||||||
int yes_or_no(void);
|
int yes_or_no(void);
|
||||||
char rc(void);
|
|
||||||
|
|
||||||
int freadstr(FILE *f, SPICE_DSTRINGPTR dstr_p);
|
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 np_trunc(double x); // sjb to avoid clash with trunc() in math.h
|
||||||
double absf(double x); /* abs */
|
double absf(double x); /* abs */
|
||||||
long absi(long i);
|
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 *******/
|
/***** elementary math *******/
|
||||||
|
|
||||||
double
|
double
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ nupa_init(char *srcfile)
|
|||||||
linecountS = 0;
|
linecountS = 0;
|
||||||
incontrolS = 0;
|
incontrolS = 0;
|
||||||
placeholder = 0;
|
placeholder = 0;
|
||||||
dicoS = (dico_t *) new(sizeof(dico_t));
|
dicoS = TMALLOC(dico_t, 1);
|
||||||
initdico(dicoS);
|
initdico(dicoS);
|
||||||
|
|
||||||
dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1);
|
dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1);
|
||||||
@@ -470,14 +470,14 @@ nupa_del_dicoS(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = dynmaxline; i >= 0; i--)
|
for (i = dynmaxline; i >= 0; i--)
|
||||||
dispose(dicoS->dynrefptr[i]);
|
txfree(dicoS->dynrefptr[i]);
|
||||||
|
|
||||||
dispose(dicoS->dynrefptr);
|
txfree(dicoS->dynrefptr);
|
||||||
dispose(dicoS->dyncategory);
|
txfree(dicoS->dyncategory);
|
||||||
dispose(dicoS->inst_name);
|
txfree(dicoS->inst_name);
|
||||||
nghash_free(dicoS->symbols[0], del_attrib, NULL);
|
nghash_free(dicoS->symbols[0], del_attrib, NULL);
|
||||||
dispose(dicoS->symbols);
|
txfree(dicoS->symbols);
|
||||||
dispose(dicoS);
|
txfree(dicoS);
|
||||||
dicoS = NULL;
|
dicoS = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user