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

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

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

Revision 62 Revision 71
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.
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*/ 18*/
19 19
20 20
21#include "config.h" 21#include "config.h"
22#include "compat.h"
22#include <stddef.h> 23#include <stddef.h>
23#include <stdlib.h> 24#include <stdlib.h>
24#include <stdio.h> 25#include <stdio.h>
25#include "list.h" 26#include "list.h"
26#include "error.h" 27#include "error.h"
78 return NULL; 79 return NULL;
79 else 80 else
80 return ((char *) (l->els)) + indx * l->el_size; 81 return ((char *) (l->els)) + indx * l->el_size;
81} 82}
82 83
83int psiconv_list_add(psiconv_list l, void *el) 84int psiconv_list_add(psiconv_list l, const void *el)
84{ 85{
85 if (psiconv_list_resize(l,l->cur_len + 1)) 86 if (psiconv_list_resize(l,l->cur_len + 1))
86 return -PSICONV_E_NOMEM; 87 return -PSICONV_E_NOMEM;
87 memcpy(((char *) (l->els)) + l->cur_len * l->el_size, el, l->el_size); 88 memcpy(((char *) (l->els)) + l->cur_len * l->el_size, el, l->el_size);
88 l->cur_len ++; 89 l->cur_len ++;
134 l->els = temp; 135 l->els = temp;
135 return 0; 136 return 0;
136 } else 137 } else
137 return -PSICONV_E_NOMEM; 138 return -PSICONV_E_NOMEM;
138 } 139 }
140 return 0;
139} 141}
140 142

Legend:
Removed from v.62  
changed lines
  Added in v.71

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