#endif
if (MemTest) {
- while (1) {
+ int i = 2;
+ while (i--) {
/* Create a test graph */
G = create_test_graph();
/* Delete graph */
agclose(G);
}
+#if 0
assert(0); /* should never exit loop */
+#endif
} else {
while ((G = next_input_graph())) {
if (prev) {
{
Gpr_t *state;
Agobj_t *objp;
- Agsym_t *gsym;
Agnode_t *np;
int iv;
int rv = 0;
}
- return setattr(objp, gsym->name, v.string);
+ return setattr(objp, sym->name, v.string);
}
static int codePhase;
static void emit_job(GVJ_t * job, graph_t * g)
{
if (!GD_drawing(g)) {
- fprintf (stderr,"layout was not done\n");
+ agerr (AGERR, "layout was not done\n");
return;
}
GVJ_t *job;
if (!GD_drawing(g)) {
- fprintf(stderr, "Layout was not done. Missing layout plugins? \n");
+ agerr (AGERR, "Layout was not done. Missing layout plugins? \n");
return -1;
}
}
job->output_lang = gvrender_select(job, job->output_langname);
if (job->output_lang == NO_SUPPORT) {
- fprintf(stderr,"renderer for %s is unavailable\n", job->output_langname);
+ agerr (AGERR, "renderer for %s is unavailable\n", job->output_langname);
return -1;
}
#include <stdio.h>
#include "geom.h"
+#include "types.h"
+#include "graph.h"
#include "geomprocs.h"
point pointof(int x, int y)
p.y = x;
break;
default:
- fprintf(stderr,"unsupported ccw rotation: %d degrees\n", ccwrot);
+ agerr (AGWARN, "unsupported ccw rotation: %d degrees\n", ccwrot);
}
return p;
}
p.y = x;
break;
default:
- fprintf(stderr,"unsupported ccw rotation: %d degrees\n", ccwrot);
+ agerr (AGWARN, "unsupported ccw rotation: %d degrees\n", ccwrot);
}
return p;
}
p.y = x;
break;
default:
- fprintf(stderr,"unsupported cw rotation: %d degrees\n", cwrot);
+ agerr (AGWARN, "unsupported cw rotation: %d degrees\n", cwrot);
}
return p;
}
p.y = x;
break;
default:
- fprintf(stderr,"unsupported cw rotation: %d degrees\n", cwrot);
+ agerr (AGWARN, "unsupported cw rotation: %d degrees\n", cwrot);
}
return p;
}
}
break;
}
+ for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
if (n == orig->head)
ED_head_port(orig).clip = FALSE;
else
GD_rank(g)[r].an = GD_rank(g)[r].n = cn[r];
GD_rank(g)[r].av = GD_rank(g)[r].v = N_NEW(cn[r] + 1, node_t *);
}
+ free (cn);
}
/* install a node at the current right end of its rank */
}
rc = gvlayout_select(gvc, engine);
if (rc == NO_SUPPORT) {
- fprintf(stderr, "Layout type: \"%s\" not recognized. Use one of:%s\n",
+ agerr (AGERR, "Layout type: \"%s\" not recognized. Use one of:%s\n",
engine, gvplugin_list(gvc, API_layout, engine));
return -1;
}
/* create a job for the required format */
rc = gvrender_output_langname_job(gvc, format);
if (rc == NO_SUPPORT) {
- fprintf(stderr, "Renderer type: \"%s\" not recognized. Use one of:%s\n",
+ agerr (AGERR, "Renderer type: \"%s\" not recognized. Use one of:%s\n",
format, gvplugin_list(gvc, API_render, format));
return -1;
}
#include "geom.h"
#include "color.h"
+#include "memory.h"
#include "const.h"
#include "types.h"
libdir = gvconfig_libdir();
/* load all libraries even if can't save config */
- config_glob = malloc(strlen(libdir)
+ config_glob = gmalloc(strlen(libdir)
+ 1
+ strlen(plugin_glob)
+ 1);
}
if (! gvc->config_path) {
- gvc->config_path = malloc(strlen(libdir) + 1 + strlen(config_file_name) + 1);
+ gvc->config_path = gmalloc(strlen(libdir) + 1 + strlen(config_file_name) + 1);
strcpy(gvc->config_path, libdir);
strcat(gvc->config_path, "/");
strcat(gvc->config_path, config_file_name);
agerr (AGERR,"failed to open %s for read.\n", gvc->config_path);
}
else {
- config_text = malloc(config_st.st_size + 1);
+ config_text = gmalloc(config_st.st_size + 1);
sz = fread(config_text, 1, config_st.st_size, f);
if (sz == 0) {
agerr(AGERR,"%s is zero sized, or other read error.\n", gvc->config_path);
#endif
#include "geom.h"
+#include "memory.h"
#include "types.h"
#include "graph.h"
while (*pnext && strcmp(typestr, (*pnext)->typestr) == 0 && quality < (*pnext)->quality)
pnext = &((*pnext)->next);
- plugin = malloc(sizeof(gvplugin_available_t));
+ plugin = GNEW(gvplugin_available_t);
plugin->next = *pnext;
*pnext = plugin;
plugin->typestr = typestr;
if (len > lenp) {
lenp = len+20;
if (p)
- p = realloc(p, lenp);
+ p = grealloc(p, lenp);
else
- p = malloc(lenp);
+ p = gmalloc(lenp);
}
if (path[0] == '/') {
agerr (AGERR,"invalid plugin path \"%s\"\n", p);
return NULL;
}
- sym = malloc(len + strlen(suffix) + 1);
+ sym = gmalloc(len + strlen(suffix) + 1);
strcpy(sym, s+4); /* strip leading "/lib" */
s = strchr(sym, '.'); /* strip trailing ".so.0" */
strcpy(s,suffix); /* append "_LTX_library" */
len = strlen(str) + 1;
if (bufsz < (pos + len + 1)) {
bufsz += 4 * len;
- buf = realloc(buf, bufsz);
+ buf = grealloc(buf, bufsz);
}
p = buf + pos;
*p++ = sep;
#include <string.h>
#include "geom.h"
+#include "memory.h"
#include "pathplan.h"
#include "color.h"
#include "const.h"
rc = colorxlate(name, color, features->color_type);
if (rc != COLOR_OK) {
if (rc == COLOR_UNKNOWN) {
- char *missedcolor = malloc(strlen(name) + 16);
+ char *missedcolor = gmalloc(strlen(name) + 16);
sprintf(missedcolor, "color %s", name);
if (emit_once(missedcolor))
agerr(AGWARN, "%s is not a known color.\n", name);
int i;
if (sizeAF < n)
- AF = realloc(AF, n * sizeof(pointf));
+ AF = grealloc(AF, n * sizeof(pointf));
/* end hack */
for (i = 0; i < n; i++)
AF[i] = gvrender_pt(job, A[i]);
int i;
if (szAF2 < n) {
- AF2 = realloc(AF2, n * sizeof(pointf));
+ AF2 = grealloc(AF2, n * sizeof(pointf));
szAF2 = n;
}
for (i = 0; i < n; i++)
int i;
if (szA < n) {
- A = realloc(A, n * sizeof(point));
+ A = grealloc(A, n * sizeof(point));
szA = n;
}
for (i = 0; i < n; i++)
int i;
if (szAF < n) {
- AF = realloc(AF, n * sizeof(pointf));
+ AF = grealloc(AF, n * sizeof(pointf));
szAF = n;
}
for (i = 0; i < n; i++)
int i;
if (szAF < n) {
- AF = realloc(AF, n * sizeof(pointf));
+ AF = grealloc(AF, n * sizeof(pointf));
szAF = n;
}
for (i = 0; i < n; i++)