move adding 1 to meminit to the right place (needed only once)
This commit is contained in:
parent
764542e5b1
commit
5cd23fae72
|
|
@ -426,13 +426,10 @@ addDataDesc(runDesc *run, char *name, int type, int ind, int meminit)
|
||||||
{
|
{
|
||||||
dataDesc *data;
|
dataDesc *data;
|
||||||
|
|
||||||
|
/* initialize memory (for all vectors or given by 'save') */
|
||||||
/* even if 0 input */
|
|
||||||
meminit++;
|
|
||||||
|
|
||||||
/* initialize memory (all or given by 'save' */
|
|
||||||
if (!run->numData) {
|
if (!run->numData) {
|
||||||
run->data = TMALLOC(dataDesc, meminit);
|
/* even if input 0, do a malloc */
|
||||||
|
run->data = TMALLOC(dataDesc, ++meminit);
|
||||||
run->maxData = meminit;
|
run->maxData = meminit;
|
||||||
}
|
}
|
||||||
/* If there is need for more memory */
|
/* If there is need for more memory */
|
||||||
|
|
@ -441,7 +438,6 @@ addDataDesc(runDesc *run, char *name, int type, int ind, int meminit)
|
||||||
run->data = TREALLOC(dataDesc, run->data, run->maxData);
|
run->data = TREALLOC(dataDesc, run->data, run->maxData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data = &run->data[run->numData];
|
data = &run->data[run->numData];
|
||||||
/* so freeRun will get nice NULL pointers for the fields we don't set */
|
/* so freeRun will get nice NULL pointers for the fields we don't set */
|
||||||
memset(data, 0, sizeof(dataDesc));
|
memset(data, 0, sizeof(dataDesc));
|
||||||
|
|
@ -461,7 +457,7 @@ addDataDesc(runDesc *run, char *name, int type, int ind, int meminit)
|
||||||
return (OK);
|
return (OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialze memory for the list of all vectors in the currnt plot.
|
/* Initialze memory for the list of all vectors in the current plot.
|
||||||
Add a special vector (e.g. @q1[ib]) to this plot */
|
Add a special vector (e.g. @q1[ib]) to this plot */
|
||||||
static int
|
static int
|
||||||
addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind, int meminit)
|
addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind, int meminit)
|
||||||
|
|
@ -470,11 +466,9 @@ addSpecialDesc(runDesc *run, char *name, char *devname, char *param, int depind,
|
||||||
char *unique, *freeunique; /* unique char * from back-end */
|
char *unique, *freeunique; /* unique char * from back-end */
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* even if 0 input */
|
|
||||||
meminit++;
|
|
||||||
|
|
||||||
if (!run->numData) {
|
if (!run->numData) {
|
||||||
run->data = TMALLOC(dataDesc, meminit);
|
/* even if input 0, do a malloc */
|
||||||
|
run->data = TMALLOC(dataDesc, ++meminit);
|
||||||
run->maxData = meminit;
|
run->maxData = meminit;
|
||||||
}
|
}
|
||||||
else if (run->numData == run->maxData) {
|
else if (run->numData == run->maxData) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue