… | |
… | |
67 | supplied element. Of course, this does not help if the element contains |
67 | supplied element. Of course, this does not help if the element contains |
68 | pointers. |
68 | pointers. |
69 | As the lists extends itself, it may be necessary to allocate new |
69 | As the lists extends itself, it may be necessary to allocate new |
70 | memory. If this fails, a negative error-code is returned. If everything, |
70 | memory. If this fails, a negative error-code is returned. If everything, |
71 | succeeds, 0 is returned. */ |
71 | succeeds, 0 is returned. */ |
72 | extern int psiconv_list_add(psiconv_list l, void *el); |
72 | extern int psiconv_list_add(psiconv_list l, const void *el); |
73 | |
73 | |
74 | /* Do some action for each element. Note: you can directly modify the |
74 | /* Do some action for each element. Note: you can directly modify the |
75 | elements supplied to action, and they will be changed in the list, |
75 | elements supplied to action, and they will be changed in the list, |
76 | but never try a free(el)! */ |
76 | but never try a free(el)! */ |
77 | extern void psiconv_list_foreach_el(psiconv_list l, void action(void *el)); |
77 | extern void psiconv_list_foreach_el(psiconv_list l, void action(void *el)); |
… | |
… | |
85 | Returned is the actual number of elements added. This assumes the file |
85 | Returned is the actual number of elements added. This assumes the file |
86 | layout and the memory layout of elements is the same. Note that if |
86 | layout and the memory layout of elements is the same. Note that if |
87 | not enough memory could be allocated, 0 is simply returned. */ |
87 | not enough memory could be allocated, 0 is simply returned. */ |
88 | extern size_t psiconv_list_fread(psiconv_list l,size_t size, FILE *f); |
88 | extern size_t psiconv_list_fread(psiconv_list l,size_t size, FILE *f); |
89 | |
89 | |
|
|
90 | /* Read the whole file f to list l. Returns 0 on succes, and an errorcode |
|
|
91 | on failure. */ |
|
|
92 | extern int psiconv_list_fread_all(psiconv_list l, FILE *f); |
|
|
93 | |
|
|
94 | /* Write the whole list l to the opened file f. Returns 0 on succes, and |
|
|
95 | an errorcode on failure. */ |
|
|
96 | extern int psiconv_list_fwrite_all(const psiconv_list l, FILE *f); |
|
|
97 | |
|
|
98 | /* Concatenate two lists. The element sized does not have to be the same, |
|
|
99 | but the result may be quite unexpected if it is not. */ |
|
|
100 | int psiconv_list_concat(psiconv_list l, const psiconv_list extra); |
|
|
101 | |
90 | |
102 | |
91 | #ifdef __cplusplus |
103 | #ifdef __cplusplus |
92 | } |
104 | } |
93 | #endif /* __cplusplus */ |
105 | #endif /* __cplusplus */ |
94 | |
106 | |