use memset() instead of deprecated bzero()

This commit is contained in:
rlar 2016-07-22 20:44:17 +02:00
parent 141ed61ec8
commit d298d5cc2f
16 changed files with 16 additions and 37 deletions

View File

@ -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])

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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++) {

View File

@ -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)

View File

@ -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 )
{

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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