[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/libpspp ChangeLog array.c array.h
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/libpspp ChangeLog array.c array.h |
Date: |
Sun, 03 Jun 2007 21:58:15 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/06/03 21:58:15
Modified files:
src/libpspp : ChangeLog array.c array.h
Log message:
(insert_range): New function.
(insert_element): New function.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/ChangeLog?cvsroot=pspp&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.h?cvsroot=pspp&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/ChangeLog,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- ChangeLog 25 Apr 2007 15:59:20 -0000 1.65
+++ ChangeLog 3 Jun 2007 21:58:14 -0000 1.66
@@ -1,3 +1,8 @@
+2007-06-03 Ben Pfaff <address@hidden>
+
+ * array.c (insert_range): New function.
+ (insert_element): New function.
+
2007-04-25 Ben Pfaff <address@hidden>
* model-checker.c: Don't use type sighandler_t, which is a GNU
Index: array.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/array.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- array.c 15 Dec 2006 00:16:03 -0000 1.10
+++ array.c 3 Jun 2007 21:58:14 -0000 1.11
@@ -360,6 +360,31 @@
remove_range (array, count, size, idx, 1);
}
+/* Makes room for N elements starting at IDX in ARRAY, which
+ initially consists of COUNT elements of SIZE bytes each, by
+ shifting elements IDX...COUNT (exclusive) to the right by N
+ positions. */
+void
+insert_range (void *array_, size_t count, size_t size,
+ size_t idx, size_t n)
+{
+ char *array = array_;
+
+ assert (idx <= count);
+ memmove (array + (idx + n) * size, array + idx * size, (count - idx) * size);
+}
+
+/* Makes room for a new element at IDX in ARRAY, which initially
+ consists of COUNT elements of SIZE bytes each, by shifting
+ elements IDX...COUNT (exclusive) to the right by one
+ positions. */
+void
+insert_element (void *array, size_t count, size_t size,
+ size_t idx)
+{
+ insert_range (array, count, size, idx, 1);
+}
+
/* Moves an element in ARRAY, which consists of COUNT elements of
SIZE bytes each, from OLD_IDX to NEW_IDX, shifting around
other elements as needed. Runs in O(abs(OLD_IDX - NEW_IDX))
Index: array.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/array.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- array.h 29 Oct 2006 11:16:07 -0000 1.6
+++ array.h 3 Jun 2007 21:58:14 -0000 1.7
@@ -108,6 +108,20 @@
void remove_element (void *array, size_t count, size_t size,
size_t idx);
+/* Makes room for N elements starting at IDX in ARRAY, which
+ initially consists of COUNT elements of SIZE bytes each, by
+ shifting elements IDX...COUNT (exclusive) to the right by N
+ positions. */
+void insert_range (void *array, size_t count, size_t size,
+ size_t idx, size_t n);
+
+/* Makes room for a new element at IDX in ARRAY, which initially
+ consists of COUNT elements of SIZE bytes each, by shifting
+ elements IDX...COUNT (exclusive) to the right by one
+ positions. */
+void insert_element (void *array, size_t count, size_t size,
+ size_t idx);
+
/* Moves an element in ARRAY, which consists of COUNT elements of
SIZE bytes each, from OLD_IDX to NEW_IDX, shifting around
other elements as needed. Runs in O(abs(OLD_IDX - NEW_IDX))
- [Pspp-cvs] pspp/src/libpspp ChangeLog array.c array.h,
Ben Pfaff <=