im->gdes[im->gdes_c - 1].rpnp = NULL;
im->gdes[im->gdes_c - 1].p_dashes = NULL;
im->gdes[im->gdes_c - 1].shift = 0.0;
+ im->gdes[im->gdes_c - 1].dash = 0;
+ im->gdes[im->gdes_c - 1].ndash = 0;
+ im->gdes[im->gdes_c - 1].offset = 0;
im->gdes[im->gdes_c - 1].col.red = 0.0;
im->gdes[im->gdes_c - 1].col.green = 0.0;
im->gdes[im->gdes_c - 1].col.blue = 0.0;
char csv[64];
char *pch;
float dsh;
-
- strcpy(csv, tmpstr);
int count = 0;
+ char *saveptr;
- pch = strtok(tmpstr, ",");
+ strcpy(csv, tmpstr);
+
+ pch = strtok_r(tmpstr, ",",&saveptr);
while (pch != NULL) {
- pch = strtok(NULL, ",");
+ pch = strtok_r(NULL, ",",&saveptr);
count++;
}
dprintf("- %d dash value(s) found: ", count);
gdp->dash = 1;
gdp->ndash = count;
gdp->p_dashes = (double *) malloc(sizeof(double) * count);
- pch = strtok(csv, ",");
+ pch = strtok_r(csv, ",",&saveptr);
count = 0;
while (pch != NULL) {
if (sscanf(pch, "%f", &dsh)) {
dprintf("%.1f ", gdp->p_dashes[count]);
count++;
}
- pch = strtok(NULL, ",");
+ pch = strtok_r(NULL, ",",&saveptr);
}
dprintf("\n");
} else