… | |
… | |
21 | be of the same size (solve it with pointers, if needed) */ |
21 | be of the same size (solve it with pointers, if needed) */ |
22 | |
22 | |
23 | #ifndef PSICONV_LIST_H |
23 | #ifndef PSICONV_LIST_H |
24 | #define PSICONV_LIST_H |
24 | #define PSICONV_LIST_H |
25 | |
25 | |
26 | #include <psiconv/general.h> |
|
|
27 | #include <stddef.h> |
26 | #include <stddef.h> |
28 | #include <stdio.h> |
27 | #include <stdio.h> |
|
|
28 | |
|
|
29 | #include <psiconv/general.h> |
29 | |
30 | |
30 | #ifdef __cplusplus |
31 | #ifdef __cplusplus |
31 | extern "C" { |
32 | extern "C" { |
32 | #endif /* __cplusplus */ |
33 | #endif /* __cplusplus */ |
33 | |
34 | |
… | |
… | |
73 | As the lists extends itself, it may be necessary to allocate new |
74 | As the lists extends itself, it may be necessary to allocate new |
74 | memory. If this fails, a negative error-code is returned. If everything, |
75 | memory. If this fails, a negative error-code is returned. If everything, |
75 | succeeds, 0 is returned. */ |
76 | succeeds, 0 is returned. */ |
76 | extern int psiconv_list_add(psiconv_list l, const void *el); |
77 | extern int psiconv_list_add(psiconv_list l, const void *el); |
77 | |
78 | |
|
|
79 | /* Remove the last element from the list, and copy it to el. Note that |
|
|
80 | this will not reduce the amount of space reserved for the list. |
|
|
81 | An error code is returned, which will be 0 zero if everything |
|
|
82 | succeeded. It is your own responsibility to make sure enough |
|
|
83 | space is allocated to el. */ |
|
|
84 | extern int psiconv_list_pop(psiconv_list l, void *el); |
|
|
85 | |
78 | /* Replace an element within the list. The element is copied from the |
86 | /* Replace an element within the list. The element is copied from the |
79 | supplied element. Fails if you try to write at or after the end of |
87 | supplied element. Fails if you try to write at or after the end of |
80 | the list. */ |
88 | the list. */ |
81 | extern int psiconv_list_replace(psiconv_list l, psiconv_u32 indx, |
89 | extern int psiconv_list_replace(psiconv_list l, psiconv_u32 indx, |
82 | const void *el); |
90 | const void *el); |