On Thu, Aug 7, 2008 at 5:23 PM, solsTiCe d'Hiver <solstice.dhiver@gmail.com> wrote:
for me it is a problem with alpm_list_remove but i am not an expert.
And Dan is an expert so he must be right :)
look at this #include <alpm.h>
int compare_int(const void *a, const void *b) { const int* ia = (const int *)a; const int* ib = (const int *)b; return (*ia > *ib) - (*ia < *ib); }
int main(void) { alpm_list_t *l=NULL; int a=2,a2=2; l= alpm_list_add(l, &a); l= alpm_list_add(l, &a2); void **data=NULL; l = alpm_list_remove(l, &a, compare_int, data); puts("still ok ?"); void **data2; l = alpm_list_remove(l, &a2, compare_int, data2); return 0; }
it only seg fault at the second alpm_list_remove
Indeed, this second example segfault in list_remove. But not your first one, which segfaults on the fn(...) call inside list_remove. And the fn parameter is _alpm_db_cmp. Try this : void *data; l = alpm_list_remove(l, &a, compare_int, &data); void *data2; l = alpm_list_remove(l, &a2, compare_int, &data2);