fix indenting

This commit is contained in:
Anthony Minessale 2015-09-04 11:25:56 -05:00
parent 3947d443fa
commit ab4514d1e5
8 changed files with 5577 additions and 5489 deletions

View File

@ -461,3 +461,14 @@ const char *mpool_strerror(const int error);
/*<<<<<<<<<< This is end of the auto-generated output from fillproto. */ /*<<<<<<<<<< This is end of the auto-generated output from fillproto. */
#endif /* ! __MPOOL_H__ */ #endif /* ! __MPOOL_H__ */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -40,7 +40,7 @@ extern "C" {
#endif #endif
/* Be friend of both C90 and C99 compilers */ /* Be friend of both C90 and C99 compilers */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* "inline" and "restrict" are keywords */ /* "inline" and "restrict" are keywords */
#else #else
@ -49,15 +49,15 @@ extern "C" {
#endif #endif
/** /**
* Type representing list hashes. * Type representing list hashes.
* *
* This is a signed integer value. * This is a signed integer value.
*/ */
typedef int32_t list_hash_t; typedef int32_t list_hash_t;
#ifndef SIMCLIST_NO_DUMPRESTORE #ifndef SIMCLIST_NO_DUMPRESTORE
typedef struct { typedef struct {
uint16_t version; /* dump version */ uint16_t version; /* dump version */
struct timeval timestamp; /* when the list has been dumped, seconds since UNIX epoch */ struct timeval timestamp; /* when the list has been dumped, seconds since UNIX epoch */
uint32_t list_size; uint32_t list_size;
@ -65,10 +65,10 @@ typedef struct {
list_hash_t list_hash; /* hash of the list when dumped, or 0 if invalid */ list_hash_t list_hash; /* hash of the list when dumped, or 0 if invalid */
uint32_t dumpsize; uint32_t dumpsize;
int consistent; /* 1 if the dump is verified complete/consistent; 0 otherwise */ int consistent; /* 1 if the dump is verified complete/consistent; 0 otherwise */
} list_dump_info_t; } list_dump_info_t;
#endif #endif
/** /**
* a comparator of elements. * a comparator of elements.
* *
* A comparator of elements is a function that: * A comparator of elements is a function that:
@ -77,9 +77,9 @@ typedef struct {
* *
* It is responsability of the function to handle possible NULL values. * It is responsability of the function to handle possible NULL values.
*/ */
typedef int (*element_comparator)(const void *a, const void *b); typedef int (*element_comparator)(const void *a, const void *b);
/** /**
* a seeker of elements. * a seeker of elements.
* *
* An element seeker is a function that: * An element seeker is a function that:
@ -90,9 +90,9 @@ typedef int (*element_comparator)(const void *a, const void *b);
* It is responsability of the function to handle possible NULL values in any * It is responsability of the function to handle possible NULL values in any
* argument. * argument.
*/ */
typedef int (*element_seeker)(const void *el, const void *indicator); typedef int (*element_seeker)(const void *el, const void *indicator);
/** /**
* an element lenght meter. * an element lenght meter.
* *
* An element meter is a function that: * An element meter is a function that:
@ -101,9 +101,9 @@ typedef int (*element_seeker)(const void *el, const void *indicator);
* *
* It is responsability of the function to handle possible NULL values. * It is responsability of the function to handle possible NULL values.
*/ */
typedef size_t (*element_meter)(const void *el); typedef size_t (*element_meter)(const void *el);
/** /**
* a function computing the hash of elements. * a function computing the hash of elements.
* *
* An hash computing function is a function that: * An hash computing function is a function that:
@ -112,9 +112,9 @@ typedef size_t (*element_meter)(const void *el);
* *
* It is responsability of the function to handle possible NULL values. * It is responsability of the function to handle possible NULL values.
*/ */
typedef list_hash_t (*element_hash_computer)(const void *el); typedef list_hash_t (*element_hash_computer)(const void *el);
/** /**
* a function for serializing an element. * a function for serializing an element.
* *
* A serializer function is one that gets a reference to an element, * A serializer function is one that gets a reference to an element,
@ -132,9 +132,9 @@ typedef list_hash_t (*element_hash_computer)(const void *el);
* @param serialize_buffer reference to fill with the length of the buffer * @param serialize_buffer reference to fill with the length of the buffer
* @return reference to the buffer with the serialized data * @return reference to the buffer with the serialized data
*/ */
typedef void *(*element_serializer)(const void *restrict el, uint32_t *restrict serializ_len); typedef void *(*element_serializer)(const void *restrict el, uint32_t *restrict serializ_len);
/** /**
* a function for un-serializing an element. * a function for un-serializing an element.
* *
* An unserializer function accomplishes the inverse operation of the * An unserializer function accomplishes the inverse operation of the
@ -149,19 +149,19 @@ typedef void *(*element_serializer)(const void *restrict el, uint32_t *restrict
* @param data_len reference to the location where to store the length of the data in the buffer returned * @param data_len reference to the location where to store the length of the data in the buffer returned
* @return reference to a buffer with the original, unserialized representation of the element * @return reference to a buffer with the original, unserialized representation of the element
*/ */
typedef void *(*element_unserializer)(const void *restrict data, uint32_t *restrict data_len); typedef void *(*element_unserializer)(const void *restrict data, uint32_t *restrict data_len);
/* [private-use] list entry -- olds actual user datum */ /* [private-use] list entry -- olds actual user datum */
struct list_entry_s { struct list_entry_s {
void *data; void *data;
/* doubly-linked list service references */ /* doubly-linked list service references */
struct list_entry_s *next; struct list_entry_s *next;
struct list_entry_s *prev; struct list_entry_s *prev;
}; };
/* [private-use] list attributes */ /* [private-use] list attributes */
struct list_attributes_s { struct list_attributes_s {
/* user-set routine for comparing list elements */ /* user-set routine for comparing list elements */
element_comparator comparator; element_comparator comparator;
/* user-set routing for seeking elements */ /* user-set routing for seeking elements */
@ -175,10 +175,10 @@ struct list_attributes_s {
element_serializer serializer; element_serializer serializer;
/* user-set routine for unserializing an element */ /* user-set routine for unserializing an element */
element_unserializer unserializer; element_unserializer unserializer;
}; };
/** list object */ /** list object */
typedef struct { typedef struct {
struct list_entry_s *head_sentinel; struct list_entry_s *head_sentinel;
struct list_entry_s *tail_sentinel; struct list_entry_s *tail_sentinel;
struct list_entry_s *mid; struct list_entry_s *mid;
@ -201,17 +201,17 @@ typedef struct {
/* list attributes */ /* list attributes */
struct list_attributes_s attrs; struct list_attributes_s attrs;
} list_t; } list_t;
/** /**
* initialize a list object for use. * initialize a list object for use.
* *
* @param l must point to a user-provided memory location * @param l must point to a user-provided memory location
* @return 0 for success. -1 for failure * @return 0 for success. -1 for failure
*/ */
int list_init(list_t *restrict l); int list_init(list_t *restrict l);
/** /**
* completely remove the list from memory. * completely remove the list from memory.
* *
* This function is the inverse of list_init(). It is meant to be called when * This function is the inverse of list_init(). It is meant to be called when
@ -220,9 +220,9 @@ int list_init(list_t *restrict l);
* *
* @param l list to destroy * @param l list to destroy
*/ */
void list_destroy(list_t *restrict l); void list_destroy(list_t *restrict l);
/** /**
* set the comparator function for list elements. * set the comparator function for list elements.
* *
* Comparator functions are used for searching and sorting. If NULL is passed * Comparator functions are used for searching and sorting. If NULL is passed
@ -234,9 +234,9 @@ void list_destroy(list_t *restrict l);
* *
* @see element_comparator() * @see element_comparator()
*/ */
int list_attributes_comparator(list_t *restrict l, element_comparator comparator_fun); int list_attributes_comparator(list_t *restrict l, element_comparator comparator_fun);
/** /**
* set a seeker function for list elements. * set a seeker function for list elements.
* *
* Seeker functions are used for finding elements. If NULL is passed as reference * Seeker functions are used for finding elements. If NULL is passed as reference
@ -248,9 +248,9 @@ int list_attributes_comparator(list_t *restrict l, element_comparator comparator
* *
* @see element_seeker() * @see element_seeker()
*/ */
int list_attributes_seeker(list_t *restrict l, element_seeker seeker_fun); int list_attributes_seeker(list_t *restrict l, element_seeker seeker_fun);
/** /**
* require to free element data when list entry is removed (default: don't free). * require to free element data when list entry is removed (default: don't free).
* *
* [ advanced preference ] * [ advanced preference ]
@ -280,9 +280,9 @@ int list_attributes_seeker(list_t *restrict l, element_seeker seeker_fun);
* @see list_meter_double() * @see list_meter_double()
* @see list_meter_string() * @see list_meter_string()
*/ */
int list_attributes_copy(list_t *restrict l, element_meter metric_fun, int copy_data); int list_attributes_copy(list_t *restrict l, element_meter metric_fun, int copy_data);
/** /**
* set the element hash computing function for the list elements. * set the element hash computing function for the list elements.
* *
* [ advanced preference ] * [ advanced preference ]
@ -300,9 +300,9 @@ int list_attributes_copy(list_t *restrict l, element_meter metric_fun, int copy_
* *
* @see element_hash_computer() * @see element_hash_computer()
*/ */
int list_attributes_hash_computer(list_t *restrict l, element_hash_computer hash_computer_fun); int list_attributes_hash_computer(list_t *restrict l, element_hash_computer hash_computer_fun);
/** /**
* set the element serializer function for the list elements. * set the element serializer function for the list elements.
* *
* [ advanced preference ] * [ advanced preference ]
@ -321,9 +321,9 @@ int list_attributes_hash_computer(list_t *restrict l, element_hash_computer hash
* @see list_dump_filedescriptor() * @see list_dump_filedescriptor()
* @see list_restore_filedescriptor() * @see list_restore_filedescriptor()
*/ */
int list_attributes_serializer(list_t *restrict l, element_serializer serializer_fun); int list_attributes_serializer(list_t *restrict l, element_serializer serializer_fun);
/** /**
* set the element unserializer function for the list elements. * set the element unserializer function for the list elements.
* *
* [ advanced preference ] * [ advanced preference ]
@ -343,9 +343,9 @@ int list_attributes_serializer(list_t *restrict l, element_serializer serializer
* @see list_dump_filedescriptor() * @see list_dump_filedescriptor()
* @see list_restore_filedescriptor() * @see list_restore_filedescriptor()
*/ */
int list_attributes_unserializer(list_t *restrict l, element_unserializer unserializer_fun); int list_attributes_unserializer(list_t *restrict l, element_unserializer unserializer_fun);
/** /**
* append data at the end of the list. * append data at the end of the list.
* *
* This function is useful for adding elements with a FIFO/queue policy. * This function is useful for adding elements with a FIFO/queue policy.
@ -355,9 +355,9 @@ int list_attributes_unserializer(list_t *restrict l, element_unserializer unseri
* *
* @return 1 for success. < 0 for failure * @return 1 for success. < 0 for failure
*/ */
int list_append(list_t *restrict l, const void *data); int list_append(list_t *restrict l, const void *data);
/** /**
* insert data in the head of the list. * insert data in the head of the list.
* *
* This function is useful for adding elements with a LIFO/Stack policy. * This function is useful for adding elements with a LIFO/Stack policy.
@ -367,9 +367,9 @@ int list_append(list_t *restrict l, const void *data);
* *
* @return 1 for success. < 0 for failure * @return 1 for success. < 0 for failure
*/ */
int list_prepend(list_t *restrict l, const void *restrict data); int list_prepend(list_t *restrict l, const void *restrict data);
/** /**
* extract the element in the top of the list. * extract the element in the top of the list.
* *
* This function is for using a list with a FIFO/queue policy. * This function is for using a list with a FIFO/queue policy.
@ -377,18 +377,18 @@ int list_prepend(list_t *restrict l, const void *restrict data);
* @param l list to operate * @param l list to operate
* @return reference to user datum, or NULL on errors * @return reference to user datum, or NULL on errors
*/ */
void *list_fetch(list_t *restrict l); void *list_fetch(list_t *restrict l);
/** /**
* retrieve an element at a given position. * retrieve an element at a given position.
* *
* @param l list to operate * @param l list to operate
* @param pos [0,size-1] position index of the element wanted * @param pos [0,size-1] position index of the element wanted
* @return reference to user datum, or NULL on errors * @return reference to user datum, or NULL on errors
*/ */
void *list_get_at(const list_t *restrict l, unsigned int pos); void *list_get_at(const list_t *restrict l, unsigned int pos);
/** /**
* return the maximum element of the list. * return the maximum element of the list.
* *
* @warning Requires a comparator function to be set for the list. * @warning Requires a comparator function to be set for the list.
@ -400,9 +400,9 @@ void *list_get_at(const list_t *restrict l, unsigned int pos);
* @param l list to operate * @param l list to operate
* @return the reference to the element, or NULL * @return the reference to the element, or NULL
*/ */
void *list_get_max(const list_t *restrict l); void *list_get_max(const list_t *restrict l);
/** /**
* return the minimum element of the list. * return the minimum element of the list.
* *
* @warning Requires a comparator function to be set for the list. * @warning Requires a comparator function to be set for the list.
@ -414,18 +414,18 @@ void *list_get_max(const list_t *restrict l);
* @param l list to operate * @param l list to operate
* @return the reference to the element, or NULL * @return the reference to the element, or NULL
*/ */
void *list_get_min(const list_t *restrict l); void *list_get_min(const list_t *restrict l);
/** /**
* retrieve and remove from list an element at a given position. * retrieve and remove from list an element at a given position.
* *
* @param l list to operate * @param l list to operate
* @param pos [0,size-1] position index of the element wanted * @param pos [0,size-1] position index of the element wanted
* @return reference to user datum, or NULL on errors * @return reference to user datum, or NULL on errors
*/ */
void *list_extract_at(list_t *restrict l, unsigned int pos); void *list_extract_at(list_t *restrict l, unsigned int pos);
/** /**
* insert an element at a given position. * insert an element at a given position.
* *
* @param l list to operate * @param l list to operate
@ -433,9 +433,9 @@ void *list_extract_at(list_t *restrict l, unsigned int pos);
* @param pos [0,size-1] position index to insert the element at * @param pos [0,size-1] position index to insert the element at
* @return positive value on success. Negative on failure * @return positive value on success. Negative on failure
*/ */
int list_insert_at(list_t *restrict l, const void *data, unsigned int pos); int list_insert_at(list_t *restrict l, const void *data, unsigned int pos);
/** /**
* expunge the first found given element from the list. * expunge the first found given element from the list.
* *
* Inspects the given list looking for the given element; if the element * Inspects the given list looking for the given element; if the element
@ -450,18 +450,18 @@ int list_insert_at(list_t *restrict l, const void *data, unsigned int pos);
* @see list_attributes_comparator() * @see list_attributes_comparator()
* @see list_delete_at() * @see list_delete_at()
*/ */
int list_delete(list_t *restrict l, const void *data); int list_delete(list_t *restrict l, const void *data);
/** /**
* expunge an element at a given position from the list. * expunge an element at a given position from the list.
* *
* @param l list to operate * @param l list to operate
* @param pos [0,size-1] position index of the element to be deleted * @param pos [0,size-1] position index of the element to be deleted
* @return 0 on success. Negative value on failure * @return 0 on success. Negative value on failure
*/ */
int list_delete_at(list_t *restrict l, unsigned int pos); int list_delete_at(list_t *restrict l, unsigned int pos);
/** /**
* expunge an array of elements from the list, given their position range. * expunge an array of elements from the list, given their position range.
* *
* @param l list to operate * @param l list to operate
@ -469,9 +469,9 @@ int list_delete_at(list_t *restrict l, unsigned int pos);
* @param posend [posstart,size-1] position of the last element to be deleted * @param posend [posstart,size-1] position of the last element to be deleted
* @return the number of elements successfully removed on success, <0 on error * @return the number of elements successfully removed on success, <0 on error
*/ */
int list_delete_range(list_t *restrict l, unsigned int posstart, unsigned int posend); int list_delete_range(list_t *restrict l, unsigned int posstart, unsigned int posend);
/** /**
* clear all the elements off of the list. * clear all the elements off of the list.
* *
* The element datums will not be freed. * The element datums will not be freed.
@ -482,17 +482,17 @@ int list_delete_range(list_t *restrict l, unsigned int posstart, unsigned int po
* @param l list to operate * @param l list to operate
* @return the number of elements removed on success, <0 on error * @return the number of elements removed on success, <0 on error
*/ */
int list_clear(list_t *restrict l); int list_clear(list_t *restrict l);
/** /**
* inspect the number of elements in the list. * inspect the number of elements in the list.
* *
* @param l list to operate * @param l list to operate
* @return number of elements currently held by the list * @return number of elements currently held by the list
*/ */
unsigned int list_size(const list_t *restrict l); unsigned int list_size(const list_t *restrict l);
/** /**
* inspect whether the list is empty. * inspect whether the list is empty.
* *
* @param l list to operate * @param l list to operate
@ -500,9 +500,9 @@ unsigned int list_size(const list_t *restrict l);
* *
* @see list_size() * @see list_size()
*/ */
int list_empty(const list_t *restrict l); int list_empty(const list_t *restrict l);
/** /**
* find the position of an element in a list. * find the position of an element in a list.
* *
* @warning Requires a comparator function to be set for the list. * @warning Requires a comparator function to be set for the list.
@ -519,9 +519,9 @@ int list_empty(const list_t *restrict l);
* @see list_attributes_comparator() * @see list_attributes_comparator()
* @see list_get_at() * @see list_get_at()
*/ */
int list_locate(const list_t *restrict l, const void *data); int list_locate(const list_t *restrict l, const void *data);
/** /**
* returns an element given an indicator. * returns an element given an indicator.
* *
* @warning Requires a seeker function to be set for the list. * @warning Requires a seeker function to be set for the list.
@ -534,9 +534,9 @@ int list_locate(const list_t *restrict l, const void *data);
* @param indicator indicator data to pass to the seeker along with elements * @param indicator indicator data to pass to the seeker along with elements
* @return reference to the element accepted by the seeker, or NULL if none found * @return reference to the element accepted by the seeker, or NULL if none found
*/ */
void *list_seek(list_t *restrict l, const void *indicator); void *list_seek(list_t *restrict l, const void *indicator);
/** /**
* inspect whether some data is member of the list. * inspect whether some data is member of the list.
* *
* @warning Requires a comparator function to be set for the list. * @warning Requires a comparator function to be set for the list.
@ -555,9 +555,9 @@ void *list_seek(list_t *restrict l, const void *indicator);
* *
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_contains(const list_t *restrict l, const void *data); int list_contains(const list_t *restrict l, const void *data);
/** /**
* concatenate two lists * concatenate two lists
* *
* Concatenates one list with another, and stores the result into a * Concatenates one list with another, and stores the result into a
@ -574,9 +574,9 @@ int list_contains(const list_t *restrict l, const void *data);
* @param dest reference to the destination list * @param dest reference to the destination list
* @return 0 for success, -1 for errors * @return 0 for success, -1 for errors
*/ */
int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest); int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest);
/** /**
* sort list elements. * sort list elements.
* *
* @warning Requires a comparator function to be set for the list. * @warning Requires a comparator function to be set for the list.
@ -591,9 +591,9 @@ int list_concat(const list_t *l1, const list_t *l2, list_t *restrict dest);
* *
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_sort(list_t *restrict l, int versus); int list_sort(list_t *restrict l, int versus);
/** /**
* start an iteration session. * start an iteration session.
* *
* This function prepares the list to be iterated. * This function prepares the list to be iterated.
@ -603,33 +603,33 @@ int list_sort(list_t *restrict l, int versus);
* *
* @see list_iterator_stop() * @see list_iterator_stop()
*/ */
int list_iterator_start(list_t *restrict l); int list_iterator_start(list_t *restrict l);
/** /**
* return the next element in the iteration session. * return the next element in the iteration session.
* *
* @param l list to operate * @param l list to operate
* @return element datum, or NULL on errors * @return element datum, or NULL on errors
*/ */
void *list_iterator_next(list_t *restrict l); void *list_iterator_next(list_t *restrict l);
/** /**
* inspect whether more elements are available in the iteration session. * inspect whether more elements are available in the iteration session.
* *
* @param l list to operate * @param l list to operate
* @return 0 iff no more elements are available. * @return 0 iff no more elements are available.
*/ */
int list_iterator_hasnext(const list_t *restrict l); int list_iterator_hasnext(const list_t *restrict l);
/** /**
* end an iteration session. * end an iteration session.
* *
* @param l list to operate * @param l list to operate
* @return 0 iff the iteration session cannot be stopped * @return 0 iff the iteration session cannot be stopped
*/ */
int list_iterator_stop(list_t *restrict l); int list_iterator_stop(list_t *restrict l);
/** /**
* return the hash of the current status of the list. * return the hash of the current status of the list.
* *
* @param l list to operate * @param l list to operate
@ -637,10 +637,10 @@ int list_iterator_stop(list_t *restrict l);
* *
* @return 0 for success; <0 for failure * @return 0 for success; <0 for failure
*/ */
int list_hash(const list_t *restrict l, list_hash_t *restrict hash); int list_hash(const list_t *restrict l, list_hash_t *restrict hash);
#ifndef SIMCLIST_NO_DUMPRESTORE #ifndef SIMCLIST_NO_DUMPRESTORE
/** /**
* get meta informations on a list dump on filedescriptor. * get meta informations on a list dump on filedescriptor.
* *
* [ advanced function ] * [ advanced function ]
@ -655,9 +655,9 @@ int list_hash(const list_t *restrict l, list_hash_t *restrict hash);
* *
* @see list_dump_filedescriptor() * @see list_dump_filedescriptor()
*/ */
int list_dump_getinfo_filedescriptor(int fd, list_dump_info_t *restrict info); int list_dump_getinfo_filedescriptor(int fd, list_dump_info_t *restrict info);
/** /**
* get meta informations on a list dump on file. * get meta informations on a list dump on file.
* *
* [ advanced function ] * [ advanced function ]
@ -670,9 +670,9 @@ int list_dump_getinfo_filedescriptor(int fd, list_dump_info_t *restrict info);
* *
* @see list_dump_filedescriptor() * @see list_dump_filedescriptor()
*/ */
int list_dump_getinfo_file(const char *restrict filename, list_dump_info_t *restrict info); int list_dump_getinfo_file(const char *restrict filename, list_dump_info_t *restrict info);
/** /**
* dump the list into an open, writable file descriptor. * dump the list into an open, writable file descriptor.
* *
* This function "dumps" the list to a persistent storage so it can be * This function "dumps" the list to a persistent storage so it can be
@ -706,9 +706,9 @@ int list_dump_getinfo_file(const char *restrict filename, list_dump_info_t *rest
* @see list_attributes_copy() * @see list_attributes_copy()
* @see list_attributes_serializer() * @see list_attributes_serializer()
*/ */
int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict len); int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict len);
/** /**
* dump the list to a file name. * dump the list to a file name.
* *
* This function creates a filename and dumps the current content of the list * This function creates a filename and dumps the current content of the list
@ -729,9 +729,9 @@ int list_dump_filedescriptor(const list_t *restrict l, int fd, size_t *restrict
* *
* This function stores a representation of the list * This function stores a representation of the list
*/ */
int list_dump_file(const list_t *restrict l, const char *restrict filename, size_t *restrict len); int list_dump_file(const list_t *restrict l, const char *restrict filename, size_t *restrict len);
/** /**
* restore the list from an open, readable file descriptor to memory. * restore the list from an open, readable file descriptor to memory.
* *
* This function is the "inverse" of list_dump_filedescriptor(). It restores * This function is the "inverse" of list_dump_filedescriptor(). It restores
@ -749,9 +749,9 @@ int list_dump_file(const list_t *restrict l, const char *restrict filename, size
* @param len location to store the length of the dump read (bytes), or NULL * @param len location to store the length of the dump read (bytes), or NULL
* @return 0 if successful; -1 otherwise * @return 0 if successful; -1 otherwise
*/ */
int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len); int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len);
/** /**
* restore the list from a file name. * restore the list from a file name.
* *
* This function restores the content of a list from a file into memory. It is * This function restores the content of a list from a file into memory. It is
@ -767,210 +767,210 @@ int list_restore_filedescriptor(list_t *restrict l, int fd, size_t *restrict len
* @param len location to store the length of the dump read (bytes), or NULL * @param len location to store the length of the dump read (bytes), or NULL
* @return 0 if successful; -1 otherwise * @return 0 if successful; -1 otherwise
*/ */
int list_restore_file(list_t *restrict l, const char *restrict filename, size_t *len); int list_restore_file(list_t *restrict l, const char *restrict filename, size_t *len);
#endif #endif
/* ready-made comparators, meters and hash computers */ /* ready-made comparators, meters and hash computers */
/* comparator functions */ /* comparator functions */
/** /**
* ready-made comparator for int8_t elements. * ready-made comparator for int8_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_int8_t(const void *a, const void *b); int list_comparator_int8_t(const void *a, const void *b);
/** /**
* ready-made comparator for int16_t elements. * ready-made comparator for int16_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_int16_t(const void *a, const void *b); int list_comparator_int16_t(const void *a, const void *b);
/** /**
* ready-made comparator for int32_t elements. * ready-made comparator for int32_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_int32_t(const void *a, const void *b); int list_comparator_int32_t(const void *a, const void *b);
/** /**
* ready-made comparator for int64_t elements. * ready-made comparator for int64_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_int64_t(const void *a, const void *b); int list_comparator_int64_t(const void *a, const void *b);
/** /**
* ready-made comparator for uint8_t elements. * ready-made comparator for uint8_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_uint8_t(const void *a, const void *b); int list_comparator_uint8_t(const void *a, const void *b);
/** /**
* ready-made comparator for uint16_t elements. * ready-made comparator for uint16_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_uint16_t(const void *a, const void *b); int list_comparator_uint16_t(const void *a, const void *b);
/** /**
* ready-made comparator for uint32_t elements. * ready-made comparator for uint32_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_uint32_t(const void *a, const void *b); int list_comparator_uint32_t(const void *a, const void *b);
/** /**
* ready-made comparator for uint64_t elements. * ready-made comparator for uint64_t elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_uint64_t(const void *a, const void *b); int list_comparator_uint64_t(const void *a, const void *b);
/** /**
* ready-made comparator for float elements. * ready-made comparator for float elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_float(const void *a, const void *b); int list_comparator_float(const void *a, const void *b);
/** /**
* ready-made comparator for double elements. * ready-made comparator for double elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_double(const void *a, const void *b); int list_comparator_double(const void *a, const void *b);
/** /**
* ready-made comparator for string elements. * ready-made comparator for string elements.
* @see list_attributes_comparator() * @see list_attributes_comparator()
*/ */
int list_comparator_string(const void *a, const void *b); int list_comparator_string(const void *a, const void *b);
/* metric functions */ /* metric functions */
/** /**
* ready-made metric function for int8_t elements. * ready-made metric function for int8_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_int8_t(const void *el); size_t list_meter_int8_t(const void *el);
/** /**
* ready-made metric function for int16_t elements. * ready-made metric function for int16_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_int16_t(const void *el); size_t list_meter_int16_t(const void *el);
/** /**
* ready-made metric function for int32_t elements. * ready-made metric function for int32_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_int32_t(const void *el); size_t list_meter_int32_t(const void *el);
/** /**
* ready-made metric function for int64_t elements. * ready-made metric function for int64_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_int64_t(const void *el); size_t list_meter_int64_t(const void *el);
/** /**
* ready-made metric function for uint8_t elements. * ready-made metric function for uint8_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_uint8_t(const void *el); size_t list_meter_uint8_t(const void *el);
/** /**
* ready-made metric function for uint16_t elements. * ready-made metric function for uint16_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_uint16_t(const void *el); size_t list_meter_uint16_t(const void *el);
/** /**
* ready-made metric function for uint32_t elements. * ready-made metric function for uint32_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_uint32_t(const void *el); size_t list_meter_uint32_t(const void *el);
/** /**
* ready-made metric function for uint64_t elements. * ready-made metric function for uint64_t elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_uint64_t(const void *el); size_t list_meter_uint64_t(const void *el);
/** /**
* ready-made metric function for float elements. * ready-made metric function for float elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_float(const void *el); size_t list_meter_float(const void *el);
/** /**
* ready-made metric function for double elements. * ready-made metric function for double elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_double(const void *el); size_t list_meter_double(const void *el);
/** /**
* ready-made metric function for string elements. * ready-made metric function for string elements.
* @see list_attributes_copy() * @see list_attributes_copy()
*/ */
size_t list_meter_string(const void *el); size_t list_meter_string(const void *el);
/* hash functions */ /* hash functions */
/** /**
* ready-made hash function for int8_t elements. * ready-made hash function for int8_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_int8_t(const void *el); list_hash_t list_hashcomputer_int8_t(const void *el);
/** /**
* ready-made hash function for int16_t elements. * ready-made hash function for int16_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_int16_t(const void *el); list_hash_t list_hashcomputer_int16_t(const void *el);
/** /**
* ready-made hash function for int32_t elements. * ready-made hash function for int32_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_int32_t(const void *el); list_hash_t list_hashcomputer_int32_t(const void *el);
/** /**
* ready-made hash function for int64_t elements. * ready-made hash function for int64_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_int64_t(const void *el); list_hash_t list_hashcomputer_int64_t(const void *el);
/** /**
* ready-made hash function for uint8_t elements. * ready-made hash function for uint8_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_uint8_t(const void *el); list_hash_t list_hashcomputer_uint8_t(const void *el);
/** /**
* ready-made hash function for uint16_t elements. * ready-made hash function for uint16_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_uint16_t(const void *el); list_hash_t list_hashcomputer_uint16_t(const void *el);
/** /**
* ready-made hash function for uint32_t elements. * ready-made hash function for uint32_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_uint32_t(const void *el); list_hash_t list_hashcomputer_uint32_t(const void *el);
/** /**
* ready-made hash function for uint64_t elements. * ready-made hash function for uint64_t elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_uint64_t(const void *el); list_hash_t list_hashcomputer_uint64_t(const void *el);
/** /**
* ready-made hash function for float elements. * ready-made hash function for float elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_float(const void *el); list_hash_t list_hashcomputer_float(const void *el);
/** /**
* ready-made hash function for double elements. * ready-made hash function for double elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_double(const void *el); list_hash_t list_hashcomputer_double(const void *el);
/** /**
* ready-made hash function for string elements. * ready-made hash function for string elements.
* @see list_attributes_hash_computer() * @see list_attributes_hash_computer()
*/ */
list_hash_t list_hashcomputer_string(const void *el); list_hash_t list_hashcomputer_string(const void *el);
#ifdef __cplusplus #ifdef __cplusplus
} }
@ -978,3 +978,13 @@ list_hash_t list_hashcomputer_string(const void *el);
#endif #endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -28,7 +28,7 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* /*
* To build a "key" in any of the below routines, pass in a pointer to * To build a "key" in any of the below routines, pass in a pointer to
* the key and its size [i.e. sizeof(int), etc]. With any of the * the key and its size [i.e. sizeof(int), etc]. With any of the
* "key" or "data" arguments, if their size is < 0, it will do an * "key" or "data" arguments, if their size is < 0, it will do an
@ -40,7 +40,7 @@ extern "C" {
* deleting from firstkey to NULL it will work fine. * deleting from firstkey to NULL it will work fine.
*/ */
/* return types for table functions */ /* return types for table functions */
#define TABLE_ERROR_NONE 1 /* no error from function */ #define TABLE_ERROR_NONE 1 /* no error from function */
#define TABLE_ERROR_PNT 2 /* bad table pointer */ #define TABLE_ERROR_PNT 2 /* bad table pointer */
#define TABLE_ERROR_ARG_NULL 3 /* buffer args were null */ #define TABLE_ERROR_ARG_NULL 3 /* buffer args were null */
@ -62,11 +62,11 @@ extern "C" {
#define TABLE_ERROR_COMPARE 19 /* problems with internal comparison */ #define TABLE_ERROR_COMPARE 19 /* problems with internal comparison */
#define TABLE_ERROR_FREE 20 /* memory free error */ #define TABLE_ERROR_FREE 20 /* memory free error */
/* /*
* Table flags set with table_attr. * Table flags set with table_attr.
*/ */
/* /*
* Automatically adjust the number of table buckets on the fly. * Automatically adjust the number of table buckets on the fly.
* Whenever the number of entries gets above some threshold, the * Whenever the number of entries gets above some threshold, the
* number of buckets is realloced to a new size and each entry is * number of buckets is realloced to a new size and each entry is
@ -75,20 +75,20 @@ extern "C" {
*/ */
#define TABLE_FLAG_AUTO_ADJUST (1<<0) #define TABLE_FLAG_AUTO_ADJUST (1<<0)
/* /*
* If the above auto-adjust flag is set, also adjust the number of * If the above auto-adjust flag is set, also adjust the number of
* table buckets down as we delete entries. * table buckets down as we delete entries.
*/ */
#define TABLE_FLAG_ADJUST_DOWN (1<<1) #define TABLE_FLAG_ADJUST_DOWN (1<<1)
/* structure to walk through the fields in a linear order */ /* structure to walk through the fields in a linear order */
typedef struct { typedef struct {
unsigned int tl_magic; /* magic structure to ensure correct init */ unsigned int tl_magic; /* magic structure to ensure correct init */
unsigned int tl_bucket_c; /* where in the table buck array we are */ unsigned int tl_bucket_c; /* where in the table buck array we are */
unsigned int tl_entry_c; /* in the bucket, which entry we are on */ unsigned int tl_entry_c; /* in the bucket, which entry we are on */
} table_linear_t; } table_linear_t;
/* /*
* int (*table_compare_t) * int (*table_compare_t)
* *
* DESCRIPTION * DESCRIPTION
@ -118,12 +118,12 @@ typedef struct {
* *
* data2_size - Pointer to the size of the second data entry. * data2_size - Pointer to the size of the second data entry.
*/ */
typedef int (*table_compare_t)(const void *key1, const int key1_size, typedef int (*table_compare_t)(const void *key1, const int key1_size,
const void *data1, const int data1_size, const void *data1, const int data1_size,
const void *key2, const int key2_size, const void *key2, const int key2_size,
const void *data2, const int data2_size); const void *data2, const int data2_size);
/* /*
* int (*table_mem_alloc_t) * int (*table_mem_alloc_t)
* *
* DESCRIPTION * DESCRIPTION
@ -143,9 +143,9 @@ typedef int (*table_compare_t)(const void *key1, const int key1_size,
* *
* size -> Number of bytes that needs to be allocated. * size -> Number of bytes that needs to be allocated.
*/ */
typedef void *(*table_mem_alloc_t)(void *pool_p, const unsigned long size); typedef void *(*table_mem_alloc_t)(void *pool_p, const unsigned long size);
/* /*
* int (*table_mem_resize_t) * int (*table_mem_resize_t)
* *
* DESCRIPTION * DESCRIPTION
@ -173,11 +173,11 @@ typedef void *(*table_mem_alloc_t)(void *pool_p, const unsigned long size);
* *
* new_size -> New size of the allocation. * new_size -> New size of the allocation.
*/ */
typedef void *(*table_mem_resize_t)(void *pool_p, void *old_addr, typedef void *(*table_mem_resize_t)(void *pool_p, void *old_addr,
const unsigned long old_size, const unsigned long old_size,
const unsigned long new_size); const unsigned long new_size);
/* /*
* int (*table_mem_free_t) * int (*table_mem_free_t)
* *
* DESCRIPTION * DESCRIPTION
@ -200,7 +200,7 @@ typedef void *(*table_mem_resize_t)(void *pool_p, void *old_addr,
* min_size -> Minimum size of the address being freed or 0 if not * min_size -> Minimum size of the address being freed or 0 if not
* known. This can also be the exact size if known. * known. This can also be the exact size if known.
*/ */
typedef int (*table_mem_free_t)(void *pool_p, void *addr, typedef int (*table_mem_free_t)(void *pool_p, void *addr,
const unsigned long min_size); const unsigned long min_size);
#ifdef TABLE_MAIN #ifdef TABLE_MAIN
@ -209,17 +209,17 @@ typedef int (*table_mem_free_t)(void *pool_p, void *addr,
#else #else
/* generic table type */ /* generic table type */
typedef void table_t; typedef void table_t;
/* generic table entry type */ /* generic table entry type */
typedef void table_entry_t; typedef void table_entry_t;
#endif #endif
/*<<<<<<<<<< The below prototypes are auto-generated by fillproto */ /*<<<<<<<<<< The below prototypes are auto-generated by fillproto */
/* /*
* table_t *table_alloc * table_t *table_alloc
* *
* DESCRIPTION: * DESCRIPTION:
@ -240,10 +240,10 @@ typedef void table_entry_t;
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_t *table_alloc(const unsigned int bucket_n, int *error_p); table_t *table_alloc(const unsigned int bucket_n, int *error_p);
/* /*
* table_t *table_alloc_in_pool * table_t *table_alloc_in_pool
* *
* DESCRIPTION: * DESCRIPTION:
@ -275,14 +275,14 @@ table_t *table_alloc(const unsigned int bucket_n, int *error_p);
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_t *table_alloc_in_pool(const unsigned int bucket_n, table_t *table_alloc_in_pool(const unsigned int bucket_n,
void *mem_pool, void *mem_pool,
table_mem_alloc_t alloc_func, table_mem_alloc_t alloc_func,
table_mem_resize_t resize_func, table_mem_resize_t resize_func,
table_mem_free_t free_func, int *error_p); table_mem_free_t free_func, int *error_p);
/* /*
* int table_attr * int table_attr
* *
* DESCRIPTION: * DESCRIPTION:
@ -302,10 +302,10 @@ table_t *table_alloc_in_pool(const unsigned int bucket_n,
* *
* attr - Attribute(s) that we will be applying to the table. * attr - Attribute(s) that we will be applying to the table.
*/ */
extern extern
int table_attr(table_t *table_p, const int attr); int table_attr(table_t *table_p, const int attr);
/* /*
* int table_set_data_alignment * int table_set_data_alignment
* *
* DESCRIPTION: * DESCRIPTION:
@ -342,10 +342,10 @@ int table_attr(table_t *table_p, const int attr);
* alignment - Alignment requested for the data. Must be a power of * alignment - Alignment requested for the data. Must be a power of
* 2. Set to 0 for none. * 2. Set to 0 for none.
*/ */
extern extern
int table_set_data_alignment(table_t *table_p, const int alignment); int table_set_data_alignment(table_t *table_p, const int alignment);
/* /*
* int table_clear * int table_clear
* *
* DESCRIPTION: * DESCRIPTION:
@ -362,10 +362,10 @@ int table_set_data_alignment(table_t *table_p, const int alignment);
* *
* table_p - Table structure pointer that we will be clearing. * table_p - Table structure pointer that we will be clearing.
*/ */
extern extern
int table_clear(table_t *table_p); int table_clear(table_t *table_p);
/* /*
* int table_free * int table_free
* *
* DESCRIPTION: * DESCRIPTION:
@ -382,10 +382,10 @@ int table_clear(table_t *table_p);
* *
* table_p - Table structure pointer that we will be freeing. * table_p - Table structure pointer that we will be freeing.
*/ */
extern extern
int table_free(table_t *table_p); int table_free(table_t *table_p);
/* /*
* int table_insert_kd * int table_insert_kd
* *
* DESCRIPTION: * DESCRIPTION:
@ -461,14 +461,14 @@ int table_free(table_t *table_p);
* the data in the table with the new data if the key already exists * the data in the table with the new data if the key already exists
* in the table. * in the table.
*/ */
extern extern
int table_insert_kd(table_t *table_p, int table_insert_kd(table_t *table_p,
const void *key_buf, const int key_size, const void *key_buf, const int key_size,
const void *data_buf, const int data_size, const void *data_buf, const int data_size,
void **key_buf_p, void **data_buf_p, void **key_buf_p, void **data_buf_p,
const char overwrite_b); const char overwrite_b);
/* /*
* int table_insert * int table_insert
* *
* DESCRIPTION: * DESCRIPTION:
@ -520,13 +520,13 @@ int table_insert_kd(table_t *table_p,
* the data in the table with the new data if the key already exists * the data in the table with the new data if the key already exists
* in the table. * in the table.
*/ */
extern extern
int table_insert(table_t *table_p, int table_insert(table_t *table_p,
const void *key_buf, const int key_size, const void *key_buf, const int key_size,
const void *data_buf, const int data_size, const void *data_buf, const int data_size,
void **data_buf_p, const char overwrite_b); void **data_buf_p, const char overwrite_b);
/* /*
* int table_retrieve * int table_retrieve
* *
* DESCRIPTION: * DESCRIPTION:
@ -565,12 +565,12 @@ int table_insert(table_t *table_p,
* to the size of the data stored in the table that is associated with * to the size of the data stored in the table that is associated with
* the key. * the key.
*/ */
extern extern
int table_retrieve(table_t *table_p, int table_retrieve(table_t *table_p,
const void *key_buf, const int key_size, const void *key_buf, const int key_size,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_delete * int table_delete
* *
* DESCRIPTION: * DESCRIPTION:
@ -615,12 +615,12 @@ int table_retrieve(table_t *table_p,
* to the size of the data that was stored in the table and that was * to the size of the data that was stored in the table and that was
* associated with the key. * associated with the key.
*/ */
extern extern
int table_delete(table_t *table_p, int table_delete(table_t *table_p,
const void *key_buf, const int key_size, const void *key_buf, const int key_size,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_delete_first * int table_delete_first
* *
* DESCRIPTION: * DESCRIPTION:
@ -669,12 +669,12 @@ int table_delete(table_t *table_p,
* to the size of the data that was stored in the table and that was * to the size of the data that was stored in the table and that was
* associated with the key. * associated with the key.
*/ */
extern extern
int table_delete_first(table_t *table_p, int table_delete_first(table_t *table_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_info * int table_info
* *
* DESCRIPTION: * DESCRIPTION:
@ -698,10 +698,10 @@ int table_delete_first(table_t *table_p,
* num_entries_p - Pointer to an integer which, if not NULL, will * num_entries_p - Pointer to an integer which, if not NULL, will
* contain the number of entries stored in the table. * contain the number of entries stored in the table.
*/ */
extern extern
int table_info(table_t *table_p, int *num_buckets_p, int *num_entries_p); int table_info(table_t *table_p, int *num_buckets_p, int *num_entries_p);
/* /*
* int table_adjust * int table_adjust
* *
* DESCRIPTION: * DESCRIPTION:
@ -721,10 +721,10 @@ int table_info(table_t *table_p, int *num_buckets_p, int *num_entries_p);
* bucket_n - Number buckets to adjust the table to. Set to 0 to * bucket_n - Number buckets to adjust the table to. Set to 0 to
* adjust the table to its number of entries. * adjust the table to its number of entries.
*/ */
extern extern
int table_adjust(table_t *table_p, const int bucket_n); int table_adjust(table_t *table_p, const int bucket_n);
/* /*
* int table_type_size * int table_type_size
* *
* DESCRIPTION: * DESCRIPTION:
@ -739,10 +739,10 @@ int table_adjust(table_t *table_p, const int bucket_n);
* *
* None. * None.
*/ */
extern extern
int table_type_size(void); int table_type_size(void);
/* /*
* int table_first * int table_first
* *
* DESCRIPTION: * DESCRIPTION:
@ -785,12 +785,12 @@ int table_type_size(void);
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the first key. * associated with the first key.
*/ */
extern extern
int table_first(table_t *table_p, int table_first(table_t *table_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_next * int table_next
* *
* DESCRIPTION: * DESCRIPTION:
@ -833,12 +833,12 @@ int table_first(table_t *table_p,
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the next key. * associated with the next key.
*/ */
extern extern
int table_next(table_t *table_p, int table_next(table_t *table_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_this * int table_this
* *
* DESCRIPTION: * DESCRIPTION:
@ -880,12 +880,12 @@ int table_next(table_t *table_p,
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the current key. * associated with the current key.
*/ */
extern extern
int table_this(table_t *table_p, int table_this(table_t *table_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_first_r * int table_first_r
* *
* DESCRIPTION: * DESCRIPTION:
@ -929,12 +929,12 @@ int table_this(table_t *table_p,
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the first key. * associated with the first key.
*/ */
extern extern
int table_first_r(table_t *table_p, table_linear_t *linear_p, int table_first_r(table_t *table_p, table_linear_t *linear_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_next_r * int table_next_r
* *
* DESCRIPTION: * DESCRIPTION:
@ -978,12 +978,12 @@ int table_first_r(table_t *table_p, table_linear_t *linear_p,
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the next key. * associated with the next key.
*/ */
extern extern
int table_next_r(table_t *table_p, table_linear_t *linear_p, int table_next_r(table_t *table_p, table_linear_t *linear_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* int table_this_r * int table_this_r
* *
* DESCRIPTION: * DESCRIPTION:
@ -1027,12 +1027,12 @@ int table_next_r(table_t *table_p, table_linear_t *linear_p,
* to the size of the data that is stored in the table and that is * to the size of the data that is stored in the table and that is
* associated with the current key. * associated with the current key.
*/ */
extern extern
int table_this_r(table_t *table_p, table_linear_t *linear_p, int table_this_r(table_t *table_p, table_linear_t *linear_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* table_t *table_mmap * table_t *table_mmap
* *
* DESCRIPTION: * DESCRIPTION:
@ -1052,10 +1052,10 @@ int table_this_r(table_t *table_p, table_linear_t *linear_p,
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_t *table_mmap(const char *path, int *error_p); table_t *table_mmap(const char *path, int *error_p);
/* /*
* int table_munmap * int table_munmap
* *
* DESCRIPTION: * DESCRIPTION:
@ -1070,10 +1070,10 @@ table_t *table_mmap(const char *path, int *error_p);
* *
* table_p - Mmaped table pointer to unmap. * table_p - Mmaped table pointer to unmap.
*/ */
extern extern
int table_munmap(table_t *table_p); int table_munmap(table_t *table_p);
/* /*
* int table_read * int table_read
* *
* DESCRIPTION: * DESCRIPTION:
@ -1095,10 +1095,10 @@ int table_munmap(table_t *table_p);
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_t *table_read(const char *path, int *error_p); table_t *table_read(const char *path, int *error_p);
/* /*
* int table_write * int table_write
* *
* DESCRIPTION: * DESCRIPTION:
@ -1120,10 +1120,10 @@ table_t *table_read(const char *path, int *error_p);
* mode - Mode of the file. This argument is passed on to open when * mode - Mode of the file. This argument is passed on to open when
* the file is created. * the file is created.
*/ */
extern extern
int table_write(const table_t *table_p, const char *path, const int mode); int table_write(const table_t *table_p, const char *path, const int mode);
/* /*
* table_entry_t *table_order * table_entry_t *table_order
* *
* DESCRIPTION: * DESCRIPTION:
@ -1157,11 +1157,11 @@ int table_write(const table_t *table_p, const char *path, const int mode);
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_entry_t **table_order(table_t *table_p, table_compare_t compare, table_entry_t **table_order(table_t *table_p, table_compare_t compare,
int *num_entries_p, int *error_p); int *num_entries_p, int *error_p);
/* /*
* int table_order_free * int table_order_free
* *
* DESCRIPTION: * DESCRIPTION:
@ -1185,11 +1185,11 @@ table_entry_t **table_order(table_t *table_p, table_compare_t compare,
* entry_n - Number of entries in the array as passed back by * entry_n - Number of entries in the array as passed back by
* table_order or table_order_pos in num_entries_p. * table_order or table_order_pos in num_entries_p.
*/ */
extern extern
int table_order_free(table_t *table_p, table_entry_t **table_entries, int table_order_free(table_t *table_p, table_entry_t **table_entries,
const int entry_n); const int entry_n);
/* /*
* int table_entry * int table_entry
* *
* DESCRIPTION: * DESCRIPTION:
@ -1228,12 +1228,12 @@ int table_order_free(table_t *table_p, table_entry_t **table_entries,
* data_size_p - Pointer to an integer which, if not NULL, will be set * data_size_p - Pointer to an integer which, if not NULL, will be set
* to the size of the data that is stored in the table. * to the size of the data that is stored in the table.
*/ */
extern extern
int table_entry(table_t *table_p, table_entry_t *entry_p, int table_entry(table_t *table_p, table_entry_t *entry_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* table_linear_t *table_order_pos * table_linear_t *table_order_pos
* *
* DESCRIPTION: * DESCRIPTION:
@ -1267,11 +1267,11 @@ int table_entry(table_t *table_p, table_entry_t *entry_p,
* error_p - Pointer to an integer which, if not NULL, will contain a * error_p - Pointer to an integer which, if not NULL, will contain a
* table error code. * table error code.
*/ */
extern extern
table_linear_t *table_order_pos(table_t *table_p, table_compare_t compare, table_linear_t *table_order_pos(table_t *table_p, table_compare_t compare,
int *num_entries_p, int *error_p); int *num_entries_p, int *error_p);
/* /*
* int table_order_pos_free * int table_order_pos_free
* *
* DESCRIPTION: * DESCRIPTION:
@ -1295,11 +1295,11 @@ table_linear_t *table_order_pos(table_t *table_p, table_compare_t compare,
* entry_n - Number of entries in the array as passed back by * entry_n - Number of entries in the array as passed back by
* table_order or table_order_pos in num_entries_p. * table_order or table_order_pos in num_entries_p.
*/ */
extern extern
int table_order_pos_free(table_t *table_p, table_linear_t *table_entries, int table_order_pos_free(table_t *table_p, table_linear_t *table_entries,
const int entry_n); const int entry_n);
/* /*
* int table_entry_pos * int table_entry_pos
* *
* DESCRIPTION: * DESCRIPTION:
@ -1338,12 +1338,12 @@ int table_order_pos_free(table_t *table_p, table_linear_t *table_entries,
* data_size_p - Pointer to an integer which, if not NULL, will be set * data_size_p - Pointer to an integer which, if not NULL, will be set
* to the size of the data that is stored in the table. * to the size of the data that is stored in the table.
*/ */
extern extern
int table_entry_pos(table_t *table_p, table_linear_t *linear_p, int table_entry_pos(table_t *table_p, table_linear_t *linear_p,
void **key_buf_p, int *key_size_p, void **key_buf_p, int *key_size_p,
void **data_buf_p, int *data_size_p); void **data_buf_p, int *data_size_p);
/* /*
* const char *table_strerror * const char *table_strerror
* *
* DESCRIPTION: * DESCRIPTION:
@ -1360,13 +1360,24 @@ int table_entry_pos(table_t *table_p, table_linear_t *linear_p,
* *
* error - Error number that we are converting. * error - Error number that we are converting.
*/ */
extern extern
const char *table_strerror(const int error); const char *table_strerror(const int error);
/*<<<<<<<<<< This is end of the auto-generated output from fillproto. */ /*<<<<<<<<<< This is end of the auto-generated output from fillproto. */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* ! __TABLE_H__ */ #endif /* ! __TABLE_H__ */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -227,3 +227,15 @@ static error_str_t errors[] = {
#define INVALID_ERROR "invalid error code" #define INVALID_ERROR "invalid error code"
#endif /* ! __TABLE_LOC_H__ */ #endif /* ! __TABLE_LOC_H__ */
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1766,3 +1766,15 @@ const char *mpool_strerror(const int error)
return "invalid error code"; return "invalid error code";
} }
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -26,12 +26,12 @@
#include <errno.h> /* for setting errno */ #include <errno.h> /* for setting errno */
#include <sys/types.h> #include <sys/types.h>
#ifndef _WIN32 #ifndef _WIN32
/* not in Windows! */ /* not in Windows! */
# include <unistd.h> # include <unistd.h>
# include <stdint.h> # include <stdint.h>
#endif #endif
#ifndef SIMCLIST_NO_DUMPRESTORE #ifndef SIMCLIST_NO_DUMPRESTORE
/* includes for dump/restore */ /* includes for dump/restore */
# include <time.h> # include <time.h>
# include <sys/uio.h> /* for READ_ERRCHECK() and write() */ # include <sys/uio.h> /* for READ_ERRCHECK() and write() */
# include <fcntl.h> /* for open() etc */ # include <fcntl.h> /* for open() etc */
@ -100,7 +100,7 @@ typedef INT64 int64_t;
} while (0); } while (0);
/* convert 64bit integers from host to network format */ /* convert 64bit integers from host to network format */
#define hton64(x) (\ #define hton64(x) ( \
htons(1) == 1 ? \ htons(1) == 1 ? \
(uint64_t)x /* big endian */ \ (uint64_t)x /* big endian */ \
: /* little endian */ \ : /* little endian */ \
@ -1523,3 +1523,13 @@ static int list_attrOk(const list_t *restrict l) {
#endif #endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -627,7 +627,7 @@ static int external_compare(const void *p1, const void *p2,
* *
* err_bp - Pointer to an integer which will be set with 1 if an error * err_bp - Pointer to an integer which will be set with 1 if an error
* has occurred. It cannot be NULL. * has occurred. It cannot be NULL.
*/ */
static int external_compare_pos(const void *p1, const void *p2, static int external_compare_pos(const void *p1, const void *p2,
table_compare_t user_compare, table_compare_t user_compare,
const table_t *table_p, int *err_bp) const table_t *table_p, int *err_bp)
@ -4077,3 +4077,14 @@ const char *table_strerror(const int error)
return INVALID_ERROR; return INVALID_ERROR;
} }
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -293,3 +293,14 @@ int main(int argc, char **argv)
exit(0); exit(0);
} }
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/