debug extract num test, before if num test==0, it did not work

This commit is contained in:
2023-10-22 21:27:34 +02:00
parent 199d55639a
commit 7be14d1873
2 changed files with 4 additions and 1 deletions
BIN
View File
Binary file not shown.
+4 -1
View File
@@ -471,6 +471,7 @@ long int extract_num_after_equal_symbole_in_string(char * in_str){
void extract_to_array_TYPE_SIZE_T(char * in_str){ void extract_to_array_TYPE_SIZE_T(char * in_str){
size_t len=strlen(in_str); size_t len=strlen(in_str);
long int val=0, p=10; long int val=0, p=10;
int added=0;/* if the number is 0, without this var , the precedent algo did not work */
for(long i=0; i<len; ++i){ for(long i=0; i<len; ++i){
PRINT_DEBUG("(%s)[%ld]=%c\n",in_str,i,in_str[i]); PRINT_DEBUG("(%s)[%ld]=%c\n",in_str,i,in_str[i]);
if(in_str[i]=='-'){/*we don't need the option name */ if(in_str[i]=='-'){/*we don't need the option name */
@@ -480,16 +481,18 @@ void extract_to_array_TYPE_SIZE_T(char * in_str){
} }
else if(in_str[i] >= '0' && in_str[i] <= '9' ){ else if(in_str[i] >= '0' && in_str[i] <= '9' ){
val = (p * val) + (in_str[i]-'0'); val = (p * val) + (in_str[i]-'0');
added=1;
} }
else{ else{
/* rec val in array */ /* rec val in array */
PRINT_DEBUG("val=(%ld) \n",val); PRINT_DEBUG("val=(%ld) \n",val);
array_TYPE_SIZE_T[cur_array_TYPE_SIZE_T++]=val; array_TYPE_SIZE_T[cur_array_TYPE_SIZE_T++]=val;
val=0; val=0;
added=0;
} }
} }
PRINT_DEBUG("end val=(%ld) \n",val); PRINT_DEBUG("end val=(%ld) \n",val);
if(val) if(added)
array_TYPE_SIZE_T[cur_array_TYPE_SIZE_T++]=val; array_TYPE_SIZE_T[cur_array_TYPE_SIZE_T++]=val;
} }