new function for removing an entry from an array while preserving the
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>
Tue, 3 Nov 1998 14:52:25 +0000 (14:52 +0000)
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>
Tue, 3 Nov 1998 14:52:25 +0000 (14:52 +0000)
1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

* glib.h:
* garray.h:
(g_array_remove_index): new function for removing an entry from an
array while preserving the order
(g_array_remove_index_fast): new function for removing an entry
from an array. the order might be distorted
(g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
functions; working similiar to the above. (they have the semantic
of the old g_ptr_array_remove[_index] functions)
(g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
the order of the elements in the array is not changed
(g_byte_array_remove_index, g_byte_array_remove_index_fast): new
functions; byte_array wrapper for g_array_remove_index[_fast]

12 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
garray.c
glib.h
glib/garray.c
glib/glib.h

index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 1f3c7fff0cae77538a107505e6eafaee901f8aad..62c715bb063c0783ecac13620d4b634e63121335 100644 (file)
@@ -1,3 +1,19 @@
+1998-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * glib.h: 
+       * garray.h:
+       (g_array_remove_index): new function for removing an entry from an
+       array while preserving the order
+       (g_array_remove_index_fast): new function for removing an entry
+       from an array. the order might be distorted
+       (g_ptr_array_remove_index_fast, g_ptr_array_remove_fast): new
+       functions; working similiar to the above. (they have the semantic
+       of the old g_ptr_array_remove[_index] functions)
+       (g_ptr_array_remove_index, g_ptr_array_remove): new semantic. now
+       the order of the elements in the array is not changed
+       (g_byte_array_remove_index, g_byte_array_remove_index_fast): new
+       functions; byte_array wrapper for g_array_remove_index[_fast]
+
 Sun Nov  1 23:00:18 PST 1998 Manish Singh <yosh@gimp.org>
 
        * glib.h
index 4425f1d293f6ad1e4f3760c2073cbee66b7262d6..fd5e7b9e21fa3d6adaee1bd1b182b7b7cf1ab4e8 100644 (file)
--- a/garray.c
+++ b/garray.c
@@ -126,6 +126,54 @@ g_array_set_size (GArray *farray,
   return farray;
 }
 
+GArray*
+g_array_remove_index (GArray* farray,
+                     guint index)
+{
+  GRealArray* array = (GRealArray*) farray;
+
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  if (index != array->len - 1)
+      g_memmove (array->data + array->elt_size * index, 
+                array->data + array->elt_size * (index + 1), 
+                array->elt_size * (array->len - index - 1));
+  
+  if (array->zero_terminated)
+    memset (array->data + array->elt_size * (array->len - 1), 0, 
+           array->elt_size);
+
+  array->len -= 1;
+
+  return farray;
+}
+
+GArray*
+g_array_remove_index_fast (GArray* farray,
+                          guint index)
+{
+  GRealArray* array = (GRealArray*) farray;
+
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  if (index != array->len - 1)
+    g_memmove (array->data + array->elt_size * index, 
+              array->data + array->elt_size * (array->len - 1), 
+              array->elt_size);
+  
+  if (array->zero_terminated)
+    memset (array->data + array->elt_size * (array->len - 1), 0, 
+           array->elt_size);
+
+  array->len -= 1;
+
+  return farray;
+}
+
 static gint
 g_nearest_pow (gint num)
 {
@@ -245,7 +293,7 @@ g_ptr_array_set_size  (GPtrArray   *farray,
 
 gpointer
 g_ptr_array_remove_index (GPtrArray* farray,
-                         gint index)
+                         guint index)
 {
   GRealPtrArray* array = (GRealPtrArray*) farray;
   gpointer result;
@@ -255,8 +303,33 @@ g_ptr_array_remove_index (GPtrArray* farray,
   g_return_val_if_fail (index >= 0 && index < array->len, NULL);
 
   result = array->pdata[index];
+  
+  if (index != array->len - 1)
+    g_memmove (array->pdata + index, array->pdata + index + 1, 
+              array->len - index - 1);
+  
+  array->pdata[array->len - 1] = NULL;
+
+  array->len -= 1;
+
+  return result;
+}
+
+gpointer
+g_ptr_array_remove_index_fast (GPtrArray* farray,
+                              guint index)
+{
+  GRealPtrArray* array = (GRealPtrArray*) farray;
+  gpointer result;
 
-  array->pdata[index] = array->pdata[array->len - 1];
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  result = array->pdata[index];
+  
+  if (index != array->len - 1)
+    array->pdata[index] = array->pdata[array->len - 1];
 
   array->pdata[array->len - 1] = NULL;
 
@@ -286,6 +359,27 @@ g_ptr_array_remove (GPtrArray* farray,
   return FALSE;
 }
 
+gboolean
+g_ptr_array_remove_fast (GPtrArray* farray,
+                        gpointer data)
+{
+  GRealPtrArray* array = (GRealPtrArray*) farray;
+  int i;
+
+  g_return_val_if_fail (array, FALSE);
+
+  for (i = 0; i < array->len; i += 1)
+    {
+      if (array->pdata[i] == data)
+       {
+         g_ptr_array_remove_index_fast (farray, i);
+         return TRUE;
+       }
+    }
+
+  return FALSE;
+}
+
 void
 g_ptr_array_add (GPtrArray* farray,
                 gpointer data)
@@ -338,3 +432,19 @@ GByteArray* g_byte_array_set_size (GByteArray *array,
 
   return array;
 }
+
+GByteArray* g_byte_array_remove_index (GByteArray *array,
+                                      guint index)
+{
+  g_array_remove_index((GArray*) array, index);
+
+  return array;
+}
+
+GByteArray* g_byte_array_remove_index_fast (GByteArray *array,
+                                                  guint index)
+{
+  g_array_remove_index_fast((GArray*) array, index);
+
+  return array;
+}
diff --git a/glib.h b/glib.h
index c98dc78738da4e35f65575ba64fc55d38c3e1f23..72941f7a925aba7960372f280435e604c7f61852 100644 (file)
--- a/glib.h
+++ b/glib.h
@@ -1601,30 +1601,37 @@ void     g_string_sprintfa  (GString     *string,
                             ...) G_GNUC_PRINTF (2, 3);
 
 
-/* Resizable arrays
+/* Resizable arrays, remove fills any cleared spot and shortens the
+ * array, while preserving the order. remove_fast will distort the
+ * order by moving the last element to the position of the removed 
  */
 
 #define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
 #define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
 #define g_array_index(a,t,i) (((t*)a->data)[i])
 
-GArray* g_array_new         (gboolean      zero_terminated,
-                             gboolean      clear,
-                             guint         element_size);
-void   g_array_free         (GArray       *array,
-                             gboolean      free_segment);
-GArray* g_array_append_vals  (GArray      *array,
-                             gconstpointer data,
-                             guint         len);
-GArray* g_array_prepend_vals (GArray      *array,
-                             gconstpointer data,
-                             guint         len);
-GArray* g_array_set_size     (GArray      *array,
-                             guint         length);
+GArray* g_array_new              (gboolean         zero_terminated,
+                                  gboolean         clear,
+                                  guint            element_size);
+void   g_array_free              (GArray          *array,
+                                  gboolean         free_segment);
+GArray* g_array_append_vals       (GArray         *array,
+                                  gconstpointer    data,
+                                  guint            len);
+GArray* g_array_prepend_vals      (GArray         *array,
+                                  gconstpointer    data,
+                                  guint            len);
+GArray* g_array_set_size          (GArray         *array,
+                                  guint            length);
+GArray* g_array_remove_index     (GArray          *array,
+                                  guint            index);
+GArray* g_array_remove_index_fast (GArray         *array,
+                                  guint            index);
 
 /* Resizable pointer array.  This interface is much less complicated
  * than the above.  Add appends appends a pointer.  Remove fills any
- * cleared spot and shortens the array.
+ * cleared spot and shortens the array. remove_fast will again distort
+ * order.  
  */
 #define            g_ptr_array_index(array,index) (array->pdata)[index]
 GPtrArray*  g_ptr_array_new               (void);
@@ -1633,9 +1640,13 @@ void         g_ptr_array_free               (GPtrArray   *array,
 void       g_ptr_array_set_size           (GPtrArray   *array,
                                            gint         length);
 gpointer    g_ptr_array_remove_index      (GPtrArray   *array,
-                                           gint         index);
+                                           guint        index);
+gpointer    g_ptr_array_remove_index_fast  (GPtrArray  *array,
+                                           guint        index);
 gboolean    g_ptr_array_remove            (GPtrArray   *array,
                                            gpointer     data);
+gboolean    g_ptr_array_remove_fast        (GPtrArray  *array,
+                                           gpointer     data);
 void       g_ptr_array_add                (GPtrArray   *array,
                                            gpointer     data);
 
@@ -1643,17 +1654,21 @@ void        g_ptr_array_add                (GPtrArray   *array,
  * but type-safe.
  */
 
-GByteArray* g_byte_array_new     (void);
-void       g_byte_array_free     (GByteArray   *array,
-                                  gboolean      free_segment);
-GByteArray* g_byte_array_append          (GByteArray   *array,
-                                  const guint8 *data,
-                                  guint         len);
-GByteArray* g_byte_array_prepend  (GByteArray  *array,
-                                  const guint8 *data,
-                                  guint         len);
-GByteArray* g_byte_array_set_size (GByteArray  *array,
-                                  guint         length);
+GByteArray* g_byte_array_new              (void);
+void       g_byte_array_free              (GByteArray   *array,
+                                           gboolean      free_segment);
+GByteArray* g_byte_array_append                   (GByteArray   *array,
+                                           const guint8 *data,
+                                           guint         len);
+GByteArray* g_byte_array_prepend           (GByteArray  *array,
+                                           const guint8 *data,
+                                           guint         len);
+GByteArray* g_byte_array_set_size          (GByteArray  *array,
+                                           guint         length);
+GByteArray* g_byte_array_remove_index     (GByteArray   *array,
+                                           guint         index);
+GByteArray* g_byte_array_remove_index_fast (GByteArray  *array,
+                                           guint         index);
 
 
 /* Hash Functions
index 4425f1d293f6ad1e4f3760c2073cbee66b7262d6..fd5e7b9e21fa3d6adaee1bd1b182b7b7cf1ab4e8 100644 (file)
@@ -126,6 +126,54 @@ g_array_set_size (GArray *farray,
   return farray;
 }
 
+GArray*
+g_array_remove_index (GArray* farray,
+                     guint index)
+{
+  GRealArray* array = (GRealArray*) farray;
+
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  if (index != array->len - 1)
+      g_memmove (array->data + array->elt_size * index, 
+                array->data + array->elt_size * (index + 1), 
+                array->elt_size * (array->len - index - 1));
+  
+  if (array->zero_terminated)
+    memset (array->data + array->elt_size * (array->len - 1), 0, 
+           array->elt_size);
+
+  array->len -= 1;
+
+  return farray;
+}
+
+GArray*
+g_array_remove_index_fast (GArray* farray,
+                          guint index)
+{
+  GRealArray* array = (GRealArray*) farray;
+
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  if (index != array->len - 1)
+    g_memmove (array->data + array->elt_size * index, 
+              array->data + array->elt_size * (array->len - 1), 
+              array->elt_size);
+  
+  if (array->zero_terminated)
+    memset (array->data + array->elt_size * (array->len - 1), 0, 
+           array->elt_size);
+
+  array->len -= 1;
+
+  return farray;
+}
+
 static gint
 g_nearest_pow (gint num)
 {
@@ -245,7 +293,7 @@ g_ptr_array_set_size  (GPtrArray   *farray,
 
 gpointer
 g_ptr_array_remove_index (GPtrArray* farray,
-                         gint index)
+                         guint index)
 {
   GRealPtrArray* array = (GRealPtrArray*) farray;
   gpointer result;
@@ -255,8 +303,33 @@ g_ptr_array_remove_index (GPtrArray* farray,
   g_return_val_if_fail (index >= 0 && index < array->len, NULL);
 
   result = array->pdata[index];
+  
+  if (index != array->len - 1)
+    g_memmove (array->pdata + index, array->pdata + index + 1, 
+              array->len - index - 1);
+  
+  array->pdata[array->len - 1] = NULL;
+
+  array->len -= 1;
+
+  return result;
+}
+
+gpointer
+g_ptr_array_remove_index_fast (GPtrArray* farray,
+                              guint index)
+{
+  GRealPtrArray* array = (GRealPtrArray*) farray;
+  gpointer result;
 
-  array->pdata[index] = array->pdata[array->len - 1];
+  g_return_val_if_fail (array, NULL);
+
+  g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+  result = array->pdata[index];
+  
+  if (index != array->len - 1)
+    array->pdata[index] = array->pdata[array->len - 1];
 
   array->pdata[array->len - 1] = NULL;
 
@@ -286,6 +359,27 @@ g_ptr_array_remove (GPtrArray* farray,
   return FALSE;
 }
 
+gboolean
+g_ptr_array_remove_fast (GPtrArray* farray,
+                        gpointer data)
+{
+  GRealPtrArray* array = (GRealPtrArray*) farray;
+  int i;
+
+  g_return_val_if_fail (array, FALSE);
+
+  for (i = 0; i < array->len; i += 1)
+    {
+      if (array->pdata[i] == data)
+       {
+         g_ptr_array_remove_index_fast (farray, i);
+         return TRUE;
+       }
+    }
+
+  return FALSE;
+}
+
 void
 g_ptr_array_add (GPtrArray* farray,
                 gpointer data)
@@ -338,3 +432,19 @@ GByteArray* g_byte_array_set_size (GByteArray *array,
 
   return array;
 }
+
+GByteArray* g_byte_array_remove_index (GByteArray *array,
+                                      guint index)
+{
+  g_array_remove_index((GArray*) array, index);
+
+  return array;
+}
+
+GByteArray* g_byte_array_remove_index_fast (GByteArray *array,
+                                                  guint index)
+{
+  g_array_remove_index_fast((GArray*) array, index);
+
+  return array;
+}
index c98dc78738da4e35f65575ba64fc55d38c3e1f23..72941f7a925aba7960372f280435e604c7f61852 100644 (file)
@@ -1601,30 +1601,37 @@ void     g_string_sprintfa  (GString     *string,
                             ...) G_GNUC_PRINTF (2, 3);
 
 
-/* Resizable arrays
+/* Resizable arrays, remove fills any cleared spot and shortens the
+ * array, while preserving the order. remove_fast will distort the
+ * order by moving the last element to the position of the removed 
  */
 
 #define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
 #define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
 #define g_array_index(a,t,i) (((t*)a->data)[i])
 
-GArray* g_array_new         (gboolean      zero_terminated,
-                             gboolean      clear,
-                             guint         element_size);
-void   g_array_free         (GArray       *array,
-                             gboolean      free_segment);
-GArray* g_array_append_vals  (GArray      *array,
-                             gconstpointer data,
-                             guint         len);
-GArray* g_array_prepend_vals (GArray      *array,
-                             gconstpointer data,
-                             guint         len);
-GArray* g_array_set_size     (GArray      *array,
-                             guint         length);
+GArray* g_array_new              (gboolean         zero_terminated,
+                                  gboolean         clear,
+                                  guint            element_size);
+void   g_array_free              (GArray          *array,
+                                  gboolean         free_segment);
+GArray* g_array_append_vals       (GArray         *array,
+                                  gconstpointer    data,
+                                  guint            len);
+GArray* g_array_prepend_vals      (GArray         *array,
+                                  gconstpointer    data,
+                                  guint            len);
+GArray* g_array_set_size          (GArray         *array,
+                                  guint            length);
+GArray* g_array_remove_index     (GArray          *array,
+                                  guint            index);
+GArray* g_array_remove_index_fast (GArray         *array,
+                                  guint            index);
 
 /* Resizable pointer array.  This interface is much less complicated
  * than the above.  Add appends appends a pointer.  Remove fills any
- * cleared spot and shortens the array.
+ * cleared spot and shortens the array. remove_fast will again distort
+ * order.  
  */
 #define            g_ptr_array_index(array,index) (array->pdata)[index]
 GPtrArray*  g_ptr_array_new               (void);
@@ -1633,9 +1640,13 @@ void         g_ptr_array_free               (GPtrArray   *array,
 void       g_ptr_array_set_size           (GPtrArray   *array,
                                            gint         length);
 gpointer    g_ptr_array_remove_index      (GPtrArray   *array,
-                                           gint         index);
+                                           guint        index);
+gpointer    g_ptr_array_remove_index_fast  (GPtrArray  *array,
+                                           guint        index);
 gboolean    g_ptr_array_remove            (GPtrArray   *array,
                                            gpointer     data);
+gboolean    g_ptr_array_remove_fast        (GPtrArray  *array,
+                                           gpointer     data);
 void       g_ptr_array_add                (GPtrArray   *array,
                                            gpointer     data);
 
@@ -1643,17 +1654,21 @@ void        g_ptr_array_add                (GPtrArray   *array,
  * but type-safe.
  */
 
-GByteArray* g_byte_array_new     (void);
-void       g_byte_array_free     (GByteArray   *array,
-                                  gboolean      free_segment);
-GByteArray* g_byte_array_append          (GByteArray   *array,
-                                  const guint8 *data,
-                                  guint         len);
-GByteArray* g_byte_array_prepend  (GByteArray  *array,
-                                  const guint8 *data,
-                                  guint         len);
-GByteArray* g_byte_array_set_size (GByteArray  *array,
-                                  guint         length);
+GByteArray* g_byte_array_new              (void);
+void       g_byte_array_free              (GByteArray   *array,
+                                           gboolean      free_segment);
+GByteArray* g_byte_array_append                   (GByteArray   *array,
+                                           const guint8 *data,
+                                           guint         len);
+GByteArray* g_byte_array_prepend           (GByteArray  *array,
+                                           const guint8 *data,
+                                           guint         len);
+GByteArray* g_byte_array_set_size          (GByteArray  *array,
+                                           guint         length);
+GByteArray* g_byte_array_remove_index     (GByteArray   *array,
+                                           guint         index);
+GByteArray* g_byte_array_remove_index_fast (GByteArray  *array,
+                                           guint         index);
 
 
 /* Hash Functions