From: Matthew Fernandez Date: Sat, 15 Jan 2022 21:27:46 +0000 (-0800) Subject: remove now unused 'Vector_*' API X-Git-Tag: 3.0.0~63^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8789063cca5feae26de5289fb53c8a471c3c390a;p=graphviz remove now unused 'Vector_*' API --- diff --git a/lib/sparse/CMakeLists.txt b/lib/sparse/CMakeLists.txt index 34f15d76b..40e116b3d 100644 --- a/lib/sparse/CMakeLists.txt +++ b/lib/sparse/CMakeLists.txt @@ -11,7 +11,6 @@ add_library(sparse STATIC mq.h QuadTree.h SparseMatrix.h - vector.h # Source files BinaryHeap.c @@ -25,7 +24,6 @@ add_library(sparse STATIC mq.c QuadTree.c SparseMatrix.c - vector.c ) target_include_directories(sparse PRIVATE diff --git a/lib/sparse/Makefile.am b/lib/sparse/Makefile.am index c8161fd46..752b5d058 100644 --- a/lib/sparse/Makefile.am +++ b/lib/sparse/Makefile.am @@ -6,12 +6,12 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/cgraph \ -I$(top_srcdir)/lib/cdt -noinst_HEADERS = SparseMatrix.h general.h BinaryHeap.h IntStack.h vector.h DotIO.h \ +noinst_HEADERS = SparseMatrix.h general.h BinaryHeap.h IntStack.h DotIO.h \ LinkedList.h colorutil.h color_palette.h mq.h clustering.h QuadTree.h noinst_LTLIBRARIES = libsparse_C.la -libsparse_C_la_SOURCES = SparseMatrix.c general.c BinaryHeap.c IntStack.c vector.c DotIO.c \ +libsparse_C_la_SOURCES = SparseMatrix.c general.c BinaryHeap.c IntStack.c DotIO.c \ LinkedList.c colorutil.c color_palette.c mq.c clustering.c QuadTree.c EXTRA_DIST = gvsparse.vcxproj* diff --git a/lib/sparse/gvsparse.vcxproj b/lib/sparse/gvsparse.vcxproj index 8b821b57b..5a5073358 100644 --- a/lib/sparse/gvsparse.vcxproj +++ b/lib/sparse/gvsparse.vcxproj @@ -77,7 +77,6 @@ - @@ -91,7 +90,6 @@ - diff --git a/lib/sparse/gvsparse.vcxproj.filters b/lib/sparse/gvsparse.vcxproj.filters index cb8fcca8a..a4a6481d8 100644 --- a/lib/sparse/gvsparse.vcxproj.filters +++ b/lib/sparse/gvsparse.vcxproj.filters @@ -18,9 +18,6 @@ Header Files - - Header Files - @@ -56,8 +53,5 @@ Source Files - - Source Files - \ No newline at end of file diff --git a/lib/sparse/vector.c b/lib/sparse/vector.c deleted file mode 100644 index 9f6b19558..000000000 --- a/lib/sparse/vector.c +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * 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 https://graphviz.org - *************************************************************************/ - -#include -#include - - -/*---------------- base vector class ----------- */ -Vector Vector_new(int maxlen, size_t size_of_elem, void (*deallocator)(void *v)){ - Vector v; - v = malloc(sizeof(struct vector_struct)); - if (v == NULL) - return NULL; - if (maxlen <= 0) maxlen = 1; - v->maxlen = maxlen; - v->len = 0; - v->size_of_elem = size_of_elem; - v->deallocator = deallocator; - v->v = malloc(size_of_elem*maxlen); - if (!v->v){ - free(v); - return NULL; - } - return v; -} - -static Vector Vector_assign(Vector v, void *stuff, int i){ - memcpy(((char*) v->v)+(v->size_of_elem)*i/sizeof(char), stuff, v->size_of_elem); - return v; -} - -Vector Vector_reset(Vector v, void *stuff, int i){ - if (i >= v->len) return NULL; - if (v->deallocator)(v->deallocator)((char*)v->v + (v->size_of_elem)*i/sizeof(char)); - return Vector_assign(v, stuff, i); -} - - -Vector Vector_add(Vector v, void *stuff){ - if (v->len + 1 >= v->maxlen){ - v->maxlen = v->maxlen + MAX((int) .2*(v->maxlen), 10); - v->v = realloc(v->v, (v->maxlen)*(v->size_of_elem)); - if (!(v->v)) return NULL; - } - - return Vector_assign(v, stuff, (v->len)++); -} - -void Vector_delete(Vector v){ - int i; - if (!v) return; - for (i = 0; i < v->len; i++){ - if (v->deallocator)(v->deallocator)((char*)v->v + (v->size_of_elem)*i/sizeof(char)); - } - free(v->v); - v->v = NULL; - free(v); -}; - -void* Vector_get(Vector v, int i){ - if (i >= v->len) return NULL; - return ((char*)v->v + i*(v->size_of_elem)/sizeof(char)); -} - -int Vector_get_length(Vector v){ - return v->len; -} diff --git a/lib/sparse/vector.h b/lib/sparse/vector.h deleted file mode 100644 index 9b2b0d84b..000000000 --- a/lib/sparse/vector.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * 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 https://graphviz.org - *************************************************************************/ - -#pragma once - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct vector_struct { - int maxlen; - int len; - void *v; - size_t size_of_elem; - void (*deallocator)(void *v); -}; - -typedef struct vector_struct *Vector; - -/* deallocator works on each element of the vector */ -Vector Vector_new(int maxlen, size_t size_of_elem, void (*deallocator)(void *v)); - -Vector Vector_add(Vector v, void *stuff); - -Vector Vector_reset(Vector v, void *stuff, int i); - -void Vector_delete(Vector v); - -void* Vector_get(Vector v, int i); - -int Vector_get_length(Vector v); - -Vector Vector_reset(Vector v, void *stuff, int i); - -#ifdef __cplusplus -} -#endif