Hi Bruno. José Marchesi reported that the 'list' and 'oset' container data structures are not really usable in libraries, because they call xalloc_die() when an out-of-memory condition occurs. An xalloc_die() that calls exit() is not usable in a library. An xalloc_die() that calls setjmp or throws a C++ exception would leak memory and would leave things in an inconsistent state.
This fixes it, by allowing the user to use alternative functions (gl_list_nx_create instead of gl_list_create, etc.) that provide an error indicator return value. Thank you very much! :) I updated the libgnupdf code to use the new 'nx' functions, caring about the returned value. Just a little-tiny typo fix: diff --git a/lib/gl_list.h b/lib/gl_list.h index ccbf8a3..9a23975 100644 --- a/lib/gl_list.h +++ b/lib/gl_list.h @@ -304,7 +304,7 @@ extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, #endif ; -/* Add an element add a given position in the list. +/* Add an element at a given position in the list. POSITION must be >= 0 and <= gl_list_size (list). */ #if 0 /* declared in gl_xlist.h */ extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,