#include <sparse/mq.h>
#include <sparse/color_palette.h>
#include <sparse/colorutil.h>
+#include <string.h>
typedef struct {
Agrec_t h;
/* edge weight */
if (sym) {
char *pos = agxget (e, sym);
- (*xsplines)[i] = malloc(sizeof(char)*(strlen(pos)+1));
- strcpy((*xsplines)[i], pos);
+ (*xsplines)[i] = strdup(pos);
} else {
(*xsplines)[i] = NULL;
}
}
if (agget(n, "label") && strcmp(agget(n, "label"), "") != 0 && strcmp(agget(n, "label"), "\\N") != 0){
- char *lbs;
- lbs = agget(n, "label");
- (*labels)[i] = MALLOC(sizeof(char)*(strlen(lbs)+1));
- strcpy((*labels)[i], lbs);
+ char *lbs = agget(n, "label");
+ (*labels)[i] = strdup(lbs);
} else {
- (*labels)[i] = MALLOC(sizeof(char)*(strlen(agnameof(n))+1));
- strcpy((*labels)[i], agnameof(n));
+ (*labels)[i] = strdup(agnameof(n));
}