* lasso/utils.h:
if glib is older than 2.16, export g_strcmp0 as part of internal
headers, in order to use it in login_tests.c
* tests/login_tests.c:
include utils.h
* lasso/utils.h:
- (lasso_assign_new_string,lasso_assign_gobject) if source parameter
is a function call it could be called two times and have unexpected
side effects. Copy the returned value to a temp variable and use it
instead.
* lasso/utils.h: When setting strings using lasso_assing_string or
lasso_assign_new_string, verify that new string is different than the
target value string before deallocating the target.
* lasso/utils.h:
this new macro try to extract a field from a structre (or any
left-hand-side value), try to typecheck it using 'LASSO_IS_XXX',
if succesfull, the value is assigned to the variable given as first
argument or we jump to the 'cleanup' goto label, setting the 4th
argument as the current error code (value of variable 'rc').
* lasso/utils.h: added new macros, renamed others:
- macros handling xmlNode are renamed from _node to _xml_node,
- new macros for assign GList* of specific objects:
- lasso_assign_list_of_gobjects,
- lasso_assign_list_of_strings,
- lasso_assign_new_list_of_gobjects,
- macros for assigning xmlChar string (we need a specific macros
because, we must use xmlFree to release the destination string),
- macros to add string without duping: lasso_list_add_xml_string,
- macros to add anything non-null (no type cast):
lasso_list_add_non_null.
* lasso/utils.h:
- add macro lasso_transfer_string and lasso_transfer_gobject,
to transfer ownership of such objects without copying or
their changing reference count. The old containing variable is
NULLed.
- lasso_list_add_gobject,lasso_list_add_new_gobject: test if the added
object is a GObject, if not do not add it and print a warning.
- lasso_check_type_equality: this macro use special builtin functions
only with GCC (typeof and __builtin_types_compatible_p) and do
metaprogramming using anonymous enumeration type to make compile
time assertions. It is used
- add macros to release XPathObject XPathContext, macro constructor to
make reference transfert macros (free dest, nullify dest, copy src
to dest without increasing refcount, nullify src), add a macro to
transfert xpath objects.
- lasso/utils.c, lasso/utils.h:
New internal api lasso_safe_prefix_string that can show any string
taking care of escaping newlines,tabs and non-graphical ou non-ASCII
characters.
- lasso/utils.h:
- add goto_exit_with_rc a standardized macro that suppose having an
'int rc' variable and an exit label in the current function.
- add lasso_release_output_buffer macro
* lasso/utils.h:
- (lasso_assign_node) This macro wrongly assumes that the destroy
function for xmlNode is xmlFreeNodeList but it's xmlFreeNode.
xmlFreeNodeList is for xmlNode list of children.
remove valgrind errors through python tests.
1. Rename lasso_wsf_profile_new_full for java bindings (cannot subclass
in overrides of static methods).
2. Add const modifiers to many functon signatures in
bindings/python/wrapper_top.c.
3. add initialisation of private_data->encryption_sym_key_type (to
please valgrind) in instance_init of LassoProvider.
4. Add new macro to assign xmlNode, we consider xmlNode to be an
immutable value, and always use xmlCopyNode for assignment. The
macros is called named lasso_assign_node.
5. Fix segfault, when using xmlSec to encrypt the newly created
encrypted node replace the original node inside the xmlDoc structure,
and the original node is freed automatically. So you cannot borrow
the encrypted if you do not remove it from xmlDoc first.
gobject field (work flow, is you augment ref of the new value, decrease the one
from the old, and then assign), assigning strings, releasing lists of strings, of
gobjects,etc..
the free macros are all called g_release_somehting and they set the released
variable to NULL.
add a macro to validate GObject parameter types
This header is intended to concentre every bit of wisdom for handling pointers
and memory, try to use thoses macros in your code.
They are not intended to work with weak references (references you do not own),
so always g_object_ref in this case (or use g_assign_gobject that does it,
when your variable is not needed anymore to g_assign_gobject(var, NULL));