Browse Source

use memset() instead of deprecated bzero()

pre-master-46
rlar 10 years ago
parent
commit
d298d5cc2f
  1. 2
      configure.ac
  2. 2
      src/frontend/init.c
  3. 4
      src/frontend/outitf.c
  4. 2
      src/frontend/subckt.c
  5. 4
      src/include/ngspice/memory.h
  6. 4
      src/include/ngspice/stringutil.h
  7. 4
      src/maths/ni/nicomcof.c
  8. 2
      src/misc/alloc.c
  9. 14
      src/misc/string.c
  10. 2
      src/sharedspice.c
  11. 2
      src/spicelib/devices/nbjt/nbjtset.c
  12. 2
      src/spicelib/devices/nbjt2/nbt2set.c
  13. 2
      src/spicelib/devices/numd/numdset.c
  14. 2
      src/spicelib/devices/numd2/nud2set.c
  15. 2
      src/spicelib/devices/numos/nummset.c
  16. 3
      visualc/src/include/ngspice/config.h

2
configure.ac

@ -712,7 +712,7 @@ AC_CHECK_FUNCS([isatty tcgetattr tcsetattr])
# Check for a few functions:
AC_FUNC_FORK([])
AC_CHECK_FUNCS([access bzero qsort dup2 popen])
AC_CHECK_FUNCS([access qsort dup2 popen])
AC_CHECK_FUNCS([strchr index], [break])
AC_CHECK_FUNCS([strrchr rindex], [break])
AC_CHECK_FUNCS([getcwd getwd], [break])

2
src/frontend/init.c

@ -27,7 +27,7 @@ cp_init(void)
{
char *s;
bzero(cp_chars, 128);
memset(cp_chars, 0, 128);
for (s = singlec; *s; s++)
/* break word to right or left of characters <>;&*/
cp_chars[(int) *s] = (CPC_BRR | CPC_BRL);

4
src/frontend/outitf.c

@ -412,7 +412,7 @@ addDataDesc(runDesc *run, char *name, int type, int ind)
data = &run->data[run->numData];
/* so freeRun will get nice NULL pointers for the fields we don't set */
bzero(data, sizeof(dataDesc));
memset(data, 0, sizeof(dataDesc));
data->name = copy(name);
data->type = type;
@ -443,7 +443,7 @@ addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind)
data = &run->data[run->numData];
/* so freeRun will get nice NULL pointers for the fields we don't set */
bzero(data, sizeof(dataDesc));
memset(data, 0, sizeof(dataDesc));
data->name = copy(name);

2
src/frontend/subckt.c

@ -1391,7 +1391,7 @@ settrans(char *formal, char *actual, const char *subname)
{
int i;
bzero(table, sizeof(*table));
memset(table, 0, sizeof(*table));
for (i = 0; ; i++) {
table[i].t_old = gettok(&formal);

4
src/include/ngspice/memory.h

@ -27,10 +27,10 @@ extern void txfree(const void *ptr);
#endif /* HAVE_LIBGC */
#include "ngspice/stringutil.h" /* va: spice3 internally bzero */
#include "ngspice/stringutil.h"
#define FREE(x) do { if(x) { txfree(x); (x) = NULL; } } while(0)
#define ZERO(PTR, TYPE) bzero(PTR, sizeof(TYPE))
#define ZERO(PTR, TYPE) memset(PTR, 0, sizeof(TYPE))
#ifdef CIDER

4
src/include/ngspice/stringutil.h

@ -44,10 +44,6 @@ int cinprefix(register char *p, register char *s, register int n);
int cimatch(register char *p, register char *s);
#endif
#ifndef HAVE_BZERO
void bzero(void *ptr, size_t num);
#endif
bool isquote(char ch);
bool is_arith_char(char c);
bool str_has_arith_char(char *s);

4
src/maths/ni/nicomcof.c

@ -62,7 +62,7 @@ NIcomCof(CKTcircuit *ckt)
case 4:
case 5:
case 6:
bzero(ckt->CKTag,7*sizeof(double));
memset(ckt->CKTag, 0, 7*sizeof(double));
ckt->CKTag[1] = -1/ckt->CKTdelta;
/* first, set up the matrix */
arg=0;
@ -150,7 +150,7 @@ NIcomCof(CKTcircuit *ckt)
* MUST STILL ACCOUNT FOR ARRAY AGP()
* KEEP THE SAME NAME FOR GMAT
*/
bzero(ckt->CKTagp,7*sizeof(double));
memset(ckt->CKTagp, 0, 7*sizeof(double));
/* SET UP RHS OF EQUATIONS */
ckt->CKTagp[0]=1;
for(i=0;i<=ckt->CKTorder;i++) {

2
src/misc/alloc.c

@ -46,7 +46,7 @@ extern mutexType allocMutex;
* be tmalloc'd. Return NULL for a request for 0 bytes.
*/
/* New implementation of tmalloc, it uses calloc and does not call bzero() */
/* New implementation of tmalloc, it uses calloc and does not call memset() */
void *
tmalloc(size_t num)

14
src/misc/string.c

@ -599,20 +599,6 @@ stripWhiteSpacesInsideParens(char *str)
}
#ifndef HAVE_BZERO
#ifndef bzero
void
bzero(void *vptr, size_t num)
{
register char *ptr=vptr;
while (num-- > 0)
*ptr++ = '\0';
return;
}
#endif
#endif
bool
isquote( char ch )
{

2
src/sharedspice.c

@ -1547,7 +1547,7 @@ int sh_ExecutePerLoop_old(void)
tfree(curvecvals);
}
len = 0;
bzero(type_name, 128);
memset(type_name, 0, 128);
}
/* initialize new for every new plot, e.g. if changed from op1 to ac1

2
src/spicelib/devices/nbjt/nbjtset.c

@ -211,7 +211,7 @@ NBJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
ONEgetStatePointers(inst->NBJTpDevice, states);
/* Wipe out statistics from previous runs (if any). */
bzero(inst->NBJTpDevice->pStats, sizeof(ONEstats));
memset(inst->NBJTpDevice->pStats, 0, sizeof(ONEstats));
inst->NBJTpDevice->pStats->totalTime[STAT_SETUP] +=
SPfrontEnd->IFseconds() - startTime;

2
src/spicelib/devices/nbjt2/nbt2set.c

@ -227,7 +227,7 @@ NBJT2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
TWOgetStatePointers(inst->NBJT2pDevice, states);
/* Wipe out statistics from previous runs (if any). */
bzero(inst->NBJT2pDevice->pStats, sizeof(TWOstats));
memset(inst->NBJT2pDevice->pStats, 0, sizeof(TWOstats));
inst->NBJT2pDevice->pStats->totalTime[STAT_SETUP] +=
SPfrontEnd->IFseconds() - startTime;

2
src/spicelib/devices/numd/numdset.c

@ -200,7 +200,7 @@ NUMDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
ONEgetStatePointers(inst->NUMDpDevice, states);
/* Wipe out statistics from previous runs (if any). */
bzero(inst->NUMDpDevice->pStats, sizeof(ONEstats));
memset(inst->NUMDpDevice->pStats, 0, sizeof(ONEstats));
inst->NUMDpDevice->pStats->totalTime[STAT_SETUP] +=
SPfrontEnd->IFseconds() - startTime;

2
src/spicelib/devices/numd2/nud2set.c

@ -225,7 +225,7 @@ NUMD2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
TWOgetStatePointers(inst->NUMD2pDevice, states);
/* Wipe out statistics from previous runs (if any). */
bzero(inst->NUMD2pDevice->pStats, sizeof(TWOstats));
memset(inst->NUMD2pDevice->pStats, 0, sizeof(TWOstats));
inst->NUMD2pDevice->pStats->totalTime[STAT_SETUP] +=
SPfrontEnd->IFseconds() - startTime;

2
src/spicelib/devices/numos/nummset.c

@ -224,7 +224,7 @@ NUMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
TWOgetStatePointers(inst->NUMOSpDevice, states);
/* Wipe out statistics from previous runs (if any). */
bzero(inst->NUMOSpDevice->pStats, sizeof(TWOstats));
memset(inst->NUMOSpDevice->pStats, 0, sizeof(TWOstats));
inst->NUMOSpDevice->pStats->totalTime[STAT_SETUP] +=
SPfrontEnd->IFseconds() - startTime;

3
visualc/src/include/ngspice/config.h

@ -80,9 +80,6 @@
/* Define to enable BSD editline */
/* #undef HAVE_BSDEDITLINE */
/* Define to 1 if you have the `bzero' function. */
/* #undef HAVE_BZERO */
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1

Loading…
Cancel
Save