1 | /* |
1 | /* |
2 | list.c - Part of psiconv, a PSION 5 file formats converter |
2 | list.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
78 | return NULL; |
78 | return NULL; |
79 | else |
79 | else |
80 | return ((char *) (l->els)) + indx * l->el_size; |
80 | return ((char *) (l->els)) + indx * l->el_size; |
81 | } |
81 | } |
82 | |
82 | |
83 | int psiconv_list_add(psiconv_list l, void *el) |
83 | int psiconv_list_add(psiconv_list l, const void *el) |
84 | { |
84 | { |
85 | if (psiconv_list_resize(l,l->cur_len + 1)) |
85 | if (psiconv_list_resize(l,l->cur_len + 1)) |
86 | return -PSICONV_E_NOMEM; |
86 | return -PSICONV_E_NOMEM; |
87 | memcpy(((char *) (l->els)) + l->cur_len * l->el_size, el, l->el_size); |
87 | memcpy(((char *) (l->els)) + l->cur_len * l->el_size, el, l->el_size); |
88 | l->cur_len ++; |
88 | l->cur_len ++; |
… | |
… | |
134 | l->els = temp; |
134 | l->els = temp; |
135 | return 0; |
135 | return 0; |
136 | } else |
136 | } else |
137 | return -PSICONV_E_NOMEM; |
137 | return -PSICONV_E_NOMEM; |
138 | } |
138 | } |
|
|
139 | return 0; |
139 | } |
140 | } |
140 | |
141 | |