@@ -833,7 +833,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
833833 state -> current_arr_element_int64 = state -> arr_ptr_int64 [state -> current_arr_index ++ ];
834834 } else {
835835 state -> array_size = va_arg (* args ,int64_t );
836- state -> current_arr_index = 0 ;
836+ state -> current_arr_index = 0 ;
837837 state -> arr_ptr_int64 = va_arg (* args ,int64_t * );
838838 state -> current_arr_element_int64 = state -> arr_ptr_int64 [state -> current_arr_index ++ ];
839839 * count += state -> array_size - 2 ;
@@ -858,7 +858,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
858858 state -> current_arr_element_int64 = (int64_t )temp_val ;
859859 } else {
860860 state -> array_size = va_arg (* args ,int64_t );
861- state -> current_arr_index = 0 ;
861+ state -> current_arr_index = 0 ;
862862 state -> arr_ptr_int16 = va_arg (* args ,int16_t * );
863863 int16_t temp_val = state -> arr_ptr_int16 [state -> current_arr_index ++ ];
864864 state -> current_arr_element_int64 = (int64_t )temp_val ;
@@ -871,7 +871,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
871871 state -> current_arr_element_int64 = (int64_t )temp_val ;
872872 } else {
873873 state -> array_size = va_arg (* args ,int64_t );
874- state -> current_arr_index = 0 ;
874+ state -> current_arr_index = 0 ;
875875 state -> arr_ptr_int8 = va_arg (* args ,int8_t * );
876876 int8_t temp_val = state -> arr_ptr_int8 [state -> current_arr_index ++ ];
877877 state -> current_arr_element_int64 = (int64_t )temp_val ;
@@ -883,7 +883,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
883883 state -> current_arr_element_double = state -> arr_ptr_double [state -> current_arr_index ++ ];
884884 } else {
885885 state -> array_size = va_arg (* args ,int64_t );
886- state -> current_arr_index = 0 ;
886+ state -> current_arr_index = 0 ;
887887 state -> arr_ptr_double = va_arg (* args ,double * );
888888 state -> current_arr_element_double = state -> arr_ptr_double [state -> current_arr_index ++ ];
889889 * count += state -> array_size - 2 ;
@@ -895,7 +895,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
895895 state -> current_arr_element_double = (double )temp_val ;
896896 } else {
897897 state -> array_size = va_arg (* args ,int64_t );
898- state -> current_arr_index = 0 ;
898+ state -> current_arr_index = 0 ;
899899 state -> arr_ptr_float = va_arg (* args ,float * );
900900 float temp_val = state -> arr_ptr_float [state -> current_arr_index ++ ];
901901 state -> current_arr_element_double = (double )temp_val ;
@@ -907,7 +907,7 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
907907 state -> current_arr_element_char_ptr = state -> arr_ptr_charPtr [state -> current_arr_index ++ ];
908908 } else {
909909 state -> array_size = va_arg (* args ,int64_t );
910- state -> current_arr_index = 0 ;
910+ state -> current_arr_index = 0 ;
911911 state -> arr_ptr_charPtr = va_arg (* args ,char * * );
912912 state -> current_arr_element_char_ptr = state -> arr_ptr_charPtr [state -> current_arr_index ++ ];
913913 * count += state -> array_size - 2 ;
@@ -918,19 +918,19 @@ bool check_array_iteration(int* count, int* current_arg_type_int, va_list* args,
918918 state -> current_arr_element_bool = state -> arr_ptr_bool [state -> current_arr_index ++ ];
919919 } else {
920920 state -> array_size = va_arg (* args ,int64_t );
921- state -> current_arr_index = 0 ;
921+ state -> current_arr_index = 0 ;
922922 state -> arr_ptr_bool = va_arg (* args ,bool * );
923923 state -> current_arr_element_bool = state -> arr_ptr_bool [state -> current_arr_index ++ ];
924924 * count += state -> array_size - 2 ;
925925 }
926926 break ;
927- //To DO : handle --> arr[cptr], arr[enumType]
927+ //To DO : handle --> arr[cptr], arr[enumType]
928928 default :
929929 is_array = false;
930930 break ;
931931 }
932932 return is_array ;
933-
933+
934934}
935935char * int_to_format_specifier (int32_t type_as_int ){
936936 switch (type_as_int ){
@@ -1147,7 +1147,7 @@ LFORTRAN_API char* _lcompilers_string_format_fortran(int count, const char* form
11471147 result = (char * )malloc (150 * sizeof (char ));
11481148 sprintf (result , " Runtime Error : Got argument of type (%s), while the format specifier is (%c)\n" ,type ,value [0 ]);
11491149 // Special indication for error --> "\b" to be handled by `lfortran_print` or `lfortran_file_write`
1150- result [0 ] = '\b' ;
1150+ result [0 ] = '\b' ;
11511151 count = 0 ; // Break while loop.
11521152 break ;
11531153 }
@@ -1158,7 +1158,7 @@ LFORTRAN_API char* _lcompilers_string_format_fortran(int count, const char* form
11581158 count -- ;
11591159 char * arg = NULL ;
11601160 if (is_array ){
1161- arg = array_state .current_arr_element_char_ptr ;
1161+ arg = array_state .current_arr_element_char_ptr ;
11621162 } else {
11631163 arg = va_arg (args , char * );
11641164 }
@@ -2032,7 +2032,7 @@ LFORTRAN_API void _lfortran_strcat(char** s1, char** s2, char** dest)
20322032 dest_char [cntr ] = trmn ;
20332033 * dest = & (dest_char [0 ]);
20342034}
2035- // Allocate_allocatable-strings + Extend String -----------------------------------------------------------
2035+ // Allocate_allocatable-strings + Extend String -----------------------------------------------------------
20362036
20372037void extend_string (char * * ptr , int32_t new_size /*Null-Character Counted*/ , int64_t * string_capacity ){
20382038 ASSERT_MSG (string_capacity != NULL , "%s" , "string capacity is NULL" );
@@ -2057,7 +2057,7 @@ LFORTRAN_API void _lfortran_alloc(char** ptr, int32_t desired_size /*Null-Charac
20572057 if (100 < desired_size ){
20582058 inital_capacity = desired_size ;
20592059 } else {
2060- inital_capacity = 100 ;
2060+ inital_capacity = 100 ;
20612061 }
20622062 * ptr = (char * )malloc (inital_capacity );
20632063 * string_capacity = inital_capacity ;
@@ -2082,14 +2082,14 @@ LFORTRAN_API void _lfortran_strcpy_descriptor_string(char** x, char *y, int64_t*
20822082 ASSERT_MSG (((* x != NULL ) && (* x_string_size <= (* x_string_capacity - 1 ))) ||
20832083 (* x == NULL && * x_string_size == 0 && * x_string_capacity == 0 ) , "%s" ,
20842084 "compiler-behavior error : string x_string_capacity < string size" );
2085-
2085+
20862086 if (y == NULL ){
20872087 fprintf (stderr ,
20882088 "Runtime Error : RHS allocatable-character variable must be allocated before assignment.\n" );
20892089 exit (1 );
20902090 }
2091- size_t y_len , x_len ;
2092- y_len = strlen (y );
2091+ size_t y_len , x_len ;
2092+ y_len = strlen (y );
20932093 x_len = y_len ;
20942094
20952095 if (* x == NULL ) {
@@ -2101,7 +2101,7 @@ LFORTRAN_API void _lfortran_strcpy_descriptor_string(char** x, char *y, int64_t*
21012101 }
21022102 }
21032103 int64_t null_character_index = x_len ;
2104- (* x )[null_character_index ] = '\0' ;
2104+ (* x )[null_character_index ] = '\0' ;
21052105 for (size_t i = 0 ; i < x_len ; i ++ ) {
21062106 (* x )[i ] = y [i ];
21072107 }
@@ -2116,7 +2116,7 @@ LFORTRAN_API void _lfortran_strcpy_pointer_string(char** x, char *y)
21162116 exit (1 );
21172117 }
21182118 size_t y_len ;
2119- y_len = strlen (y );
2119+ y_len = strlen (y );
21202120 // A workaround :
21212121 // every LHS string that's not allocatable should have been
21222122 // allocated a fixed-size-memory space that stays there for the whole life time of the program.
@@ -2282,8 +2282,6 @@ LFORTRAN_API void _lfortran_strrepeat(char** s, int32_t n, char** dest)
22822282 int s_len = strlen (* s );
22832283 int trmn_size = sizeof (trmn );
22842284 int f_len = s_len * n ;
2285- if (f_len < 0 )
2286- f_len = 0 ;
22872285 char * dest_char = (char * )malloc (f_len + trmn_size );
22882286 for (int i = 0 ; i < n ; i ++ ) {
22892287 for (int j = 0 ; j < s_len ; j ++ ) {
@@ -2673,10 +2671,10 @@ LFORTRAN_API char* _lfortran_zone() {
26732671 // Windows doesn't provide timezone offset directly, so we calculate it
26742672 TIME_ZONE_INFORMATION tzinfo ;
26752673 DWORD retval = GetTimeZoneInformation (& tzinfo );
2676-
2674+
26772675 // Calculate the total offset in minutes
26782676 int offset_minutes = - tzinfo .Bias ; // Bias is in minutes; negative for UTC+
2679-
2677+
26802678 if (retval == TIME_ZONE_ID_DAYLIGHT ) {
26812679 offset_minutes -= tzinfo .DaylightBias ; // Apply daylight saving if applicable
26822680 } else if (retval == TIME_ZONE_ID_STANDARD ) {
@@ -3651,7 +3649,7 @@ LFORTRAN_API void _lfortran_string_write(char **str_holder, int64_t* size, int64
36513649 char * s = (char * ) malloc (strlen (str )* sizeof (char ) + strlen (end )* sizeof (char ) + 1 );
36523650 sprintf (s , format , str , end );
36533651
3654- if (((* size ) == -1 ) && ((* capacity ) == -1 )){
3652+ if (((* size ) == -1 ) && ((* capacity ) == -1 )){
36553653 _lfortran_strcpy_pointer_string (str_holder , s );
36563654 } else {
36573655 _lfortran_strcpy_descriptor_string (str_holder , s , size , capacity );
0 commit comments