From: Matthew Fernandez Date: Sun, 16 Jan 2022 18:11:44 +0000 (-0800) Subject: dot.demo/neatopack.c:[nfc] align with C99 style and clang-format X-Git-Tag: 3.0.0~57^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa4feb99e45498d1bee4d983a819e36134f4052b;p=graphviz dot.demo/neatopack.c:[nfc] align with C99 style and clang-format --- diff --git a/dot.demo/neatopack.c b/dot.demo/neatopack.c index fe9e2f6f3..e86d7d133 100644 --- a/dot.demo/neatopack.c +++ b/dot.demo/neatopack.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (c) 2011 AT&T Intellectual Property + * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,43 +11,37 @@ #include #include #include +#include -int main (int argc, char* argv[]) -{ - graph_t *g; - graph_t *sg; - FILE *fp; - graph_t** cc; - int i, ncc; - GVC_t *gvc; +int main(int argc, char *argv[]) { + GVC_t *gvc = gvContext(); - gvc = gvContext(); + FILE *fp; + if (argc > 1) + fp = fopen(argv[1], "r"); + else + fp = stdin; + graph_t *g = agread(fp, NULL); - if (argc > 1) - fp = fopen(argv[1], "r"); - else - fp = stdin; - g = agread(fp, NULL); + int ncc; + graph_t **cc = ccomps(g, &ncc, NULL); - cc = ccomps(g, &ncc, (char*)0); + for (int i = 0; i < ncc; i++) { + graph_t *sg = cc[i]; + nodeInduce(sg); + gvLayout(gvc, sg, "neato"); + } + pack_graph(ncc, cc, g, 0); - for (i = 0; i < ncc; i++) { - sg = cc[i]; - nodeInduce (sg); - gvLayout(gvc, sg, "neato"); - } - pack_graph (ncc, cc, g, 0); + gvRender(gvc, g, "ps", stdout); - gvRender(gvc, g, "ps", stdout); + for (int i = 0; i < ncc; i++) { + graph_t *sg = cc[i]; + gvFreeLayout(gvc, sg); + agdelete(g, sg); + } - for (i = 0; i < ncc; i++) { - sg = cc[i]; - gvFreeLayout(gvc, sg); - agdelete(g, sg); - } - - agclose(g); - - return (gvFreeContext(gvc)); + agclose(g); + return gvFreeContext(gvc); }