"cmd/tools/unflatten.c",
"contrib/diffimg/diffimg.c",
"contrib/pangotest/pangotest.c",
- "contrib/prune/generic_list.c",
- "contrib/prune/generic_list.h",
"contrib/prune/prune.c",
"doc/libgraph/agmemread.c",
"doc/libgraph/sccmap.c",
-add_executable(prune generic_list.c prune.c)
+add_executable(prune prune.c)
target_include_directories(prune PRIVATE
../../lib
../../lib/cdt)
-I$(top_srcdir)/lib/cdt
bin_PROGRAMS = prune
-noinst_HEADERS = generic_list.h
dist_man_MANS = prune.1
if ENABLE_MAN_PDFS
pdf_DATA = prune.1.pdf
endif
-prune_SOURCES = generic_list.c prune.c
+prune_SOURCES = prune.c
prune_LDADD = $(top_builddir)/lib/ingraphs/libingraphs_C.la \
$(top_builddir)/lib/cgraph/libcgraph.la \
+++ /dev/null
-/*************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <cgraph/alloc.h>
-#include <stdlib.h>
-
-#include "generic_list.h"
-
-#define DFLT_SIZE 100
-
-generic_list_t new_generic_list(size_t size) {
- generic_list_t list = {0};
- if (size != 0) {
- list.data = gv_calloc(size, sizeof(gl_data));
- }
- list.size = size;
- return list;
-}
-
-void free_generic_list(generic_list_t * list)
-{
- if (list->size > 0) {
- free(list->data);
- }
-}
-
-void add_to_generic_list(generic_list_t *list, gl_data element) {
- size_t new_size;
-
- if (list->size == list->used) {
- if (list->size == 0) {
- new_size = DFLT_SIZE;
- } else {
- new_size = list->size * 2;
- }
- gl_data *new_data = gv_recalloc(list->data, list->size, new_size,
- sizeof(gl_data));
- list->data = new_data;
- list->size = new_size;
- }
- list->data[list->used++] = element;
-}
+++ /dev/null
-/*************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Details at http://www.graphviz.org/
- *************************************************************************/
-
-#pragma once
-
-#include <stddef.h>
-
- typedef void *gl_data;
-
- typedef struct {
- size_t used; /* number of elements in the list */
- size_t size; /* number of elements that the list can hold */
- gl_data *data; /* pointer to first element */
- } generic_list_t;
-
- extern generic_list_t new_generic_list(size_t size);
- extern void add_to_generic_list(generic_list_t * list,
- gl_data element);
- extern void free_generic_list(generic_list_t * list);
#include <cgraph/exit.h>
#include <cgraph/list.h>
#include <ingraphs/ingraphs.h>
-#include "generic_list.h"
/* structure to hold an attribute specified on the commandline */
typedef struct {
} strattr_t;
DEFINE_LIST(attrs, strattr_t)
+DEFINE_LIST(nodes, char*)
static int remove_child(Agraph_t * graph, Agnode_t * node);
static void help_message(const char *progname);
static void addattr(attrs_t *l, char *a);
-static void addnode(generic_list_t * l, char *n);
+static void addnode(nodes_t *l, char *n);
int verbose = 0; /* Flag to indicate verbose message output */
char **files;
- unsigned long i;
-
opterr = 0;
progname = strrchr(argv[0], '/');
}
attrs_t attr_list = {0};
- generic_list_t node_list = new_generic_list(16);
+ nodes_t node_list = {0};
while ((c = getopt(argc, argv, "hvn:N:")) != -1) {
switch (c) {
aginit(graph, AGNODE, NDNAME, sizeof(ndata), 1);
/* prune all nodes specified on the commandline */
- for (i = 0; i < node_list.used; i++) {
+ for (size_t i = 0; i < nodes_size(&node_list); ++i) {
if (verbose == 1)
- fprintf(stderr, "Pruning node %s\n", (char*)node_list.data[i]);
+ fprintf(stderr, "Pruning node %s\n", nodes_get(&node_list, i));
/* check whether a node of that name exists at all */
- node = agnode(graph, node_list.data[i], 0);
+ node = agnode(graph, nodes_get(&node_list, i), 0);
if (node == NULL) {
fprintf(stderr,
"*** Warning: No such node: %s -- gracefully skipping this one\n",
- (char*)node_list.data[i]);
+ nodes_get(&node_list, i));
} else {
MARK(node); /* Avoid cycles */
/* Iterate over all outgoing edges */
agclose(graph);
}
attrs_free(&attr_list);
- free_generic_list(&node_list);
+ nodes_free(&node_list);
graphviz_exit(EXIT_SUCCESS);
}
}
/* add element to node list */
-static void addnode(generic_list_t *l, char *n) {
+static void addnode(nodes_t *l, char *n) {
char *sp = gv_strdup(n);
- add_to_generic_list(l, sp);
+ nodes_append(l, sp);
}
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="generic_list.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="generic_list.c" />
<ClCompile Include="prune.c" />
</ItemGroup>
<ItemGroup>
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="generic_list.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="generic_list.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="prune.c">
<Filter>Source Files</Filter>
</ClCompile>