Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused temp values in the zj_strToLong et al #5

Open
JCash opened this issue Oct 5, 2022 · 0 comments
Open

Unused temp values in the zj_strToLong et al #5

JCash opened this issue Oct 5, 2022 · 0 comments

Comments

@JCash
Copy link

JCash commented Oct 5, 2022

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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant