]> granicus.if.org Git - graphviz/commitdiff
remove now unused 'Vector_*' API
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 15 Jan 2022 21:27:46 +0000 (13:27 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 16 Jan 2022 18:51:42 +0000 (10:51 -0800)
lib/sparse/CMakeLists.txt
lib/sparse/Makefile.am
lib/sparse/gvsparse.vcxproj
lib/sparse/gvsparse.vcxproj.filters
lib/sparse/vector.c [deleted file]
lib/sparse/vector.h [deleted file]

index 34f15d76b34c3ffb73e9e90a2de35c94da5e4795..40e116b3d6c74cb0f38f8808e52f910c7436966d 100644 (file)
@@ -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
index c8161fd468cb8658b7fb9634577c418a4196dac4..752b5d058104602bd6993979eb405af889c7ebac 100644 (file)
@@ -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*
index 8b821b57b2c0fdb018fe897d80c869ad1fae05e5..5a507335807c413339e65fff601a94c1a6358b13 100644 (file)
@@ -77,7 +77,6 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="SparseMatrix.h" />
-    <ClInclude Include="vector.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="BinaryHeap.c" />
@@ -91,7 +90,6 @@
     <ClCompile Include="mq.c" />
     <ClCompile Include="QuadTree.c" />
     <ClCompile Include="SparseMatrix.c" />
-    <ClCompile Include="vector.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index cb8fcca8a91aeb011e570c06d0b57220489b565a..a4a6481d892a43ddfe45ff9db8cd1a1dac1e34d8 100644 (file)
@@ -18,9 +18,6 @@
     <ClInclude Include="SparseMatrix.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="vector.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="BinaryHeap.c">
@@ -56,8 +53,5 @@
     <ClCompile Include="SparseMatrix.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="vector.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/lib/sparse/vector.c b/lib/sparse/vector.c
deleted file mode 100644 (file)
index 9f6b195..0000000
+++ /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 <sparse/general.h>
-#include <sparse/vector.h>
-
-
-/*---------------- 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 (file)
index 9b2b0d8..0000000
+++ /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 <stdlib.h>
-
-#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