use `NUMELEMS' and add some `(int)' casts
This commit is contained in:
parent
4ca91fbd82
commit
6b5debfc1e
21
ChangeLog
21
ChangeLog
|
|
@ -1,3 +1,24 @@
|
|||
2010-11-02 Robert Larice
|
||||
* src/ciderlib/input/cards.c ,
|
||||
* src/frontend/cpitf.c ,
|
||||
* src/frontend/dotcards.c ,
|
||||
* src/frontend/plotting/grid.c ,
|
||||
* src/ngspice.c ,
|
||||
* src/spicelib/analysis/acsetp.c ,
|
||||
* src/spicelib/analysis/analysis.c ,
|
||||
* src/spicelib/analysis/cktsopt.c ,
|
||||
* src/spicelib/analysis/dctsetp.c ,
|
||||
* src/spicelib/analysis/dsetparm.c ,
|
||||
* src/spicelib/analysis/nsetparm.c ,
|
||||
* src/spicelib/analysis/pzsetp.c ,
|
||||
* src/spicelib/analysis/senssetp.c ,
|
||||
* src/spicelib/analysis/tfsetp.c ,
|
||||
* src/spicelib/analysis/transetp.c ,
|
||||
* src/spicelib/devices/dev.c ,
|
||||
* src/spicelib/parser/inpptree.c ,
|
||||
* src/unsupported/sen2setp.c :
|
||||
use `NUMELEMS' and add some `(int)' casts
|
||||
|
||||
2010-11-02 Robert Larice
|
||||
* src/xspice/icm/dlmain.c :
|
||||
local prototypes in `dlmain.c'
|
||||
|
|
|
|||
|
|
@ -43,4 +43,4 @@ IFcardInfo *INPcardTab[] = {
|
|||
&OUTPinfo
|
||||
};
|
||||
|
||||
int INPnumCards = sizeof(INPcardTab)/sizeof(IFcardInfo*);
|
||||
int INPnumCards = NUMELEMS(INPcardTab);
|
||||
|
|
|
|||
|
|
@ -200,14 +200,14 @@ ft_cpinit(void)
|
|||
wl3.wl_prev = &wl2;
|
||||
wl3.wl_next = NULL;
|
||||
wl2.wl_word = "=";
|
||||
for (i = 0; i < sizeof (predefs) / sizeof (char *); i += 2) {
|
||||
for (i = 0; (size_t) i < NUMELEMS(predefs); i += 2) {
|
||||
wl1.wl_word = predefs[i];
|
||||
wl3.wl_word = predefs[i + 1];
|
||||
com_let(&wl1);
|
||||
}
|
||||
|
||||
wl2.wl_next = NULL;
|
||||
for (i = 0; i < sizeof (udfs) / sizeof (char *); i += 2) {
|
||||
for (i = 0; (size_t) i < NUMELEMS(udfs); i += 2) {
|
||||
wl1.wl_word = udfs[i];
|
||||
wl2.wl_word = udfs[i + 1];
|
||||
com_define(&wl1);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ ft_savedotargs(void)
|
|||
prev_wl = &w;
|
||||
for (wl = w; wl; wl = w_next) {
|
||||
w_next = wl->wl_next;
|
||||
for (i = 0; i < NUMELEMS(plot_opts); i++) {
|
||||
for (i = 0; (size_t) i < NUMELEMS(plot_opts); i++) {
|
||||
if (!strcmp(wl->wl_word, plot_opts[i])) {
|
||||
/* skip it */
|
||||
*prev_wl = w_next;
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
|||
{ 0.0, 0.01 }
|
||||
};
|
||||
|
||||
for (i = 0; i < NUMELEMS(div_list); i++) {
|
||||
for (i = 0; (size_t) i < NUMELEMS(div_list); i++) {
|
||||
if (dst > div_list[i].div_lim) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
|||
nsp = (dst + step - 0.0001) / step;
|
||||
spacing = (max - margin) / nsp;
|
||||
i += 1;
|
||||
} while (i < NUMELEMS(div_list) && spacing > 50);
|
||||
} while ((size_t) i < NUMELEMS(div_list) && spacing > 50);
|
||||
|
||||
if (axis == x_axis) {
|
||||
slim = digits + 5 + mag - mag3;
|
||||
|
|
@ -590,7 +590,7 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
|||
|
||||
k = 5.0 / decsp;
|
||||
|
||||
for (i = 0; i < NUMELEMS(divs) - 1; i++) {
|
||||
for (i = 0; (size_t) i < NUMELEMS(divs) - 1; i++) {
|
||||
j = divs[i];
|
||||
if (-log10(((double) j - 1.0) / j) > k)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ IFsimulator SIMinfo = {
|
|||
0, /* Initialized in SIMinit() */
|
||||
NULL, /* Initialized in SIMinit() */
|
||||
|
||||
sizeof(nodeParms)/sizeof(IFparm),
|
||||
NUMELEMS(nodeParms),
|
||||
nodeParms,
|
||||
|
||||
sizeof(specSigList)/sizeof(char *),
|
||||
NUMELEMS(specSigList),
|
||||
specSigList,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ SPICEanalysis ACinfo = {
|
|||
"AC",
|
||||
"A.C. Small signal analysis",
|
||||
|
||||
sizeof(ACparms)/sizeof(IFparm),
|
||||
NUMELEMS(ACparms),
|
||||
ACparms
|
||||
},
|
||||
sizeof(ACAN),
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ char *spice_analysis_get_description(int index)
|
|||
|
||||
int spice_num_analysis(void)
|
||||
{
|
||||
return sizeof(analInfo)/sizeof(SPICEanalysis*);
|
||||
return NUMELEMS(analInfo);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -312,13 +312,13 @@ static IFparm OPTtbl[] = {
|
|||
"Maximum relative iter-iter node voltage change" }
|
||||
};
|
||||
|
||||
int OPTcount = sizeof(OPTtbl)/sizeof(IFparm);
|
||||
int OPTcount = NUMELEMS(OPTtbl);
|
||||
|
||||
SPICEanalysis OPTinfo = {
|
||||
{
|
||||
"options",
|
||||
"Task option selection",
|
||||
sizeof(OPTtbl)/sizeof(IFparm),
|
||||
NUMELEMS(OPTtbl),
|
||||
OPTtbl
|
||||
},
|
||||
0, /* no size associated with options */
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ SPICEanalysis DCTinfo = {
|
|||
"DC",
|
||||
"D.C. Transfer curve analysis",
|
||||
|
||||
sizeof(DCTparms)/sizeof(IFparm),
|
||||
NUMELEMS(DCTparms),
|
||||
DCTparms
|
||||
},
|
||||
sizeof(TRCV),
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ SPICEanalysis DISTOinfo = {
|
|||
"DISTO",
|
||||
"Small signal distortion analysis",
|
||||
|
||||
sizeof(Dparms)/sizeof(IFparm),
|
||||
NUMELEMS(Dparms),
|
||||
Dparms
|
||||
},
|
||||
sizeof(DISTOAN),
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ SPICEanalysis NOISEinfo = {
|
|||
"NOISE",
|
||||
"Noise analysis",
|
||||
|
||||
sizeof(Nparms)/sizeof(IFparm),
|
||||
NUMELEMS(Nparms),
|
||||
Nparms
|
||||
},
|
||||
sizeof(NOISEAN),
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ SPICEanalysis PZinfo = {
|
|||
"PZ",
|
||||
"pole-zero analysis",
|
||||
|
||||
sizeof(PZparms)/sizeof(IFparm),
|
||||
NUMELEMS(PZparms),
|
||||
PZparms
|
||||
},
|
||||
sizeof(PZAN),
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ SPICEanalysis SENSinfo = {
|
|||
{
|
||||
"SENS",
|
||||
"Sensitivity analysis",
|
||||
sizeof(SENSparms)/sizeof(IFparm),
|
||||
NUMELEMS(SENSparms),
|
||||
SENSparms
|
||||
},
|
||||
sizeof(SENS_AN),
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ SPICEanalysis TFinfo = {
|
|||
"TF",
|
||||
"transfer function analysis",
|
||||
|
||||
sizeof(TFparms)/sizeof(IFparm),
|
||||
NUMELEMS(TFparms),
|
||||
TFparms
|
||||
},
|
||||
sizeof(TFan),
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ SPICEanalysis TRANinfo = {
|
|||
"TRAN",
|
||||
"Transient analysis",
|
||||
|
||||
sizeof(TRANparms)/sizeof(IFparm),
|
||||
NUMELEMS(TRANparms),
|
||||
TRANparms
|
||||
},
|
||||
sizeof(TRANan),
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ int load_dev(char *name) {
|
|||
|
||||
void load_alldevs(void){
|
||||
char *devs[] = DEVICES_USED;
|
||||
int num = sizeof(devs)/sizeof(char *);
|
||||
int num = NUMELEMS(devs);
|
||||
int i;
|
||||
for(i=0; i< num;i++)
|
||||
load_dev(devs[i]);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static struct op {
|
|||
PT_POWER, "^", (void(*)(void)) PTpower}
|
||||
};
|
||||
|
||||
#define NUM_OPS (int)(sizeof (ops) / sizeof (struct op))
|
||||
#define NUM_OPS (int)NUMELEMS(ops)
|
||||
|
||||
static struct func {
|
||||
char *name;
|
||||
|
|
@ -96,7 +96,7 @@ static struct func {
|
|||
{ "max", PTF_MAX, (void(*)(void)) PTmax},
|
||||
} ;
|
||||
|
||||
#define NUM_FUNCS (int)(sizeof (funcs) / sizeof (struct func))
|
||||
#define NUM_FUNCS (int)NUMELEMS(funcs)
|
||||
|
||||
/* These are all the constants any sane person needs. */
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ static struct constant {
|
|||
"pi", M_PI}
|
||||
};
|
||||
|
||||
#define NUM_CONSTANTS (int)(sizeof (constants) / sizeof (struct constant))
|
||||
#define NUM_CONSTANTS (int)NUMELEMS(constants)
|
||||
|
||||
/* Parse the expression in *line as far as possible, and return the parse
|
||||
* tree obtained. If there is an error, *pt will be set to NULL and an error
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ SPICEanalysis SEN2info = {
|
|||
"SENS2",
|
||||
"Sensitivity analysis",
|
||||
|
||||
sizeof(SENparms)/sizeof(IFparm),
|
||||
NUMELEMS(SENparms),
|
||||
SENparms
|
||||
},
|
||||
sizeof(SENstruct),
|
||||
|
|
|
|||
Loading…
Reference in New Issue