/[public]/psiconv/trunk/lib/psiconv/list.h
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/list.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 79 Revision 98
56extern psiconv_u32 psiconv_list_length(const psiconv_list l); 56extern psiconv_u32 psiconv_list_length(const psiconv_list l);
57 57
58/* Return 1 if the list is empty, 0 if not */ 58/* Return 1 if the list is empty, 0 if not */
59extern int psiconv_list_is_empty(const psiconv_list l); 59extern int psiconv_list_is_empty(const psiconv_list l);
60 60
61/* Empty a list. Note this does not reclaim any memory space! */
62extern void psiconv_list_empty(psiconv_list l);
63
61/* Get an element from the list, and return a pointer to it. Note: you can 64/* Get an element from the list, and return a pointer to it. Note: you can
62 directly modify this element, but be careful not to write beyond the 65 directly modify this element, but be careful not to write beyond the
63 element memory space. 66 element memory space.
64 If indx is out of range, NULL is returned. */ 67 If indx is out of range, NULL is returned. */
65extern void * psiconv_list_get(const psiconv_list l, psiconv_u32 indx); 68extern void * psiconv_list_get(const psiconv_list l, psiconv_u32 indx);
69 pointers. 72 pointers.
70 As the lists extends itself, it may be necessary to allocate new 73 As the lists extends itself, it may be necessary to allocate new
71 memory. If this fails, a negative error-code is returned. If everything, 74 memory. If this fails, a negative error-code is returned. If everything,
72 succeeds, 0 is returned. */ 75 succeeds, 0 is returned. */
73extern int psiconv_list_add(psiconv_list l, const void *el); 76extern int psiconv_list_add(psiconv_list l, const void *el);
77
78/* Remove the last element from the list, and copy it to el. Note that
79 this will not reduce the amount of space reserved for the list.
80 An error code is returned, which will be 0 zero if everything
81 succeeded. It is your own responsibility to make sure enough
82 space is allocated to el. */
83extern int psiconv_list_pop(psiconv_list l, void *el);
84
85/* Replace an element within the list. The element is copied from the
86 supplied element. Fails if you try to write at or after the end of
87 the list. */
88extern int psiconv_list_replace(psiconv_list l, psiconv_u32 indx,
89 const void *el);
74 90
75/* Do some action for each element. Note: you can directly modify the 91/* Do some action for each element. Note: you can directly modify the
76 elements supplied to action, and they will be changed in the list, 92 elements supplied to action, and they will be changed in the list,
77 but never try a free(el)! */ 93 but never try a free(el)! */
78extern void psiconv_list_foreach_el(psiconv_list l, void action(void *el)); 94extern void psiconv_list_foreach_el(psiconv_list l, void action(void *el));

Legend:
Removed from v.79  
changed lines
  Added in v.98

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26