Mercurial > code
comparison array.c @ 17:e9a7b671d707
Use char * instead of void, MSVC does not like void * arithmetic
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 08 Sep 2011 16:55:03 +0200 |
parents | 2d112b8a3756 |
children | ecdf21f1d0c6 |
comparison
equal
deleted
inserted
replaced
16:4212fb4b4e41 | 17:e9a7b671d707 |
---|---|
236 */ | 236 */ |
237 | 237 |
238 static int | 238 static int |
239 array_grow(struct array *arr) | 239 array_grow(struct array *arr) |
240 { | 240 { |
241 if (arr->size / arr->unit > arr->length) | 241 if ((arr->size / arr->unit) > (size_t) arr->length) |
242 return 0; | 242 return 0; |
243 | 243 |
244 if (arr->flags & ARRAY_AUTO) { | 244 if (arr->flags & ARRAY_AUTO) { |
245 if (!(arr->data = realloc(arr->data, arr->size + | 245 if (!(arr->data = realloc(arr->data, arr->size + |
246 SIZE(arr->bsize)))) | 246 SIZE(arr->bsize)))) |
247 return -1; | 247 return -1; |
248 | 248 |
249 arr->size += SIZE(arr->bsize); | 249 arr->size += SIZE(arr->bsize); |
250 } else | 250 } else |
251 return ((arr->size / arr->unit) <= arr->length) ? -1 : 0; | 251 return ((arr->size / arr->unit) <= (size_t) arr->length) ? -1 : 0; |
252 | 252 |
253 return 0; | 253 return 0; |
254 } | 254 } |