zzzjson
zzzjson copied to clipboard
Unused temp values in the zj_strToLong et al
There is an inconsistency in the implementation of the string to number functions.
Only the zj_strToInt function uses the s variable in the string conversion.
The other functions use the input argument.
static inline int zj_strToInt(const char *str, zj_Size len) {
char s[128] = {0};
memcpy(s, str, len);
return atoi(s);
}
static inline long zj_strToLong(const char *str, zj_Size len) {
char s[128] = {0};
memcpy(s, str, len);
return atol(str);
}
static inline long long zj_strToLongLong(const char *str, zj_Size len) {
char s[128] = {0};
memcpy(s, str, len);
return atoll(str);
}
static inline double zj_strToDouble(const char *str, zj_Size len) {
char s[128] = {0};
memcpy(s, str, len);
return atof(str);
}