Rename Index_Open_Nb intoIndex_Open_Count,

Fix bug in ND_Node_Root_Alloc() on Index_Open_Count handling.
This commit is contained in:
agibert 2002-02-25 23:34:36 +00:00
parent 724109a537
commit 86b1498a2e
2 changed files with 14 additions and 16 deletions

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $RCSfile: node.h,v $ */ /* $RCSfile: node.h,v $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $Revision: 2.1 $ */ /* $Revision: 2.2 $ */
/* $Name: $ */ /* $Name: $ */
/* $Date: 2001/11/28 13:43:50 $ */ /* $Date: 2002/02/25 23:34:36 $ */
/* $Author: agibert $ */ /* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -254,7 +254,7 @@ typedef struct NDT_Root
void *User; /* Pointeur utilisable librement par l'utilisateur */ void *User; /* Pointeur utilisable librement par l'utilisateur */
NDT_Index_Nb Index_Nb; NDT_Index_Nb Index_Nb;
NDT_Index_Nb Index_Open_Nb; NDT_Index_Nb Index_Open_Count;
NDT_Index Index_Tab[0]; NDT_Index Index_Tab[0];
} NDT_Root; } NDT_Root;

View File

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.c,v $ */ /* $RCSfile: libnode.c,v $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* $Revision: 2.0 $ */ /* $Revision: 2.1 $ */
/* $Name: $ */ /* $Name: $ */
/* $Date: 2001/11/26 14:23:50 $ */ /* $Date: 2002/02/25 23:34:36 $ */
/* $Author: agibert $ */ /* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
@ -12,7 +12,7 @@
#include <libnode.h> #include <libnode.h>
#ifdef _LIBVER #ifdef _LIBVER
VER_INFO_EXPORT (libnode,"$Revision: 2.0 $", "$Name: $",__FILE__,"$Author: agibert $") VER_INFO_EXPORT (libnode,"$Revision: 2.1 $", "$Name: $",__FILE__,"$Author: agibert $")
#endif #endif
@ -42,7 +42,7 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
Command_Name = "NDD_CMD_MANAGER_VERSION"; Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.0 $ $Name: $ $Date: 2001/11/26 14:23:50 $ $Author: agibert $"; *Version_Name_Ptr = "$Revision: 2.1 $ $Name: $ $Date: 2002/02/25 23:34:36 $ $Author: agibert $";
return( NDS_OK); return( NDS_OK);
} }
@ -463,7 +463,7 @@ NDT_Status ND_Index_Open_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_In
NDT_Node *node_ptr; NDT_Node *node_ptr;
if( ( Root_Ptr->Index_Open_Nb == 0) && ( Index_Id != NDD_INDEX_PRIMARY)) if( ( Root_Ptr->Index_Open_Count == 0) && ( Index_Id != NDD_INDEX_PRIMARY))
{ {
sprintf( ND_Error_Msg, "Error ND_Index_Open_I: fist opened index should be the primary"); sprintf( ND_Error_Msg, "Error ND_Index_Open_I: fist opened index should be the primary");
ND_Error_Print(); ND_Error_Print();
@ -483,7 +483,7 @@ NDT_Status ND_Index_Open_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_In
Root_Ptr->Index_Tab[Index_Id].Min_Depth = NDD_HUGE_LONG; Root_Ptr->Index_Tab[Index_Id].Min_Depth = NDD_HUGE_LONG;
Root_Ptr->Index_Tab[Index_Id].Nb_Equ = 0; Root_Ptr->Index_Tab[Index_Id].Nb_Equ = 0;
Root_Ptr->Index_Open_Nb++; Root_Ptr->Index_Open_Count++;
if( Index_Id != NDD_INDEX_PRIMARY) if( Index_Id != NDD_INDEX_PRIMARY)
{ {
@ -655,7 +655,7 @@ NDT_Status ND_Index_Close_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id)
NDT_Status status; NDT_Status status;
if( ( Root_Ptr->Index_Open_Nb != 1) && ( Index_Id == NDD_INDEX_PRIMARY)) if( ( Root_Ptr->Index_Open_Count != 1) && ( Index_Id == NDD_INDEX_PRIMARY))
{ {
sprintf( ND_Error_Msg, "Error ND_Index_Close_I: the primary should be the last closed"); sprintf( ND_Error_Msg, "Error ND_Index_Close_I: the primary should be the last closed");
ND_Error_Print(); ND_Error_Print();
@ -667,7 +667,7 @@ NDT_Status ND_Index_Close_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id)
Root_Ptr->Index_Tab[ Index_Id].Type = Root_Ptr->Index_Tab[ Index_Id].Type & NDD_INDEX_STATUS_RMSK | NDD_INDEX_STATUS_CLOSED; Root_Ptr->Index_Tab[ Index_Id].Type = Root_Ptr->Index_Tab[ Index_Id].Type & NDD_INDEX_STATUS_RMSK | NDD_INDEX_STATUS_CLOSED;
Root_Ptr->Index_Open_Nb--; Root_Ptr->Index_Open_Count--;
return(NDS_OK); return(NDS_OK);
} }
@ -1712,8 +1712,8 @@ NDT_Status ND_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recu
status = ND_Manager_Exec_I( Root_Ptr, NDD_INDEX_UNKNOWN, NULL, NDD_CMD_MANAGER_VERSION, &version_name); status = ND_Manager_Exec_I( Root_Ptr, NDD_INDEX_UNKNOWN, NULL, NDD_CMD_MANAGER_VERSION, &version_name);
if( ND_ERROR( status)) return( status); if( ND_ERROR( status)) return( status);
printf( "%sRoot: (%s%p)\tIndex Nb: (%d)\tIndex Opened: (%d)\tManager: (%s%p) [%s]\n%sAllocator: (%s%p) [%s]\tDesallocator: (%s%p) [%s]\tUser: (%s%p)\n%sManager Version: [%s]\n\n", printf( "%sRoot: (%s%p)\tIndex Nb: (%d)\tIndex Open Count: (%d)\tManager: (%s%p) [%s]\n%sAllocator: (%s%p) [%s]\tDesallocator: (%s%p) [%s]\tUser: (%s%p)\n%sManager Version: [%s]\n\n",
offset, NDD_PRINTF_PTR_PREFIX, Root_Ptr, Root_Ptr->Index_Nb, Root_Ptr->Index_Open_Nb, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Manager_Ptr, Root_Ptr->Manager_Name, offset, NDD_PRINTF_PTR_PREFIX, Root_Ptr, Root_Ptr->Index_Nb, Root_Ptr->Index_Open_Count, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Manager_Ptr, Root_Ptr->Manager_Name,
offset, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Allocator_Ptr, Root_Ptr->Allocator_Name, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Desallocator_Ptr, Root_Ptr->Desallocator_Name, NDD_PRINTF_PTR_PREFIX, Root_Ptr->User, offset, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Allocator_Ptr, Root_Ptr->Allocator_Name, NDD_PRINTF_PTR_PREFIX, Root_Ptr->Desallocator_Ptr, Root_Ptr->Desallocator_Name, NDD_PRINTF_PTR_PREFIX, Root_Ptr->User,
offset, version_name); offset, version_name);
} }
@ -3424,7 +3424,7 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
(*Root_Ptr_Ptr)->User = Data_Ptr; (*Root_Ptr_Ptr)->User = Data_Ptr;
(*Root_Ptr_Ptr)->Index_Nb = Index_Nb; (*Root_Ptr_Ptr)->Index_Nb = Index_Nb;
(*Root_Ptr_Ptr)->Index_Open_Nb = 0; (*Root_Ptr_Ptr)->Index_Open_Count = 0;
for( index_id = 0; index_id <= Index_Nb; index_id++) for( index_id = 0; index_id <= Index_Nb; index_id++)
{ {
@ -3434,8 +3434,6 @@ NDT_Status ND_Node_Root_Alloc( NDT_Root **Root_Ptr_Ptr, NDT_Index_Nb Index_Nb,
{ {
status = ND_Index_Open_I( *Root_Ptr_Ptr, index_id, Type_Ptr[index_id]); status = ND_Index_Open_I( *Root_Ptr_Ptr, index_id, Type_Ptr[index_id]);
if( ND_ERROR( status)) return( status); if( ND_ERROR( status)) return( status);
(*Root_Ptr_Ptr)->Index_Open_Nb++;
} }
} }