summaryrefslogtreecommitdiff
path: root/cups/array.c
diff options
context:
space:
mode:
authorjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>2007-03-14 16:55:44 +0000
committerjlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be>2007-03-14 16:55:44 +0000
commitf7deaa1a21758ec90bf23314af018481ea8aea7f (patch)
tree28c1e9c935060b27e10b2e9daa788f69508f3726 /cups/array.c
parentb86bc4cf571c35972a94a634ea884baff9799fa9 (diff)
downloadcups-f7deaa1a21758ec90bf23314af018481ea8aea7f.tar.gz
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@279 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/array.c')
-rw-r--r--cups/array.c84
1 files changed, 60 insertions, 24 deletions
diff --git a/cups/array.c b/cups/array.c
index b05168031..b792c465c 100644
--- a/cups/array.c
+++ b/cups/array.c
@@ -1,5 +1,5 @@
/*
- * "$Id: array.c 5493 2006-05-05 16:33:57Z mike $"
+ * "$Id: array.c 6123 2006-11-21 15:36:04Z mike $"
*
* Sorted array routines for the Common UNIX Printing System (CUPS).
*
@@ -25,27 +25,29 @@
*
* Contents:
*
- * cupsArrayAdd() - Add an element to the array.
- * cupsArrayClear() - Clear the array.
- * cupsArrayCount() - Get the number of elements in the array.
- * cupsArrayCurrent() - Return the current element in the array.
- * cupsArrayDelete() - Free all memory used by the array.
- * cupsArrayDup() - Duplicate the array.
- * cupsArrayFind() - Find an element in the array.
- * cupsArrayFirst() - Get the first element in the array.
- * cupsArrayIndex() - Get the N-th element in the array.
- * cupsArrayInsert() - Insert an element in the array.
- * cupsArrayLast() - Get the last element in the array.
- * cupsArrayNew() - Create a new array.
- * cupsArrayNext() - Get the next element in the array.
- * cupsArrayPrev() - Get the previous element in the array.
- * cupsArrayRemove() - Remove an element from the array.
- * cupsArrayRestore() - Reset the current element to the last cupsArraySave.
- * cupsArraySave() - Mark the current element for a later
- * cupsArrayRestore.
- * cupsArrayUserData() - Return the user data for an array.
- * cups_array_add() - Insert or append an element to the array...
- * cups_array_find() - Find an element in the array...
+ * cupsArrayAdd() - Add an element to the array.
+ * cupsArrayClear() - Clear the array.
+ * cupsArrayCount() - Get the number of elements in the array.
+ * cupsArrayCurrent() - Return the current element in the array.
+ * cupsArrayDelete() - Free all memory used by the array.
+ * cupsArrayDup() - Duplicate the array.
+ * cupsArrayFind() - Find an element in the array.
+ * cupsArrayFirst() - Get the first element in the array.
+ * cupsArrayGetIndex() - Get the index of the current element.
+ * cupsArrayGetInsert() - Get the index of the last inserted element.
+ * cupsArrayIndex() - Get the N-th element in the array.
+ * cupsArrayInsert() - Insert an element in the array.
+ * cupsArrayLast() - Get the last element in the array.
+ * cupsArrayNew() - Create a new array.
+ * cupsArrayNext() - Get the next element in the array.
+ * cupsArrayPrev() - Get the previous element in the array.
+ * cupsArrayRemove() - Remove an element from the array.
+ * cupsArrayRestore() - Reset the current element to the last cupsArraySave.
+ * cupsArraySave() - Mark the current element for a later
+ * cupsArrayRestore.
+ * cupsArrayUserData() - Return the user data for an array.
+ * cups_array_add() - Insert or append an element to the array...
+ * cups_array_find() - Find an element in the array...
*/
/*
@@ -386,6 +388,38 @@ cupsArrayFirst(cups_array_t *a) /* I - Array */
/*
+ * 'cupsArrayGetIndex()' - Get the index of the current element.
+ *
+ * @since CUPS 1.3@
+ */
+
+int /* O - Index of the current element */
+cupsArrayGetIndex(cups_array_t *a) /* I - Array */
+{
+ if (!a)
+ return (-1);
+ else
+ return (a->current);
+}
+
+
+/*
+ * 'cupsArrayGetInsert()' - Get the index of the last inserted element.
+ *
+ * @since CUPS 1.3@
+ */
+
+int /* O - Index of the last inserted element */
+cupsArrayGetInsert(cups_array_t *a) /* I - Array */
+{
+ if (!a)
+ return (-1);
+ else
+ return (a->insert);
+}
+
+
+/*
* 'cupsArrayIndex()' - Get the N-th element in the array.
*/
@@ -582,8 +616,10 @@ cupsArrayRemove(cups_array_t *a, /* I - Array */
if (current <= a->current)
a->current --;
- if (current <= a->insert)
+ if (current < a->insert)
a->insert --;
+ else if (current == a->insert)
+ a->insert = -1;
for (i = 0; i < a->num_saved; i ++)
if (current <= a->saved[i])
@@ -962,5 +998,5 @@ cups_array_find(cups_array_t *a, /* I - Array */
/*
- * End of "$Id: array.c 5493 2006-05-05 16:33:57Z mike $".
+ * End of "$Id: array.c 6123 2006-11-21 15:36:04Z mike $".
*/