From 57a3be15611c4b6a224c1b2ef146ab477fba2641 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 28 Jun 2009 20:16:59 +0000
Subject: [PATCH] prune unused fcts

---
 Common/ListUtils.cpp | 75 ++++++++------------------------------------
 Common/ListUtils.h   | 12 +------
 Common/TreeUtils.cpp |  6 ++++
 Common/TreeUtils.h   | 10 +-----
 Common/avl.cpp       |  2 +-
 5 files changed, 22 insertions(+), 83 deletions(-)

diff --git a/Common/ListUtils.cpp b/Common/ListUtils.cpp
index 2cbb0eb33e..c90dbcec49 100644
--- a/Common/ListUtils.cpp
+++ b/Common/ListUtils.cpp
@@ -96,22 +96,6 @@ void List_Write(List_T * liste, int index, void *data)
   }
 }
 
-void List_Put(List_T * liste, int index, void *data)
-{
-  if(index < 0)
-    Msg::Error("Wrong list index (put)");
-  else {
-    if(index >= liste->n) {
-      liste->n = index + 1;
-      List_Realloc(liste, liste->n);
-      List_Write(liste, index, data);
-    }
-    else {
-      List_Write(liste, index, data);
-    }
-  }
-}
-
 void List_Pop(List_T * liste)
 {
   if(liste->n > 0)
@@ -140,15 +124,6 @@ void *List_Pointer_Fast(List_T * liste, int index)
   return (&liste->array[index * liste->size]);
 }
 
-void *List_Pointer_Test(List_T * liste, int index)
-{
-  if(!liste || (index < 0) || (index >= liste->n))
-    return NULL;
-
-  liste->isorder = 0;
-  return (&liste->array[index * liste->size]);
-}
-
 void List_Sort(List_T * liste, int (*fcmp) (const void *a, const void *b))
 {
   qsort(liste->array, liste->n, liste->size, fcmp);
@@ -186,20 +161,6 @@ int List_Search(List_T * liste, void *data,
   return (1);
 }
 
-int List_ISearch(List_T * liste, void *data,
-                 int (*fcmp) (const void *a, const void *b))
-{
-  void *ptr;
-
-  if(liste->isorder != 1)
-    List_Sort(liste, fcmp);
-  liste->isorder = 1;
-  ptr = (void *)bsearch(data, liste->array, liste->n, liste->size, fcmp);
-  if(ptr == NULL)
-    return (-1);
-  return (((long)ptr - (long)liste->array) / liste->size);
-}
-
 int List_ISearchSeq(List_T * liste, void *data,
                     int (*fcmp) (const void *a, const void *b))
 {
@@ -276,16 +237,6 @@ void List_Copy(List_T * a, List_T * b)
   }
 }
 
-void List_Merge(List_T * a, List_T * b)
-{
-  int i;
-
-  if(!a || !b) return;
-  for(i = 0; i < List_Nbr(a); i++) {
-    List_Add(b, List_Pointer_Fast(a, i));
-  }
-}
-
 void List_Remove(List_T *a, int i)
 {
   memcpy(&a->array[i * a->size], &a->array[(i + 1) * a->size], 
@@ -306,6 +257,19 @@ void List_Insert_In_List(List_T *a, int i, List_T *b)
     memcpy(List_Pointer_Fast(b, i + j), List_Pointer_Fast(a, j), b->size);
 }
 
+List_T *ListOfDouble2ListOfInt(List_T *dList)
+{
+  int n = List_Nbr(dList); 
+  List_T *iList = List_Create(n, n, sizeof(int));
+  for(int i = 0; i < n; i++){
+    double d;
+    List_Read(dList, i, &d);
+    int j = (int)d;
+    List_Add(iList, &j);
+  }
+  return iList;
+}
+
 // Comparison functions
 
 int fcmp_int(const void *a, const void *b)
@@ -331,16 +295,3 @@ int fcmp_double(const void *a, const void *b)
     return 0;
 }
 
-List_T *ListOfDouble2ListOfInt(List_T *dList)
-{
-  int n = List_Nbr(dList); 
-  List_T *iList = List_Create(n, n, sizeof(int));
-  for(int i = 0; i < n; i++){
-    double d;
-    List_Read(dList, i, &d);
-    int j = (int)d;
-    List_Add(iList, &j);
-  }
-  return iList;
-}
-
diff --git a/Common/ListUtils.h b/Common/ListUtils.h
index 4e659d8df1..b2005733f3 100644
--- a/Common/ListUtils.h
+++ b/Common/ListUtils.h
@@ -6,11 +6,6 @@
 #ifndef _LIST_UTILS_H_
 #define _LIST_UTILS_H_
 
-#include <stdio.h>
-
-#define LIST_FORMAT_ASCII       0
-#define LIST_FORMAT_BINARY      1
-
 class List_T {
 public:
   int nmax;
@@ -33,11 +28,9 @@ void    List_Pop(List_T *liste);
 void   *List_Pointer(List_T *liste, int index);
 void   *List_Pointer_NoChange(List_T *liste, int index);
 void   *List_Pointer_Fast(List_T *liste, int index);
-void   *List_Pointer_Test(List_T *liste, int index);
 void    List_Sort(List_T *liste, int (*fcmp)(const void *a, const void *b));
 void    List_Unique(List_T *liste, int (*fcmp)(const void *a, const void *b));
 int     List_Search(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
-int     List_ISearch(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
 int     List_ISearchSeq(List_T *liste, void * data, int (*fcmp)(const void *a, const void *b));
 void   *List_PQuery(List_T *liste, void *data, int (*fcmp)(const void *a, const void *b));
 int     List_PSuppress(List_T *liste, int index);
@@ -45,15 +38,12 @@ void    List_Invert(List_T *a, List_T *b);
 void    List_Reset(List_T *liste);
 void    List_Action(List_T *liste, void (*action)(void *data, void *dummy));
 void    List_Copy(List_T *a , List_T *b);
-void    List_Merge(List_T *a , List_T *b);
 void    List_Remove (List_T *a, int i);
 void    List_Insert_In_List (List_T *a, int i, List_T *b);
+List_T *ListOfDouble2ListOfInt(List_T *dList);
 
 int fcmp_int(const void *a, const void *b);
 int fcmp_absint(const void *a, const void *b);
 int fcmp_double(const void *a, const void *b);
 
-List_T *ListOfDouble2ListOfInt(List_T *dList);
-
 #endif
-
diff --git a/Common/TreeUtils.cpp b/Common/TreeUtils.cpp
index 312d32feef..61fa6b4480 100644
--- a/Common/TreeUtils.cpp
+++ b/Common/TreeUtils.cpp
@@ -93,6 +93,12 @@ int Tree_Size(Tree_T * tree)
   return tree->size;
 }
 
+void Tree_Action(Tree_T *tree, void (*action) (void *data, void *dummy))
+{
+  if(!tree) return;
+  avl_foreach(tree->root, action, AVL_FORWARD);
+}
+
 static List_T *pListTransfer;
 
 void TransferList(void *a, void *b)
diff --git a/Common/TreeUtils.h b/Common/TreeUtils.h
index b10ae5304d..b3d83eee77 100644
--- a/Common/TreeUtils.h
+++ b/Common/TreeUtils.h
@@ -24,15 +24,7 @@ int     Tree_Query(Tree_T *Tree, void *data);
 void   *Tree_PQuery(Tree_T *Tree, void *data);
 int     Tree_Suppress(Tree_T *Tree, void *data);
 int     Tree_Size(Tree_T *tree) ;
-
-inline void Tree_Action(Tree_T *tree, void (*action) (void *data, void *dummy))
-{
-  if(!tree) return;
-
-  avl_foreach(tree->root, action, AVL_FORWARD);
-}
-
+void    Tree_Action(Tree_T *tree, void (*action) (void *data, void *dummy));
 List_T *Tree2List(Tree_T *pTree);
 
 #endif
-
diff --git a/Common/avl.cpp b/Common/avl.cpp
index d28c639d11..368ab6e009 100644
--- a/Common/avl.cpp
+++ b/Common/avl.cpp
@@ -23,7 +23,7 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-// Modified for Gmsh (C++, 64 bits, ...)
+// Modified for Gmsh (C++ and 64 bit compatibility)
 
 #include <stdio.h>
 
-- 
GitLab