From: John Ellson Date: Wed, 6 Jan 2016 18:49:13 +0000 (-0500) Subject: janitor - clean up ~40 'unitialized' warnings X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca0623c558f6b9f399c29ba25bb1b04e03aa5049;p=graphviz janitor - clean up ~40 'unitialized' warnings --- diff --git a/cmd/gvmap/country_graph_coloring.c b/cmd/gvmap/country_graph_coloring.c index 3255b3c40..6a7d3e2dc 100644 --- a/cmd/gvmap/country_graph_coloring.c +++ b/cmd/gvmap/country_graph_coloring.c @@ -230,7 +230,7 @@ void improve_antibandwidth_by_swapping(SparseMatrix A, int *p){ real norm = n, norm1[3], norm2[3], norm11[3], norm22[3]; real pi, pj; real start = clock(); - FILE *fp; + FILE *fp = NULL; if (Verbose){ fprintf(stderr,"saving timing vs antiband data to timing_greedy\n"); diff --git a/cmd/tools/dijkstra.c b/cmd/tools/dijkstra.c index b093f416f..d19718ef2 100644 --- a/cmd/tools/dijkstra.c +++ b/cmd/tools/dijkstra.c @@ -170,7 +170,7 @@ static void post(Agraph_t * g) char buf[256]; char dflt[256]; Agsym_t *sym; - Agsym_t *psym; + Agsym_t *psym = NULL; double dist, oldmax; double maxdist = 0.0; /* maximum "finite" distance */ diff --git a/lib/cdt/dthash.c b/lib/cdt/dthash.c index 3904a0390..7c7c151f2 100644 --- a/lib/cdt/dthash.c +++ b/lib/cdt/dthash.c @@ -84,13 +84,13 @@ reg Void_t* obj; int type; #endif { - reg Dtlink_t *t, *r, *p; + reg Dtlink_t *t, *r = NULL, *p; reg Void_t *k, *key; reg uint hsh; reg int lk, sz, ky; reg Dtcompar_f cmpf; reg Dtdisc_t* disc; - reg Dtlink_t **s, **ends; + reg Dtlink_t **s = NULL, **ends; UNFLATTEN(dt); diff --git a/lib/cdt/dttree.c b/lib/cdt/dttree.c index f20c822b8..5e891cb75 100644 --- a/lib/cdt/dttree.c +++ b/lib/cdt/dttree.c @@ -20,7 +20,7 @@ int type; Dtlink_t *root, *t; int cmp, lk, sz, ky; Void_t *o, *k, *key; - Dtlink_t *l, *r, *me, link; + Dtlink_t *l, *r, *me = NULL, link; int n, minp, turn[DT_MINP]; Dtcompar_f cmpf; Dtdisc_t* disc; diff --git a/lib/cgraph/grammar.y b/lib/cgraph/grammar.y index 82b593170..b43f493a9 100644 --- a/lib/cgraph/grammar.y +++ b/lib/cgraph/grammar.y @@ -336,7 +336,7 @@ static void nomacros(void) static void attrstmt(int tkind, char *macroname) { item *aptr; - int kind; + int kind = 0; Agsym_t* sym; /* creating a macro def */ diff --git a/lib/circogen/circpos.c b/lib/circogen/circpos.c index b081dd77a..87b61c736 100644 --- a/lib/circogen/circpos.c +++ b/lib/circogen/circpos.c @@ -261,7 +261,7 @@ positionChildren (Agraph_t* g, posinfo_t* pi, posstate * stp, int length, double { block_t *child; double childAngle, childRadius, incidentAngle; - double mindistAngle, rotateAngle, midAngle; + double mindistAngle, rotateAngle, midAngle = 0.0; int midChild, cnt = 0; double snRadius = stp->subtreeR; /* max subtree radius */ double firstAngle = stp->firstAngle; diff --git a/lib/common/emit.c b/lib/common/emit.c index b8af0a639..d44fbab3e 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -202,8 +202,8 @@ getObjId (GVJ_t* job, void* obj, agxbuf* xb) char* id; graph_t* root = job->gvc->g; char* gid = GD_drawing(root)->id; - long idnum; - char* pfx; + long idnum = 0; + char* pfx = NULL; char buf[64]; /* large enough for a decimal 64-bit int */ layerPagePrefix (job, xb); @@ -2162,7 +2162,7 @@ static int multicolor (GVJ_t * job, edge_t * e, char** styles, char* colors, int int i, rv; colorsegs_t* segs; colorseg_t* s; - char* endcolor; + char* endcolor = NULL; double left; int first; /* first segment with t > 0 */ @@ -3017,7 +3017,7 @@ boxf xdotBB (Agraph_t* g) boxf bb = GD_bb(g); xdot* xd = (xdot*)GD_drawing(g)->xdots; textfont_t tf, null_tf = {NULL,NULL,NULL,0.0,0,0}; - int fontflags; + int fontflags = 0; if (!xd) return bb; diff --git a/lib/common/output.c b/lib/common/output.c index 06bd3aa6f..c4d32b83d 100644 --- a/lib/common/output.c +++ b/lib/common/output.c @@ -241,10 +241,10 @@ void attach_attrs_and_arrows(graph_t* g, int* sp, int* ep) edge_t *e; pointf ptf; int dim3 = (GD_odim(g) >= 3); - Agsym_t* bbsym; - Agsym_t* lpsym; - Agsym_t* lwsym; - Agsym_t* lhsym; + Agsym_t* bbsym = NULL; + Agsym_t* lpsym = NULL; + Agsym_t* lwsym = NULL; + Agsym_t* lhsym = NULL; gv_fixLocale (1); e_arrows = s_arrows = 0; diff --git a/lib/common/postproc.c b/lib/common/postproc.c index f3ac76aad..ada258d9b 100644 --- a/lib/common/postproc.c +++ b/lib/common/postproc.c @@ -464,10 +464,10 @@ static void addXLabels(Agraph_t * gp) object_t* objp; xlabel_t* xlp; Agsym_t* force; - Agsym_t* edge_xlab_prior; - Agsym_t* node_xlab_prior; - Agsym_t* hd_edge_xlab_prior; - Agsym_t* tl_edge_xlab_prior; + Agsym_t* edge_xlab_prior = NULL; + Agsym_t* node_xlab_prior = NULL; + Agsym_t* hd_edge_xlab_prior = NULL; + Agsym_t* tl_edge_xlab_prior = NULL; int* priorities = NULL; int et = EDGE_TYPE(gp); xlabel_state xlabs; diff --git a/lib/dotgen/aspect.c b/lib/dotgen/aspect.c index 561e7a017..39678a0a0 100644 --- a/lib/dotgen/aspect.c +++ b/lib/dotgen/aspect.c @@ -702,8 +702,8 @@ static void reduceMaxWidth(graph_t * g) static void reduceMaxWidth2(graph_t * g) { int i; - int maxLayerIndex; - double nextMaxWidth; + int maxLayerIndex = 0; + double nextMaxWidth = 0.0; double w = 0; double targetWidth; int fst; diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 1999df59d..01d13264f 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -256,8 +256,8 @@ static void _dot_splines(graph_t * g, int normalize) node_t *n; Agedgeinfo_t fwdedgeai, fwdedgebi; Agedgepair_t fwdedgea, fwdedgeb; - edge_t *e, *e0, *e1, *ea, *eb, *le0, *le1, **edges; - path *P; + edge_t *e, *e0, *e1, *ea, *eb, *le0, *le1, **edges = NULL; + path *P = NULL; spline_info_t sd; int et = EDGE_TYPE(g); fwdedgea.out.base.data = (Agrec_t*)&fwdedgeai; diff --git a/lib/dotgen/mincross.c b/lib/dotgen/mincross.c index a56d8733a..44ee2f1b9 100644 --- a/lib/dotgen/mincross.c +++ b/lib/dotgen/mincross.c @@ -618,7 +618,7 @@ static void exchange(node_t * v, node_t * w) static void balanceNodes(graph_t * g, int r, node_t * v, node_t * w) { node_t *s; /* separator node */ - int sepIndex; + int sepIndex = 0; int nullType; /* type of null nodes */ int cntDummy = 0, cntOri = 0; int k = 0, m = 0, k1 = 0, m1 = 0, i = 0; diff --git a/lib/dotgen/rank.c b/lib/dotgen/rank.c index a3b20f025..8542524f8 100644 --- a/lib/dotgen/rank.c +++ b/lib/dotgen/rank.c @@ -1044,7 +1044,7 @@ static void setMinMax (graph_t* g, int doRoot) { int c, v; node_t *n; - node_t* leader; + node_t* leader = NULL; /* Do child clusters */ for (c = 1; c <= GD_n_cluster(g); c++) diff --git a/lib/expr/exeval.c b/lib/expr/exeval.c index d2707eb0c..1b9d81024 100644 --- a/lib/expr/exeval.c +++ b/lib/expr/exeval.c @@ -935,7 +935,7 @@ eval(Expr_t* ex, register Exnode_t* expr, void* env) register Extype_t** t; register int n; Extype_t v; - Extype_t r; + Extype_t r = {0}; Extype_t i; char* e; Exnode_t tmp; diff --git a/lib/expr/extoken.c b/lib/expr/extoken.c index 8b1bdfcc6..c697318d5 100644 --- a/lib/expr/extoken.c +++ b/lib/expr/extoken.c @@ -710,7 +710,7 @@ extoken_fn(register Expr_t* ex) { int b; int n; - int pc; + int pc = 0; int po; int t; diff --git a/lib/expr/exzero.c b/lib/expr/exzero.c index 9024565d0..4dff70316 100644 --- a/lib/expr/exzero.c +++ b/lib/expr/exzero.c @@ -27,7 +27,7 @@ Extype_t exzero(int type) { - Extype_t v; + Extype_t v = {0}; switch (type) { diff --git a/lib/gvpr/actions.c b/lib/gvpr/actions.c index 84db759de..77dd75411 100644 --- a/lib/gvpr/actions.c +++ b/lib/gvpr/actions.c @@ -585,7 +585,7 @@ int deleteObj(Agraph_t * g, Agobj_t * obj) */ int sfioWrite(Agraph_t * g, Sfio_t* fp, Agiodisc_t* dfltDisc) { - Agiodisc_t* saveio; + Agiodisc_t* saveio = NULL; int rv; if (g->clos->disc.io != dfltDisc) { @@ -1285,7 +1285,7 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) */ char *colorx (Expr_t* ex, char* incolor, char* fmt, Sfio_t* fp) { - gvcolor_t color; + gvcolor_t color = {0}; color_type_t type; int rc; int alpha; diff --git a/lib/label/split.q.c b/lib/label/split.q.c index 6cc593b11..8e93bd3e6 100644 --- a/lib/label/split.q.c +++ b/lib/label/split.q.c @@ -141,7 +141,7 @@ static void MethodZero(RTree_t * rtp) { register Rect_t *r; register int i, growth0, growth1, diff, biggestDiff; - register int group, chosen, betterGroup; + register int group, chosen = 0, betterGroup = 0; InitPVars(rtp); PickSeeds(rtp); @@ -220,7 +220,7 @@ static void PickSeeds(RTree_t * rtp) { register int i, j; unsigned int waste, worst; - int seed0, seed1; + int seed0 = 0, seed1 = 0; unsigned int area[NODECARD + 1]; for (i = 0; i < NODECARD + 1; i++) diff --git a/lib/mingle/edge_bundling.c b/lib/mingle/edge_bundling.c index f992ef2f4..797f75086 100644 --- a/lib/mingle/edge_bundling.c +++ b/lib/mingle/edge_bundling.c @@ -773,7 +773,7 @@ pedge* edge_bundling(SparseMatrix A0, int dim, real *x, int maxit_outer, real K, int i; real tol = 0.001; int k; - real step0 = 0.1, start; + real step0 = 0.1, start = 0.0; int maxit = 10; int flag; diff --git a/lib/neatogen/neatosplines.c b/lib/neatogen/neatosplines.c index 27a40f203..3cd189646 100644 --- a/lib/neatogen/neatosplines.c +++ b/lib/neatogen/neatosplines.c @@ -278,7 +278,7 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin, boolean isOrtho) field_t *fld; epsf_t *desc; int isPoly; - pointf* verts; + pointf* verts = NULL; pointf vs[4]; pointf p; pointf margin; diff --git a/lib/neatogen/voronoi.c b/lib/neatogen/voronoi.c index 8a619e797..dac489d0b 100644 --- a/lib/neatogen/voronoi.c +++ b/lib/neatogen/voronoi.c @@ -23,7 +23,7 @@ void voronoi(int triangulate, Site * (*nextsite) (void)) { Site *newsite, *bot, *top, *temp, *p; Site *v; - Point newintstar; + Point newintstar = {0}; char pm; Halfedge *lbnd, *rbnd, *llbnd, *rrbnd, *bisector; Edge *e; diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 3f6052c9f..845958dc6 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -152,7 +152,7 @@ convertSPtoRoute (sgraph* g, snode* fst, snode* lst) segment seg; double fix, b1, b2; int l1, l2; - pointf bp1, bp2, prevbp; /* bend points */ + pointf bp1, bp2, prevbp = {0.0,0.0}; /* bend points */ /* count no. of nodes in shortest path */ for (ptr = fst; ptr; ptr = N_DAD(ptr)) sz++; @@ -518,7 +518,7 @@ addNodeEdges (sgraph* sg, cell* cp, snode* np) #include static char* bendToStr (bend b) { - char* s; + char* s = NULL; switch (b) { case B_NODE : s = "B_NODE"; diff --git a/lib/ortho/partition.c b/lib/ortho/partition.c index 43b71f737..5250a7775 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -209,7 +209,7 @@ get_vertex_positions (int v0, int v1, int *ip, int *iq) vertexchain_t *vp0, *vp1; register int i; double angle, temp; - int tp, tq; + int tp = 0, tq = 0; vp0 = &vert[v0]; vp1 = &vert[v1]; diff --git a/lib/ortho/trapezoid.c b/lib/ortho/trapezoid.c index d6859032d..dba1de787 100644 --- a/lib/ortho/trapezoid.c +++ b/lib/ortho/trapezoid.c @@ -431,7 +431,7 @@ add_segment (int segnum, segment_t* seg, trap_t* tr, qnode_t* qs) { segment_t s; int tu, tl, sk, tfirst, tlast; - int tfirstr, tlastr, tfirstl, tlastl; + int tfirstr = 0, tlastr = 0, tfirstl = 0, tlastl = 0; int i1, i2, t, tn; pointf tpt; int tritop = 0, tribot = 0, is_swapped; diff --git a/lib/twopigen/circle.c b/lib/twopigen/circle.c index ab7493f60..6c4bac4a1 100644 --- a/lib/twopigen/circle.c +++ b/lib/twopigen/circle.c @@ -333,7 +333,7 @@ getRankseps (Agraph_t* g, int maxrank) char c; int i, rk = 1; double* ranks = N_NEW(maxrank+1, double); - double xf = 0, delx, d; + double xf = 0.0, delx = 0.0, d; if ((p = late_string(g, agfindgraphattr(g->root, "ranksep"), NULL))) { while ((rk <= maxrank) && ((d = strtod (p, &endp)) > 0)) {