@@ -1910,34 +1910,35 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
19101910
19111911int64_t str_to_int64 (const char * p_item , int64_t int_min , int64_t int_max ,
19121912 int * error , char tsep ) {
1913+ const char * p = p_item ;
19131914 // Skip leading spaces.
1914- while (isspace_ascii (* p_item )) {
1915- ++ p_item ;
1915+ while (isspace_ascii (* p )) {
1916+ ++ p ;
19161917 }
19171918
19181919 // Check that there is a first digit.
1919- if (!has_digit_int (p_item )) {
1920+ if (!has_digit_int (p )) {
19201921 // Error...
19211922 * error = ERROR_NO_DIGITS ;
19221923 return 0 ;
19231924 }
19241925
19251926 char buffer [PROCESSED_WORD_CAPACITY ];
1926- const size_t str_len = strlen (p_item );
1927- if (tsep != '\0' && memchr (p_item , tsep , str_len ) != NULL ) {
1928- const int status = copy_string_without_char (buffer , p_item , str_len , tsep );
1927+ const size_t str_len = strlen (p );
1928+ if (tsep != '\0' && memchr (p , tsep , str_len ) != NULL ) {
1929+ const int status = copy_string_without_char (buffer , p , str_len , tsep );
19291930
19301931 if (status != 0 ) {
19311932 // Word is too big, probably will cause an overflow
19321933 * error = ERROR_OVERFLOW ;
19331934 return 0 ;
19341935 }
19351936
1936- p_item = buffer ;
1937+ p = buffer ;
19371938 }
19381939
19391940 char * endptr ;
1940- int64_t result = strtoll (p_item , & endptr , 10 );
1941+ int64_t result = strtoll (p , & endptr , 10 );
19411942
19421943 // Did we use up all the characters?
19431944 if (!has_only_spaces (endptr )) {
@@ -1958,42 +1959,43 @@ int64_t str_to_int64(const char *p_item, int64_t int_min, int64_t int_max,
19581959
19591960uint64_t str_to_uint64 (uint_state * state , const char * p_item , int64_t int_max ,
19601961 uint64_t uint_max , int * error , char tsep ) {
1962+ const char * p = p_item ;
19611963 // Skip leading spaces.
1962- while (isspace_ascii (* p_item )) {
1963- ++ p_item ;
1964+ while (isspace_ascii (* p )) {
1965+ ++ p ;
19641966 }
19651967
19661968 // Handle sign.
1967- if (* p_item == '-' ) {
1969+ if (* p == '-' ) {
19681970 state -> seen_sint = 1 ;
19691971 * error = 0 ;
19701972 return 0 ;
1971- } else if (* p_item == '+' ) {
1972- p_item ++ ;
1973+ } else if (* p == '+' ) {
1974+ p ++ ;
19731975 }
19741976
19751977 // Check that there is a first digit.
1976- if (!isdigit_ascii (* p_item )) {
1978+ if (!isdigit_ascii (* p )) {
19771979 // Error...
19781980 * error = ERROR_NO_DIGITS ;
19791981 return 0 ;
19801982 }
19811983
19821984 char buffer [PROCESSED_WORD_CAPACITY ];
1983- const size_t str_len = strlen (p_item );
1984- if (tsep != '\0' && memchr (p_item , tsep , str_len ) != NULL ) {
1985- const int status = copy_string_without_char (buffer , p_item , str_len , tsep );
1985+ const size_t str_len = strlen (p );
1986+ if (tsep != '\0' && memchr (p , tsep , str_len ) != NULL ) {
1987+ const int status = copy_string_without_char (buffer , p , str_len , tsep );
19861988
19871989 if (status != 0 ) {
19881990 // Word is too big, probably will cause an overflow
19891991 * error = ERROR_OVERFLOW ;
19901992 return 0 ;
19911993 }
1992- p_item = buffer ;
1994+ p = buffer ;
19931995 }
19941996
19951997 char * endptr ;
1996- uint64_t result = strtoull (p_item , & endptr , 10 );
1998+ uint64_t result = strtoull (p , & endptr , 10 );
19971999
19982000 // Did we use up all the characters?
19992001 if (!has_only_spaces (endptr )) {
0 commit comments