- Add NDT_Root pointer to NDT_Allocator & NDT_Deallocator functions,
- API Break!
This commit is contained in:
@@ -2129,7 +2129,7 @@ NDT_Status ND_Index_Info_Print_C( FILE *Out, NDT_Root *Root_Ptr, NDT_Index_Id
|
||||
/* (I) Recursive_Offset: Curent print out offset */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status ND_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset)
|
||||
NDT_Status ND_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset)
|
||||
{
|
||||
NDT_Status status;
|
||||
NDT_Index_Nb idx;
|
||||
@@ -3544,12 +3544,14 @@ NDT_Status ND_Manager_Exec_C( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_
|
||||
/* Execute an allocator function */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (O) Value_Ptr_Ptr: Value pointer address */
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Size: Allocation size */
|
||||
/* (I) Allocator_Name: Value allocator function name */
|
||||
/* (I) Allocator_Ptr: Value allocator function pointer */
|
||||
/* (I) Data_Ptr: User pointer */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status ND_Allocator_Exec_I( void **Ptr_Ptr, size_t Size, NDT_Allocator_Name Allocator_Name, NDT_Allocator *Allocator_Ptr, void *Data_Ptr)
|
||||
NDT_Status ND_Allocator_Exec_I( void **Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, NDT_Allocator_Name Allocator_Name, NDT_Allocator *Allocator_Ptr, void *Data_Ptr)
|
||||
{
|
||||
NDT_Allocator *allocator_ptr;
|
||||
|
||||
@@ -3568,7 +3570,7 @@ NDT_Status ND_Allocator_Exec_I( void **Ptr_Ptr, size_t Size, NDT_Allocator_Na
|
||||
}
|
||||
}
|
||||
|
||||
return allocator_ptr( Ptr_Ptr, Size, Data_Ptr);
|
||||
return( allocator_ptr( Ptr_Ptr, Root_Ptr, Size, Data_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -3579,12 +3581,14 @@ NDT_Status ND_Allocator_Exec_I( void **Ptr_Ptr, size_t Size, NDT_Allocator_Na
|
||||
/* Execute an allocator function */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (O) Value_Ptr_Ptr: Value pointer address */
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Size: Allocation size */
|
||||
/* (I) Allocator_Name: Value allocator function name */
|
||||
/* (I) Allocator_Ptr: Value allocator function pointer */
|
||||
/* (I) Data_Ptr: User pointer */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status ND_Allocator_Exec_C( void **Ptr_Ptr, size_t Size, NDT_Allocator_Name Allocator_Name, NDT_Allocator *Allocator_Ptr, void *Data_Ptr)
|
||||
NDT_Status ND_Allocator_Exec_C( void **Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, NDT_Allocator_Name Allocator_Name, NDT_Allocator *Allocator_Ptr, void *Data_Ptr)
|
||||
{
|
||||
ND_LIBNODE_OPEN_CHECK();
|
||||
|
||||
@@ -3595,7 +3599,7 @@ NDT_Status ND_Allocator_Exec_C( void **Ptr_Ptr, size_t Size, NDT_Allocator_Na
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
|
||||
return( ND_Allocator_Exec_I( Ptr_Ptr, Size, Allocator_Name, Allocator_Ptr, Data_Ptr));
|
||||
return( ND_Allocator_Exec_I( Ptr_Ptr, Root_Ptr, Size, Allocator_Name, Allocator_Ptr, Data_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -3606,12 +3610,13 @@ NDT_Status ND_Allocator_Exec_C( void **Ptr_Ptr, size_t Size, NDT_Allocator_Na
|
||||
/* Execute a deallocator function */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Value_Ptr: Value 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_Deallocator_Exec_I( void *Ptr, NDT_Deallocator_Name Deallocator_Name, NDT_Deallocator *Deallocator_Ptr, void *Data_Ptr)
|
||||
NDT_Status ND_Deallocator_Exec_I( void *Ptr, NDT_Root *Root_Ptr, NDT_Deallocator_Name Deallocator_Name, NDT_Deallocator *Deallocator_Ptr, void *Data_Ptr)
|
||||
{
|
||||
NDT_Deallocator *deallocator_ptr;
|
||||
|
||||
@@ -3630,7 +3635,7 @@ NDT_Status ND_Deallocator_Exec_I( void *Ptr, NDT_Deallocator_Name Deallocator_
|
||||
}
|
||||
}
|
||||
|
||||
return( deallocator_ptr( Ptr, Data_Ptr));
|
||||
return( deallocator_ptr( Ptr, Root_Ptr, Data_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -3641,12 +3646,13 @@ NDT_Status ND_Deallocator_Exec_I( void *Ptr, NDT_Deallocator_Name Deallocator_
|
||||
/* Execute a deallocator function */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Value_Ptr: Value 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_Deallocator_Exec_C( void *Ptr, NDT_Deallocator_Name Deallocator_Name, NDT_Deallocator *Deallocator_Ptr, void *Data_Ptr)
|
||||
NDT_Status ND_Deallocator_Exec_C( void *Ptr, NDT_Root *Root_Ptr, NDT_Deallocator_Name Deallocator_Name, NDT_Deallocator *Deallocator_Ptr, void *Data_Ptr)
|
||||
{
|
||||
ND_LIBNODE_OPEN_CHECK();
|
||||
|
||||
@@ -3657,7 +3663,7 @@ NDT_Status ND_Deallocator_Exec_C( void *Ptr, NDT_Deallocator_Name Deallocator_
|
||||
return( NDS_ERRAPI);
|
||||
}
|
||||
|
||||
return( ND_Deallocator_Exec_I( Ptr, Deallocator_Name, Deallocator_Ptr, Data_Ptr));
|
||||
return( ND_Deallocator_Exec_I( Ptr, Root_Ptr, Deallocator_Name, Deallocator_Ptr, Data_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -3745,7 +3751,7 @@ NDT_Status ND_Node_Alloc( NDT_Root *Root_Ptr, NDT_Node **Node_Ptr_Ptr )
|
||||
NDT_Status rc;
|
||||
|
||||
|
||||
rc = ND_Allocator_Exec_I( (void **)Node_Ptr_Ptr, sizeof(NDT_Node), Root_Ptr->Allocator_Name, Root_Ptr->Allocator_Ptr, Root_Ptr->User_Ptr);
|
||||
rc = ND_Allocator_Exec_I( (void **)Node_Ptr_Ptr, Root_Ptr, sizeof(NDT_Node), Root_Ptr->Allocator_Name, Root_Ptr->Allocator_Ptr, Root_Ptr->User_Ptr);
|
||||
if( ND_ERROR( rc)) return( rc);
|
||||
|
||||
(*Node_Ptr_Ptr)->Root = NULL;
|
||||
@@ -3770,7 +3776,7 @@ NDT_Status ND_Node_Alloc( NDT_Root *Root_Ptr, NDT_Node **Node_Ptr_Ptr )
|
||||
/*----------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Node_Free( NDT_Root *Root_Ptr, NDT_Node *Node_Ptr)
|
||||
{
|
||||
return( ND_Deallocator_Exec_I( Node_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Root_Ptr->User_Ptr));
|
||||
return( ND_Deallocator_Exec_I( Node_Ptr, Root_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Root_Ptr->User_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -3826,7 +3832,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
|
||||
NDT_Index_Id index_id;
|
||||
|
||||
|
||||
status = ND_Allocator_Exec_I( (void **)Root_Ptr_Ptr, ( sizeof( NDT_Root) + sizeof(NDT_Index) * (Index_Nb - 1)), Allocator_Name, Allocator_Ptr, Data_Ptr);
|
||||
status = ND_Allocator_Exec_I( (void **)Root_Ptr_Ptr, NULL, ( sizeof( NDT_Root) + sizeof(NDT_Index) * (Index_Nb - 1)), Allocator_Name, Allocator_Ptr, Data_Ptr);
|
||||
if( ND_ERROR(status)) return( status);
|
||||
|
||||
if( strlen( Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI);
|
||||
@@ -3881,7 +3887,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
|
||||
/*----------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Node_Root_Free( NDT_Root *Root_Ptr)
|
||||
{
|
||||
return( ND_Deallocator_Exec_I( Root_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Root_Ptr->User_Ptr));
|
||||
return( ND_Deallocator_Exec_I( Root_Ptr, NULL, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, Root_Ptr->User_Ptr));
|
||||
}
|
||||
|
||||
|
||||
@@ -4823,7 +4829,7 @@ NDT_Node *ND_Tree_Node_Last_Recursive_Get( NDT_Node *Node_Ptr)
|
||||
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status ND_Default_Allocator( void **Ptr_Ptr, size_t Size, void *Data_Ptr)
|
||||
NDT_Status ND_Default_Allocator( void **Ptr_Ptr, NDT_Root *Root_Ptr, size_t Size, void *Data_Ptr)
|
||||
{
|
||||
*Ptr_Ptr = malloc( Size);
|
||||
|
||||
@@ -4841,7 +4847,7 @@ NDT_Status ND_Default_Allocator( void **Ptr_Ptr, size_t Size, void *Data_Ptr
|
||||
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status ND_Default_Deallocator( void *Ptr, void *Data_Ptr)
|
||||
NDT_Status ND_Default_Deallocator( void *Ptr, NDT_Root *Root_Ptr, void *Data_Ptr)
|
||||
{
|
||||
if( !Ptr) return( NDS_ERRAPI);
|
||||
|
||||
|
||||
@@ -152,12 +152,12 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_C
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Default_Allocator( void **, size_t, void *);
|
||||
NDT_Status ND_Default_Allocator( void **, NDT_Root *, size_t, void *);
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
NDT_Status ND_Default_Deallocator( void *, void *);
|
||||
NDT_Status ND_Default_Deallocator( void *, NDT_Root *, void *);
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Création d'un noeud */
|
||||
|
||||
Reference in New Issue
Block a user