- fix a bug in ND_DataStruct_Value_Remove() call in ndbech.

This commit is contained in:
Arnaud G. GIBERT 2024-04-28 17:29:28 +02:00
parent f1bcb0126b
commit e919b5d83c

View File

@ -465,6 +465,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
Command_Name = "NDD_CMD_VALUE_REMOVE";
return( NDS_OK);
}
@ -543,8 +544,8 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
default:
{
printf( "Module_Manager() called with an undefined command %d\n", Command);
return( NDS_ERRAPI);
}
}
@ -937,7 +938,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
while( i < j)
{
if( ND_Value_Alloc( (void **)&Module_Ptr, *DS_Ptr_Ptr, "x", i) == NDS_OK)
if( ND_Value_Alloc( (void **)&Module_Ptr, *DS_Ptr_Ptr, "x", i) == NDS_OK)
{
ND_DataStruct_Value_Add( *DS_Ptr_Ptr, Module_Ptr);
}
@ -959,7 +960,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
while( i > j)
{
if( ND_Value_Alloc( (void **)&Module_Ptr, *DS_Ptr_Ptr, "x", i) == NDS_OK)
if( ND_Value_Alloc( (void **)&Module_Ptr, *DS_Ptr_Ptr, "x", i) == NDS_OK)
{
ND_DataStruct_Value_Add( *DS_Ptr_Ptr, Module_Ptr);
}
@ -1013,9 +1014,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
{
Ref_Module.Id = i;
if( ( ND_DataStruct_Value_Find( (void **)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module) == NDS_OK) && ( Module_Ptr != NULL))
if( ( ND_DataStruct_Value_Find( (void **)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module) == NDS_OK) && ( Module_Ptr != NULL))
{
if( ND_DataStruct_Value_Remove( *DS_Ptr_Ptr, (void **)&Module_Ptr) == NDS_OK)
if( ND_DataStruct_Value_Remove( *DS_Ptr_Ptr, (void *)Module_Ptr) == NDS_OK)
{
nb_removed++;
ND_Value_Free( *DS_Ptr_Ptr, Module_Ptr);
@ -1035,9 +1036,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
{
Ref_Module.Id = i;
if( ( ND_DataStruct_Value_Find( (void **)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module) == NDS_OK) && ( Module_Ptr != NULL))
if( ( ND_DataStruct_Value_Find( (void **)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module) == NDS_OK) && ( Module_Ptr != NULL))
{
if( ND_DataStruct_Value_Remove( *DS_Ptr_Ptr, (void **)&Module_Ptr) == NDS_OK)
if( ND_DataStruct_Value_Remove( *DS_Ptr_Ptr, (void *)Module_Ptr) == NDS_OK)
{
nb_removed++;
ND_Value_Free( *DS_Ptr_Ptr, Module_Ptr);
@ -1084,7 +1085,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
while( i < j)
{
Ref_Module.Id = low + (int)( (double)( high - low) * rand() / ( RAND_MAX + 1.0));
ND_DataStruct_Value_Find( (void *)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module);
ND_DataStruct_Value_Find( (void *)&Module_Ptr, *DS_Ptr_Ptr, &Ref_Module);
i++;
}