mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-09 15:00:42 +00:00
Refactoring function r_str_isnumber
This commit is contained in:
parent
a3f05a9b1a
commit
4827f58ea6
@ -3354,16 +3354,17 @@ R_API size_t *r_str_split_lines(char *str, size_t *count) {
|
||||
}
|
||||
|
||||
R_API bool r_str_isnumber(const char *str) {
|
||||
if (!str || !*str) {
|
||||
if (!str || (!IS_DIGIT (*str) && *str != '-')) {
|
||||
return false;
|
||||
}
|
||||
bool isnum = IS_DIGIT (*str) || *str == '-';
|
||||
while (isnum && *++str) {
|
||||
|
||||
while (*++str) {
|
||||
if (!IS_DIGIT (*str)) {
|
||||
isnum = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return isnum;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* TODO: optimize to start searching by the end of the string */
|
||||
|
Loading…
Reference in New Issue
Block a user