This code was attempting to avoid heap allocation when dealing with a single
edge. This kind of micro-optimization is unnecessary with modern
allocators/compilers. The cost of anything here is most likely irrelevant
compared to the massive size of the containing function.
if (et == EDGETYPE_CURVED) {
int ii;
- edge_t* e0;
- edge_t** edgelist;
- if (cnt == 1)
- edgelist = &e0;
- else
- edgelist = gv_calloc(cnt, sizeof(edge_t*));
+ edge_t** edgelist = gv_calloc(cnt, sizeof(edge_t*));
edgelist[0] = getmainedge((edges+ind)[0]);
for (ii = 1; ii < cnt; ii++)
edgelist[ii] = (edges+ind)[ii];
makeStraightEdges (g, edgelist, cnt, et, &sinfo);
- if (cnt > 1)
- free (edgelist);
+ free(edgelist);
}
else if (agtail(e0) == aghead(e0)) {
int b, r;