/*****************************************************************************/
/* */
-/* coll.h */
+/* coll.h */
/* */
-/* Collection (dynamic array) */
+/* Collection (dynamic array) */
/* */
/* */
/* */
/*****************************************************************************/
-/* Data */
+/* Data */
/*****************************************************************************/
/* An array of pointers that grows if needed */
typedef struct Collection Collection;
struct Collection {
- unsigned Count; /* Number of items in the list */
- unsigned Size; /* Size of allocated array */
- void** Items; /* Array with dynamic size */
+ unsigned Count; /* Number of items in the list */
+ unsigned Size; /* Size of allocated array */
+ void** Items; /* Array with dynamic size */
};
/* An empty collection */
extern const Collection EmptyCollection;
/* Initializer for static collections */
-#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 }
+#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 }
/* Initializer for auto collections */
#define AUTO_COLLECTION_INITIALIZER EmptyCollection
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
return C->Count;
}
#else
-# define CollCount(C) (C)->Count
+# define CollCount(C) (C)->Count
#endif
void CollInsert (Collection* C, void* Item, unsigned Index);
return C->Items[Index];
}
#else
-# define CollAtUnchecked(C, Index) ((C)->Items[(Index)])
+# define CollAtUnchecked(C, Index) ((C)->Items[(Index)])
#endif
#if defined(HAVE_INLINE)
C->Count = 0;
}
#else
-# define CollDeleteAll(C) ((C)->Count = 0)
+# define CollDeleteAll(C) ((C)->Count = 0)
#endif
#if defined(HAVE_INLINE)
*/
void CollSort (Collection* C,
- int (*Compare) (void*, const void*, const void*),
- void* Data);
+ int (*Compare) (void*, const void*, const void*),
+ void* Data);
/* Sort the collection using the given compare function. The data pointer is
* passed as *first* element to the compare function, it's not used by the
* sort function itself. The other two pointer passed to the Compare function
/* End of coll.h */
#endif
-
-
-
-