From f1bcb0126b1a8eb52ea98c20c6708ef8f8d3784c Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Wed, 24 Apr 2024 20:31:34 +0200 Subject: [PATCH] - Minor code cleanup and error log fix. --- include/node.h | 12 ++++++------ lib/libnode.c | 32 ++++++++++++++++---------------- util/ndbench.c | 8 ++++---- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/node.h b/include/node.h index dc9b3d3..ae39b54 100644 --- a/include/node.h +++ b/include/node.h @@ -466,14 +466,14 @@ typedef int NDT_Index_Type; // } // // default: -// { -// printf( "ND_Default_Manager() called with an undefined command %d\n", Command); -// return(NDS_ERRAPI); +// { +// LG_LOG_ERROR_1( "Manager called with an undefined command: (%d)", Command); +// return( NDS_ERRAPI); // } // } // -// printf( "ND_Default_Manager() called with command %d (%s)\n", Command, Command_Name); -// return(NDS_OK); +// LG_LOG_ERROR_2( "Manager internal error with command: (%d) name: [%s]", Command, Command_Name); +// return( NDS_OK); // } @@ -822,7 +822,7 @@ NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *); /*----------------------------------------------------------------------------*/ /* Create a new data structure */ /*----------------------------------------------------------------------------*/ -/* (O) Root_Ptr_Ptr: Pointer adress of the new sata structure */ +/* (O) Root_Ptr_Ptr: Pointer adress of the new data structure */ /* (I) Index_Nb: Number of index */ /* (I) Index_Type_Ptr: Array of Index type (List, tree, ...) */ /* (I) Manager_Name: Manager function name */ diff --git a/lib/libnode.c b/lib/libnode.c index a904679..aae12dd 100644 --- a/lib/libnode.c +++ b/lib/libnode.c @@ -672,7 +672,7 @@ NDT_Status ND_Library_Open_I( int Debug_Mode) LGT_Status lg_status; - NDG_Base.Debug_Mode = Debug_Mode; + NDG_Base.Debug_Mode = Debug_Mode; NDG_Base.Open_Status = NDD_TRUE; if( Debug_Mode == NDD_TRUE) @@ -2079,7 +2079,7 @@ NDT_Status ND_Index_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Index_Id LG_LOG_INFO_0( ""); } - if( ND_RECURSIVE_CHILD_IS(Recursive_Mode)) + if( ND_RECURSIVE_CHILD_IS( Recursive_Mode)) { status = ND_Index_Traverse_I( Root_Ptr, Index_Id, NDD_CMD_INFO_PRINT, Out, NDD_RECURSIVE_MODE_PARENT_CHILD, Recursive_Depth, Recursive_Offset); } @@ -2166,7 +2166,7 @@ NDT_Status ND_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recu status = ND_Index_Info_Print_I( Out, Root_Ptr, idx, NDD_RECURSIVE_MODE_PARENT, 0, Recursive_Offset); if( ND_ERROR( status)) return( status); } - + return( ND_Index_Info_Print_I( Out, Root_Ptr, NDD_INDEX_PRIMARY, NDD_RECURSIVE_MODE_CHILD, Recursive_Depth, Recursive_Offset)); } else @@ -3829,23 +3829,23 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb, status = ND_Allocator_Exec_I( (void **)Root_Ptr_Ptr, ( 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); - strcpy( (*Root_Ptr_Ptr)->Manager_Name, Manager_Name); - (*Root_Ptr_Ptr)->Manager_Ptr = Manager_Ptr; + if( strlen( Manager_Name) > NDD_MANAGER_NAME_LEN_MAX) return( NDS_ERRAPI); + strcpy( ( *Root_Ptr_Ptr)->Manager_Name, Manager_Name); + ( *Root_Ptr_Ptr)->Manager_Ptr = Manager_Ptr; - if( strlen(Allocator_Name) > NDD_ALLOCATOR_NAME_LEN_MAX) return( NDS_ERRAPI); - strcpy( (*Root_Ptr_Ptr)->Allocator_Name, Allocator_Name); - (*Root_Ptr_Ptr)->Allocator_Ptr = Allocator_Ptr; + if( strlen( Allocator_Name) > NDD_ALLOCATOR_NAME_LEN_MAX) return( NDS_ERRAPI); + strcpy( ( *Root_Ptr_Ptr)->Allocator_Name, Allocator_Name); + ( *Root_Ptr_Ptr)->Allocator_Ptr = Allocator_Ptr; - if( strlen(Deallocator_Name) > NDD_DEALLOCATOR_NAME_LEN_MAX) return( NDS_ERRAPI); - strcpy( (*Root_Ptr_Ptr)->Deallocator_Name, Deallocator_Name); - (*Root_Ptr_Ptr)->Deallocator_Ptr = Deallocator_Ptr; + if( strlen( Deallocator_Name) > NDD_DEALLOCATOR_NAME_LEN_MAX) return( NDS_ERRAPI); + strcpy( ( *Root_Ptr_Ptr)->Deallocator_Name, Deallocator_Name); + ( *Root_Ptr_Ptr)->Deallocator_Ptr = Deallocator_Ptr; - (*Root_Ptr_Ptr)->Own_Value = Own_Value; - (*Root_Ptr_Ptr)->User_Ptr = Data_Ptr; + ( *Root_Ptr_Ptr)->Own_Value = Own_Value; + ( *Root_Ptr_Ptr)->User_Ptr = Data_Ptr; - (*Root_Ptr_Ptr)->Index_Nb = Index_Nb; - (*Root_Ptr_Ptr)->Index_Open_Count = 0; + ( *Root_Ptr_Ptr)->Index_Nb = Index_Nb; + ( *Root_Ptr_Ptr)->Index_Open_Count = 0; for( index_id = 0; index_id < Index_Nb; index_id++) { diff --git a/util/ndbench.c b/util/ndbench.c index c6bba1a..c3f572e 100644 --- a/util/ndbench.c +++ b/util/ndbench.c @@ -3,20 +3,20 @@ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ -/* This file is part of LibLog. */ +/* This file is part of LibNode. */ /* */ -/* LibLog is free software: you can redistribute it and/or modify it */ +/* LibNode is free software: you can redistribute it and/or modify it */ /* under the terms of the GNU General Public License as published by */ /* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* */ -/* LibLog is distributed in the hope that it will be useful, */ +/* LibNode is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with Drummer. If not, see . */ +/* along with LibNode. If not, see . */ /*----------------------------------------------------------------------------*/