diff --git a/include/node.h b/include/node.h index 946e030..0d1ede3 100644 --- a/include/node.h +++ b/include/node.h @@ -680,6 +680,8 @@ typedef int NDT_Recursive_Offset; # define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VI # define ND_DataStruct_Traverse ND_DataStruct_Traverse_I # define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_I +# define ND_DataStruct_Alloc ND_DataStruct_Alloc_I +# define ND_DataStruct_Free ND_DataStruct_Free_I # define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_I # define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_I # define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_I @@ -734,6 +736,8 @@ typedef int NDT_Recursive_Offset; # define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VC # define ND_DataStruct_Traverse ND_DataStruct_Traverse_C # define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_C +# define ND_DataStruct_Alloc ND_DataStruct_Alloc_C +# define ND_DataStruct_Free ND_DataStruct_Free_C # define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_C # define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_C # define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_C @@ -936,6 +940,33 @@ NDD_DLL_API NDT_Status ND_DataStruct_Info_Print_C( FILE *, NDT_Root *, NDT_Re +/*----------------------------------------------------------------------------*/ +/* Alloc memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (O) Memory_Ptr_Ptr: Memory pointer address */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Size: Allocation size */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDD_DLL_API NDT_Status ND_DataStruct_Alloc_I( void **, NDT_Root *, size_t, void *); +NDD_DLL_API NDT_Status ND_DataStruct_Alloc_C( void **, NDT_Root *, size_t, void *); + + + +/*----------------------------------------------------------------------------*/ +/* Free memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (I) Memory_Ptr: Memory pointer */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDD_DLL_API NDT_Status ND_DataStruct_Free_I( void *, NDT_Root *, void *); +NDD_DLL_API NDT_Status ND_DataStruct_Free_C( void *, NDT_Root *, void *); + + + /*----------------------------------------------------------------------------*/ /* Add a new value to a data structure */ /*----------------------------------------------------------------------------*/ diff --git a/lib/libnode.c b/lib/libnode.c index 21e7d9e..61dd9c8 100644 --- a/lib/libnode.c +++ b/lib/libnode.c @@ -2202,6 +2202,78 @@ NDT_Status ND_DataStruct_Info_Print_C( FILE *Out, NDT_Root *Root_Ptr, NDT_Rec +/*----------------------------------------------------------------------------*/ +/* Alloc memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (O) Memory_Ptr_Ptr: Memory pointer address */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Size: Allocation size */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDT_Status ND_DataStruct_Alloc_I( void **Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, void *Data_Ptr) +{ + return( ND_Allocator_Exec_I( Ptr_Ptr, Root_Ptr, Size, Root_Ptr->Allocator_Name, Root_Ptr->Allocator_Ptr, Data_Ptr)); +} + + + + + +/*----------------------------------------------------------------------------*/ +/* Alloc memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (O) Memory_Ptr_Ptr: Memory pointer address */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Size: Allocation size */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDT_Status ND_DataStruct_Alloc_C( void **Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, void *Data_Ptr) +{ + return( ND_Allocator_Exec_I( Ptr_Ptr, Root_Ptr, Size, Root_Ptr->Allocator_Name, Root_Ptr->Allocator_Ptr, Data_Ptr)); +} + + + + + +/*----------------------------------------------------------------------------*/ +/* Free memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (I) Memory_Ptr: Memory pointer */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDT_Status ND_DataStruct_Free_I( void *Ptr, NDT_Root *Root_Ptr, void *Data_Ptr) +{ + return( ND_Deallocator_Exec_I( Ptr, Root_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Data_Ptr)); +} + + + + + +/*----------------------------------------------------------------------------*/ +/* Free memory unsing data structure allocator - Manager function */ +/*----------------------------------------------------------------------------*/ +/* (I) Memory_Ptr: Memory pointer */ +/* (I) Root_Ptr: Data structure pointer */ +/* (I) Allocator_Name: Value deallocator function name */ +/* (I) Allocator_Ptr: Value deallocator function pointer */ +/* (I) Data_Ptr: User pointer */ +/*----------------------------------------------------------------------------*/ + +NDT_Status ND_DataStruct_Free_C( void *Ptr, NDT_Root *Root_Ptr, void *Data_Ptr) +{ + return( ND_Deallocator_Exec_I( Ptr, Root_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Data_Ptr)); +} + + + + + /*----------------------------------------------------------------------------*/ /* Add a new value to a data structure index */ /*----------------------------------------------------------------------------*/