From 9a9c6bb292fe50880d461b223854c15776ce02b6 Mon Sep 17 00:00:00 2001 From: ellson Date: Wed, 15 Oct 2008 19:31:12 +0000 Subject: [PATCH] a few fixes for cgraph merge --- lib/common/utils.c | 17 +++++++---------- lib/common/utils.h | 2 +- lib/common/vtxgen.c | 12 ++++++------ 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/common/utils.c b/lib/common/utils.c index 6e1a832ae..7e69b63b0 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -401,7 +401,7 @@ char *Fgets(FILE * fp) * equivalent. * Returns NULL if the argument is trivial. */ -char *safefile(const char *filename) +const char *safefile(const char *filename) { static boolean onetime = TRUE; static char *safefilename = NULL; @@ -1216,14 +1216,12 @@ static node_t *mapN(node_t * n, graph_t * clg) { #ifndef WITH_CGRAPH extern Agdict_t *agdictof(void *); + Agdict_t *d; + Agsym_t **list; #endif /* WITH_CGRAPH */ node_t *nn; char *name; graph_t *g = agraphof(n); -#ifndef WITH_CGRAPH - Agdict_t *d; -#endif /* WITH_CGRAPH */ - Agsym_t **list; Agsym_t *sym; if (!(IS_CLUST_NODE(n))) @@ -1257,14 +1255,13 @@ static node_t *mapN(node_t * n, graph_t * clg) /* Can use pointer comparison because of ref strings. */ if (agxget(nn, sym->index) != sym->value) agxset(nn, sym->index, sym->value); + } #else /* WITH_CGRAPH */ - sym=0; - while (sym = agnxtattr(g, AGNODE, sym)) - { - if (agxget(nn, sym) != sym->defval) + for (sym = agnxtattr(g, AGNODE, NULL); sym; (sym = agnxtattr(g, AGNODE, sym))) { + if (agxget(nn, sym) != sym->defval) agxset(nn, sym, sym->defval); -#endif /* WITH_CGRAPH */ } +#endif /* WITH_CGRAPH */ return nn; } diff --git a/lib/common/utils.h b/lib/common/utils.h index 8afa3dffc..8cdba0050 100644 --- a/lib/common/utils.h +++ b/lib/common/utils.h @@ -51,7 +51,7 @@ extern "C" { extern void UF_setname(Agnode_t *, Agnode_t *); extern char *Fgets(FILE * fp); - extern char *safefile(const char *filename); + extern const char *safefile(const char *filename); extern boolean mapbool(char *); extern int maptoken(char *, char **, int *); diff --git a/lib/common/vtxgen.c b/lib/common/vtxgen.c index c6cd4e496..9fc95b1a4 100644 --- a/lib/common/vtxgen.c +++ b/lib/common/vtxgen.c @@ -316,8 +316,8 @@ static void vtx_begin_node(node_t * n) } } fprintf(Output_file, " (shape\n" - " (id %d)\n" - " (layer %d)\n" + " (id %ld)\n" + " (layer %ld)\n" " (type %s)\n", AGID(n) + 1, AGID(n), p->vtxshape); } @@ -329,13 +329,13 @@ static void vtx_end_node(void) static void vtx_begin_edge(edge_t * e) { fprintf(Output_file, " (connection\n" - " (id %d)\n" - " (layer %d)\n" + " (id %ld)\n" + " (layer %ld)\n" " (rotation 0)\n" " (textRotation 0)\n" " (locked F)\n" - " (start %d)\n" - " (end %d)\n", + " (start %ld)\n" + " (end %ld)\n", AGID(e) + 1, AGID(e), AGID(agtail(e)) + 1, AGID(aghead(e)) + 1); } -- 2.40.0