mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 05:09:43 +00:00
Deprecate the IS_DIGIT/IS_UPPER/IS_LOWER, we have posix ##api
This commit is contained in:
parent
6a0390367a
commit
9293b8250d
@ -170,7 +170,7 @@ static inline RList *sign_vars(RAnalFunction *fcn) {
|
||||
|
||||
// TODO: use primitives from r_types
|
||||
#define ALPH(x) (x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z')
|
||||
#define VALID_TOKEN_CHR(x) (ALPH (x) || IS_DIGIT (x) || x == '_' || x == '*' || x == ' ' || x == '.')
|
||||
#define VALID_TOKEN_CHR(x) (ALPH (x) || isdigit (x) || x == '_' || x == '*' || x == ' ' || x == '.')
|
||||
static bool types_sig_valid(const char *types) {
|
||||
// quick state machine parser to validate types being sent to tcc_compile
|
||||
int state = 0; // before, inside, or after ()
|
||||
|
@ -82,7 +82,7 @@ static int replace(int argc, const char *argv[], char *newstr, ADDR_TYPE type) {
|
||||
}
|
||||
if (!strcmp (ops[i].op, argv[0])) {
|
||||
for (j = k = 0; ops[i].str[j] != '\0'; j++, k++) {
|
||||
if (IS_DIGIT(ops[i].str[j])) {
|
||||
if (isdigit(ops[i].str[j])) {
|
||||
const char *w = argv[ops[i].str[j] - '0'];
|
||||
if (w) {
|
||||
strcpy (newstr + k, w);
|
||||
|
@ -126,7 +126,7 @@ static int countTrailingZeros(ut64 x) {
|
||||
|
||||
R_UNUSED static bool has64reg(const char *str) {
|
||||
char *w = strchr (str, 'x');
|
||||
return (w && IS_DIGIT (w[1]));
|
||||
return (w && isdigit (w[1]));
|
||||
}
|
||||
|
||||
static int calcNegOffset(int n, int shift) {
|
||||
|
@ -309,7 +309,7 @@ static char *subs_var_string(RParse *p, RAnalVarField *var, char *tstr, const ch
|
||||
char *newstr = p->localvar_only
|
||||
? r_str_newf ("%s", var->name)
|
||||
: r_str_newf ("%s %c %s", reg, delta > 0 ? '+' : '-', var->name);
|
||||
if (IS_UPPER (*tstr)) {
|
||||
if (isupper (*tstr)) {
|
||||
char *space = (char *)r_str_rchr (newstr, NULL, ' ');
|
||||
if (space) {
|
||||
*space = 0;
|
||||
@ -402,7 +402,7 @@ static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data
|
||||
if (f && p->varlist) {
|
||||
bpargs = p->varlist (f, 'b');
|
||||
spargs = p->varlist (f, 's');
|
||||
bool ucase = IS_UPPER (*tstr);
|
||||
bool ucase = isupper (*tstr);
|
||||
RAnalVarField *var;
|
||||
bool is64 = f->bits == 64;
|
||||
// NOTE: on arm32 bp is fp
|
||||
|
@ -259,7 +259,7 @@ static bool subvar(RParse *p, RAnalFunction *f, ut64 addr, int oplen, char *data
|
||||
if (f && p->varlist) {
|
||||
RList *bpargs = p->varlist (f, 'b');
|
||||
RList *spargs = p->varlist (f, 's');
|
||||
const bool ucase = IS_UPPER (*tstr);
|
||||
const bool ucase = isupper (*tstr);
|
||||
RAnalVarField *var;
|
||||
r_list_foreach (spargs, iter, var) {
|
||||
st64 delta = p->get_ptr_at
|
||||
|
@ -106,7 +106,7 @@ static int replace(int argc, const char *argv[], char *newstr) {
|
||||
}
|
||||
if (!strcmp (ops[i].op, argv[0])) {
|
||||
for (j = k = 0; ops[i].str[j]; j++, k++) {
|
||||
if (IS_DIGIT (ops[i].str[j])) {
|
||||
if (isdigit (ops[i].str[j])) {
|
||||
int index = ops[i].str[j] - '0';
|
||||
if (index >= 0 && index < argc) {
|
||||
const char *w = argv[index];
|
||||
|
@ -77,7 +77,7 @@ static int replace(int argc, const char *argv[], char *newstr) {
|
||||
}
|
||||
if (!strcmp (ops[i].op, argv[0])) {
|
||||
for (j = k = 0; ops[i].str[j]; j++, k++) {
|
||||
if (IS_DIGIT (ops[i].str[j])) {
|
||||
if (isdigit (ops[i].str[j])) {
|
||||
int index = ops[i].str[j] - '0';
|
||||
if (index >= 0 && index < argc) {
|
||||
const char *w = argv[index];
|
||||
|
@ -89,7 +89,7 @@ static char *findNextNumber(char *op) {
|
||||
if (!*p) {
|
||||
break;
|
||||
}
|
||||
if (!IS_DIGIT (*p)) {
|
||||
if (!isdigit (*p)) {
|
||||
char *t = p;
|
||||
for (; *t && *t != ']'; t++) {
|
||||
;
|
||||
@ -104,10 +104,10 @@ static char *findNextNumber(char *op) {
|
||||
}
|
||||
}
|
||||
if (isSpace) {
|
||||
if (IS_DIGIT (*p)) {
|
||||
if (isdigit (*p)) {
|
||||
return p;
|
||||
}
|
||||
if ((*p == '-') && IS_DIGIT (p[1])) {
|
||||
if ((*p == '-') && isdigit (p[1])) {
|
||||
return p + 1;
|
||||
}
|
||||
}
|
||||
@ -402,7 +402,7 @@ static bool filter(RParse *p, ut64 addr, RFlag *f, RAnalHint *hint, char *data,
|
||||
pnum += 2;
|
||||
}
|
||||
for (; *pnum; pnum++) {
|
||||
if ((is_hex && IS_HEXCHAR (*pnum)) || IS_DIGIT (*pnum)) {
|
||||
if ((is_hex && IS_HEXCHAR (*pnum)) || isdigit (*pnum)) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@ -415,7 +415,7 @@ static bool filter(RParse *p, ut64 addr, RFlag *f, RAnalHint *hint, char *data,
|
||||
pnum += 2;
|
||||
}
|
||||
for (; *pnum; pnum++) {
|
||||
if ((is_hex && IS_HEXCHAR (*pnum)) || IS_DIGIT (*pnum)) {
|
||||
if ((is_hex && IS_HEXCHAR (*pnum)) || isdigit (*pnum)) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -78,10 +78,10 @@ R_API void r_bin_filter_sym(RBinFile *bf, HtPP *ht, ut64 vaddr, RBinSymbol *sym)
|
||||
// extract class information from demangled symbol name
|
||||
char *p = strchr (dn, '.');
|
||||
if (p) {
|
||||
if (IS_UPPER (*dn)) {
|
||||
if (isupper (*dn)) {
|
||||
sym->classname = strdup (dn);
|
||||
sym->classname[p - dn] = 0;
|
||||
} else if (IS_UPPER (p[1])) {
|
||||
} else if (isupper (p[1])) {
|
||||
sym->classname = strdup (p + 1);
|
||||
p = strchr (sym->classname, '.');
|
||||
if (p) {
|
||||
@ -158,7 +158,7 @@ static bool false_positive(const char *str) {
|
||||
}
|
||||
#endif
|
||||
for (i = 0; str[i]; i++) {
|
||||
if (IS_DIGIT (str[i])) {
|
||||
if (isdigit (str[i])) {
|
||||
nm++;
|
||||
} else if (str[i]>='a' && str[i]<='z') {
|
||||
lo++;
|
||||
@ -273,10 +273,10 @@ static bool bin_strfilter(RBin *bin, const char *str) {
|
||||
(in_esc_seq && (ch == 't' || ch == 'n' || ch == 'r'))) {
|
||||
goto loop_end;
|
||||
}
|
||||
if (ch < 0 || !IS_PRINTABLE (ch) || IS_LOWER (ch)) {
|
||||
if (ch < 0 || !IS_PRINTABLE (ch) || islower (ch)) {
|
||||
return false;
|
||||
}
|
||||
if (IS_UPPER (ch)) {
|
||||
if (isupper (ch)) {
|
||||
got_uppercase = true;
|
||||
}
|
||||
loop_end:
|
||||
@ -331,7 +331,7 @@ loop_end:
|
||||
bool prevd = false;
|
||||
for (i = 0; str[i]; i++) {
|
||||
char ch = str[i];
|
||||
if (IS_DIGIT (ch)) {
|
||||
if (isdigit (ch)) {
|
||||
segmentsum = segmentsum*10 + (ch - '0');
|
||||
if (segment == 3) {
|
||||
return true;
|
||||
|
@ -2946,9 +2946,9 @@ static void _enrich_symbol(RBinFile *bf, struct MACH0_(obj_t) *bin, HtPP *symcac
|
||||
r_bin_name_demangled (sym->name, demangled);
|
||||
char *p = strchr (demangled, '.');
|
||||
if (p) {
|
||||
if (IS_UPPER (*demangled)) {
|
||||
if (isupper (*demangled)) {
|
||||
sym->classname = r_str_ndup (demangled, (p - demangled));
|
||||
} else if (IS_UPPER (p[1])) {
|
||||
} else if (isupper (p[1])) {
|
||||
sym->classname = strdup (p + 1);
|
||||
p = strchr (sym->classname, '.');
|
||||
if (p) {
|
||||
|
@ -1095,7 +1095,7 @@ static void get_protocol_list_of_lists(RBinFile *bf, RBinClass *klass, objc_cach
|
||||
}
|
||||
|
||||
static inline const char *skipnum(const char *s) {
|
||||
while (IS_DIGIT (*s)) {
|
||||
while (isdigit (*s)) {
|
||||
s++;
|
||||
}
|
||||
return s;
|
||||
|
@ -119,12 +119,12 @@ static inline bool consume_str_new(RBuffer *b, ut64 bound, ut32 *len_out, char *
|
||||
* lower). Should the original function have a substring of the form "_XX_" we
|
||||
* encode it as "_5F_XX_".
|
||||
*/
|
||||
#define WASM_IS_DIGIT(c) (c >= '0' && c <= '9')
|
||||
#define WASM_IS_ENC_HEX(c) (WASM_IS_DIGIT (c) || (c >= 'A' && c <= 'F'))
|
||||
#define WASM_isdigit(c) (c >= '0' && c <= '9')
|
||||
#define WASM_IS_ENC_HEX(c) (WASM_isdigit (c) || (c >= 'A' && c <= 'F'))
|
||||
#define WASM_AFTER_U_NOT_HEX(str, i) (!WASM_IS_ENC_HEX (str[i + 1]) || !WASM_IS_ENC_HEX (str[i + 2]))
|
||||
#define WASM_AFTER_UNDERSCORE_OK(str, i) (WASM_AFTER_U_NOT_HEX (str, i) || str[i + 3] != '_')
|
||||
#define WASM_IS_ALPH(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
|
||||
#define WASM_IS_OK_EXCEPT__(loc, c) (WASM_IS_ALPH (c) || (loc != 0 && WASM_IS_DIGIT (c))) // C functions can't start with [0-9]
|
||||
#define WASM_IS_OK_EXCEPT__(loc, c) (WASM_IS_ALPH (c) || (loc != 0 && WASM_isdigit (c))) // C functions can't start with [0-9]
|
||||
#define WASM_UNDERSCORE_OK(str, i, max) (str[i] == '_' && (max - i < 4 || WASM_AFTER_UNDERSCORE_OK (str, i)))
|
||||
#define WASM_IS_OK(str, i, max) (WASM_IS_OK_EXCEPT__ (i, str[i]) || WASM_UNDERSCORE_OK (str, i, max))
|
||||
static bool consume_encoded_name_new(RBuffer *b, ut64 bound, ut32 *len_out, char **str_out) {
|
||||
|
@ -107,7 +107,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -204,10 +204,6 @@ static void d_init_info(const char *, int, size_t, struct d_info *);
|
||||
when compiled with -DIN_GLIBCPP_V3: realloc, free, memcpy, strcpy,
|
||||
strcat, strlen. */
|
||||
|
||||
#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
|
||||
#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
|
||||
#define IS_LOWER(c) ((c) >= 'a' && (c) <= 'z')
|
||||
|
||||
/* The prefix prepended by GCC to an identifier represnting the
|
||||
anonymous namespace. */
|
||||
#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_"
|
||||
@ -1234,9 +1230,9 @@ cplus_demangle_mangled_name (struct d_info *di, int top_level)
|
||||
suffix. */
|
||||
if (top_level && (di->options & DMGL_PARAMS) != 0)
|
||||
while (d_peek_char (di) == '.'
|
||||
&& (IS_LOWER (d_peek_next_char (di))
|
||||
&& (islower (d_peek_next_char (di))
|
||||
|| d_peek_next_char (di) == '_'
|
||||
|| IS_DIGIT (d_peek_next_char (di))))
|
||||
|| isdigit (d_peek_next_char (di))))
|
||||
p = d_clone_suffix (di, p);
|
||||
|
||||
return p;
|
||||
@ -1560,8 +1556,8 @@ d_prefix (struct d_info *di)
|
||||
/* Destructor name. */
|
||||
dc = d_unqualified_name (di);
|
||||
}
|
||||
else if (IS_DIGIT (peek)
|
||||
|| IS_LOWER (peek)
|
||||
else if (isdigit (peek)
|
||||
|| islower (peek)
|
||||
|| peek == 'C'
|
||||
|| peek == 'U'
|
||||
|| peek == 'L')
|
||||
@ -1620,9 +1616,9 @@ d_unqualified_name (struct d_info *di)
|
||||
char peek;
|
||||
|
||||
peek = d_peek_char (di);
|
||||
if (IS_DIGIT (peek))
|
||||
if (isdigit (peek))
|
||||
ret = d_source_name (di);
|
||||
else if (IS_LOWER (peek))
|
||||
else if (islower (peek))
|
||||
{
|
||||
if (peek == 'o' && d_peek_next_char (di) == 'n')
|
||||
d_advance (di, 2);
|
||||
@ -1706,7 +1702,7 @@ d_number (struct d_info *di)
|
||||
ret = 0;
|
||||
while (1)
|
||||
{
|
||||
if (! IS_DIGIT (peek))
|
||||
if (! isdigit (peek))
|
||||
{
|
||||
if (negative)
|
||||
ret = - ret;
|
||||
@ -1866,7 +1862,7 @@ d_operator_name (struct d_info *di)
|
||||
|
||||
c1 = d_next_char (di);
|
||||
c2 = d_next_char (di);
|
||||
if (c1 == 'v' && IS_DIGIT (c2))
|
||||
if (c1 == 'v' && isdigit (c2))
|
||||
return d_make_extended_operator (di, c2 - '0', d_source_name (di));
|
||||
else if (c1 == 'c' && c2 == 'v')
|
||||
{
|
||||
@ -2539,9 +2535,9 @@ cplus_demangle_type (struct d_info *di)
|
||||
char peek_next;
|
||||
|
||||
peek_next = d_peek_next_char (di);
|
||||
if (IS_DIGIT (peek_next)
|
||||
if (isdigit (peek_next)
|
||||
|| peek_next == '_'
|
||||
|| IS_UPPER (peek_next))
|
||||
|| isupper (peek_next))
|
||||
{
|
||||
ret = d_substitution (di, 0);
|
||||
/* The substituted name may have been a template name and
|
||||
@ -2672,7 +2668,7 @@ cplus_demangle_type (struct d_info *di)
|
||||
/* Fixed point types. DF<int bits><length><fract bits><sat> */
|
||||
ret = d_make_empty (di);
|
||||
ret->type = DEMANGLE_COMPONENT_FIXED_TYPE;
|
||||
if ((ret->u.s_fixed.accum = IS_DIGIT (d_peek_char (di))))
|
||||
if ((ret->u.s_fixed.accum = isdigit (d_peek_char (di))))
|
||||
/* For demangling we don't care about the bits. */
|
||||
d_number (di);
|
||||
ret->u.s_fixed.length = cplus_demangle_type (di);
|
||||
@ -2980,7 +2976,7 @@ d_array_type (struct d_info *di)
|
||||
peek = d_peek_char (di);
|
||||
if (peek == '_')
|
||||
dim = NULL;
|
||||
else if (IS_DIGIT (peek))
|
||||
else if (isdigit (peek))
|
||||
{
|
||||
const char *s;
|
||||
|
||||
@ -2990,7 +2986,7 @@ d_array_type (struct d_info *di)
|
||||
d_advance (di, 1);
|
||||
peek = d_peek_char (di);
|
||||
}
|
||||
while (IS_DIGIT (peek));
|
||||
while (isdigit (peek));
|
||||
dim = d_make_name (di, s, d_str (di) - s);
|
||||
if (dim == NULL)
|
||||
return NULL;
|
||||
@ -3314,7 +3310,7 @@ d_expression_1 (struct d_info *di)
|
||||
}
|
||||
return d_make_function_param (di, index);
|
||||
}
|
||||
else if (IS_DIGIT (peek)
|
||||
else if (isdigit (peek)
|
||||
|| (peek == 'o' && d_peek_next_char (di) == 'n'))
|
||||
{
|
||||
/* We can get an unqualified name as an expression in the case of
|
||||
@ -3769,16 +3765,16 @@ d_clone_suffix (struct d_info *di, struct demangle_component *encoding)
|
||||
const char *pend = suffix;
|
||||
struct demangle_component *n;
|
||||
|
||||
if (*pend == '.' && (IS_LOWER (pend[1]) || pend[1] == '_'))
|
||||
if (*pend == '.' && (islower (pend[1]) || pend[1] == '_'))
|
||||
{
|
||||
pend += 2;
|
||||
while (IS_LOWER (*pend) || *pend == '_')
|
||||
while (islower (*pend) || *pend == '_')
|
||||
pend++;
|
||||
}
|
||||
while (*pend == '.' && IS_DIGIT (pend[1]))
|
||||
while (*pend == '.' && isdigit (pend[1]))
|
||||
{
|
||||
pend += 2;
|
||||
while (IS_DIGIT (*pend))
|
||||
while (isdigit (*pend))
|
||||
pend++;
|
||||
}
|
||||
d_advance (di, pend - suffix);
|
||||
@ -3853,7 +3849,7 @@ d_substitution (struct d_info *di, int prefix)
|
||||
return NULL;
|
||||
|
||||
c = d_next_char (di);
|
||||
if (c == '_' || IS_DIGIT (c) || IS_UPPER (c))
|
||||
if (c == '_' || isdigit (c) || isupper (c))
|
||||
{
|
||||
unsigned int id;
|
||||
|
||||
@ -3864,9 +3860,9 @@ d_substitution (struct d_info *di, int prefix)
|
||||
{
|
||||
unsigned int new_id;
|
||||
|
||||
if (IS_DIGIT (c))
|
||||
if (isdigit (c))
|
||||
new_id = id * 36 + c - '0';
|
||||
else if (IS_UPPER (c))
|
||||
else if (isupper (c))
|
||||
new_id = id * 36 + c - 'A' + 10;
|
||||
else
|
||||
return NULL;
|
||||
@ -5340,7 +5336,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
|
||||
|
||||
d_append_string (dpi, "operator");
|
||||
/* Add a space before new/delete. */
|
||||
if (IS_LOWER (op->name[0]))
|
||||
if (islower (op->name[0]))
|
||||
d_append_char (dpi, ' ');
|
||||
/* Omit a trailing space. */
|
||||
if (op->name[len-1] == ' ')
|
||||
@ -5785,7 +5781,7 @@ d_print_java_identifier (struct d_print_info *dpi, const char *name, int len)
|
||||
{
|
||||
int dig;
|
||||
|
||||
if (IS_DIGIT (*q))
|
||||
if (isdigit (*q))
|
||||
dig = *q - '0';
|
||||
else if (*q >= 'A' && *q <= 'F')
|
||||
dig = *q - 'A' + 10;
|
||||
@ -6634,7 +6630,7 @@ static void print_usage(FILE* fp, int exit_value);
|
||||
|
||||
/* Non-zero if CHAR is a character than can occur in a mangled name. */
|
||||
#define is_mangled_char(CHAR) \
|
||||
(IS_ALPHA (CHAR) || IS_DIGIT (CHAR) \
|
||||
(IS_ALPHA (CHAR) || isdigit (CHAR) \
|
||||
|| (CHAR) == '_' || (CHAR) == '.' || (CHAR) == '$')
|
||||
|
||||
/* The name of this program, as invoked. */
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <r_util.h>
|
||||
|
||||
#define IS_NAME(x) (IS_LOWER(x) || IS_DIGIT(x) || (x) == '_')
|
||||
#define IS_NAME(x) (islower(x) || isdigit(x) || (x) == '_')
|
||||
|
||||
static char *demangle_freepascal_function(RStrBuf *ds, char *mangled, size_t mangled_len) {
|
||||
char *next = mangled;
|
||||
|
@ -277,7 +277,7 @@ static const char *conformsto(char p) {
|
||||
}
|
||||
|
||||
static bool looks_valid(char p) {
|
||||
if (IS_DIGIT (p)) {
|
||||
if (isdigit (p)) {
|
||||
return true;
|
||||
}
|
||||
switch (p) {
|
||||
@ -684,7 +684,7 @@ moreitems:
|
||||
case 'T':
|
||||
case 'I':
|
||||
p = resolve (types, q + 0, &attr); // type
|
||||
if (p && *p && IS_DIGIT (p[1])) {
|
||||
if (p && *p && isdigit (p[1])) {
|
||||
p--;
|
||||
}
|
||||
break;
|
||||
|
@ -471,7 +471,7 @@ R_API RConfigNode* r_config_set(RConfig *cfg, const char *name, const char *valu
|
||||
}
|
||||
free (node->value);
|
||||
node->value = strdup (value);
|
||||
if (IS_DIGIT (*value) || (value[0] == '-' && IS_DIGIT (value[1]))) {
|
||||
if (isdigit (*value) || (value[0] == '-' && isdigit (value[1]))) {
|
||||
if (strchr (value, '/')) {
|
||||
node->i_value = r_num_get (cfg->num, value);
|
||||
} else {
|
||||
|
@ -1614,7 +1614,7 @@ static int __xterm_get_cur_pos(int *xpos) {
|
||||
(void)r_cons_readchar ();
|
||||
for (i = 0; i < R_ARRAY_SIZE (pos) - 1; i++) {
|
||||
ch = r_cons_readchar ();
|
||||
if ((!i && !IS_DIGIT (ch)) || // dumps arrow keys etc.
|
||||
if ((!i && !isdigit (ch)) || // dumps arrow keys etc.
|
||||
(i == 1 && ch == '~')) { // dumps PgUp, PgDn etc.
|
||||
is_reply = false;
|
||||
break;
|
||||
|
@ -159,7 +159,7 @@ static int cursor_position(const int tty, int *const rowptr, int *const colptr)
|
||||
/* Parse rows. */
|
||||
rows = 0;
|
||||
res = rd (tty);
|
||||
while (IS_DIGIT (res)) {
|
||||
while (isdigit (res)) {
|
||||
rows = 10 * rows + res - '0';
|
||||
res = rd(tty);
|
||||
}
|
||||
@ -174,7 +174,7 @@ static int cursor_position(const int tty, int *const rowptr, int *const colptr)
|
||||
if (res == -1) {
|
||||
break;
|
||||
}
|
||||
while (IS_DIGIT(res)) {
|
||||
while (isdigit(res)) {
|
||||
cols = 10 * cols + res - '0';
|
||||
res = rd(tty);
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ static inline bool is_word_break_char(char ch, BreakMode mode) {
|
||||
}
|
||||
|
||||
static inline void swap_case(int index) {
|
||||
if (IS_UPPER (I.buffer.data[index])) {
|
||||
if (isupper (I.buffer.data[index])) {
|
||||
I.buffer.data[index] += 32;
|
||||
} else if (IS_LOWER (I.buffer.data[index])) {
|
||||
} else if (islower (I.buffer.data[index])) {
|
||||
I.buffer.data[index] -= 32;
|
||||
}
|
||||
}
|
||||
@ -1431,7 +1431,7 @@ static bool __vi_mode(void) {
|
||||
bool o_do_setup_match = I.history.do_setup_match;
|
||||
I.history.do_setup_match = true;
|
||||
ch = r_cons_readchar ();
|
||||
while (IS_DIGIT (ch)) { // handle commands like 3b
|
||||
while (isdigit (ch)) { // handle commands like 3b
|
||||
if (ch == '0' && rep == 0) { // to handle the command 0
|
||||
break;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ R_API void r_cons_grep_expression(const char *str) {
|
||||
} else {
|
||||
grep->sort_invert = false;
|
||||
}
|
||||
while (IS_DIGIT (*ptr)) {
|
||||
while (isdigit (*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
if (*ptr == ':') {
|
||||
@ -333,7 +333,7 @@ R_API void r_cons_grep_expression(const char *str) {
|
||||
|
||||
ptr2 = strchr_ns (ptr, ':'); // line number
|
||||
grep->range_line = 2; // there is not :
|
||||
if (ptr2 && ptr2[1] != ':' && ptr2[1] && (IS_DIGIT (ptr2[1]) || ptr2[1] == '-' || ptr2[1] == '.')) {
|
||||
if (ptr2 && ptr2[1] != ':' && ptr2[1] && (isdigit (ptr2[1]) || ptr2[1] == '-' || ptr2[1] == '.')) {
|
||||
end_ptr = end_ptr? R_MIN (end_ptr, ptr2): ptr2;
|
||||
char *p, *token = ptr2 + 1;
|
||||
p = strstr (token, "..");
|
||||
@ -497,7 +497,7 @@ static int cmp(const void *a, const void *b) {
|
||||
ca = (colsa > ctx->sorted_column)? r_str_word_get0 (da, ctx->sorted_column): "";
|
||||
cb = (colsb > ctx->sorted_column)? r_str_word_get0 (db, ctx->sorted_column): "";
|
||||
}
|
||||
if (IS_DIGIT (*ca) && IS_DIGIT (*cb)) {
|
||||
if (isdigit (*ca) && isdigit (*cb)) {
|
||||
ut64 na = r_num_get (NULL, ca);
|
||||
ut64 nb = r_num_get (NULL, cb);
|
||||
int ret = (na > nb) - (na < nb);
|
||||
|
@ -157,7 +157,7 @@ R_API char *r_cons_html_filter(const char *ptr, int *newlen) {
|
||||
esc = 0;
|
||||
str = ptr;
|
||||
continue;
|
||||
} else if (IS_DIGIT (ptr[0]) && ptr[1] == ';' && IS_DIGIT (ptr[2])) {
|
||||
} else if (isdigit (ptr[0]) && ptr[1] == ';' && isdigit (ptr[2])) {
|
||||
char *m = strchr (ptr, 'm');
|
||||
if (m) {
|
||||
gethtmlrgb (ptr, background_color, sizeof (background_color));
|
||||
@ -166,7 +166,7 @@ R_API char *r_cons_html_filter(const char *ptr, int *newlen) {
|
||||
str = ptr + 1;
|
||||
esc = 0;
|
||||
}
|
||||
} else if (IS_DIGIT (ptr[0]) && IS_DIGIT (ptr[1]) && ptr[2] == ';') {
|
||||
} else if (isdigit (ptr[0]) && isdigit (ptr[1]) && ptr[2] == ';') {
|
||||
char *m = strchr (ptr, 'm');
|
||||
if (m) {
|
||||
gethtmlrgb (ptr, text_color, sizeof (text_color));
|
||||
@ -191,7 +191,7 @@ R_API char *r_cons_html_filter(const char *ptr, int *newlen) {
|
||||
str = ptr + 1;
|
||||
}
|
||||
esc = 0;
|
||||
} else if ((ptr[0] == '0' || ptr[0] == '1') && ptr[1] == ';' && IS_DIGIT (ptr[2])) {
|
||||
} else if ((ptr[0] == '0' || ptr[0] == '1') && ptr[1] == ';' && isdigit (ptr[2])) {
|
||||
// bg color is kind of ignored, but no glitch so far
|
||||
r_cons_gotoxy (0, 0);
|
||||
ptr += 4;
|
||||
|
@ -333,7 +333,7 @@ static bool parse_format(RCore *core, const char *fmt, RVecString *vec) {
|
||||
while (ptr) {
|
||||
ptr++;
|
||||
// strip [width] specifier
|
||||
while (IS_DIGIT (*ptr)) {
|
||||
while (isdigit (*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
r_str_ncpy (arr, ptr, sizeof (arr) - 1);
|
||||
|
@ -29,7 +29,7 @@ R_API bool r_core_file_close_all_but(RCore *core) {
|
||||
|
||||
static bool its_a_mips(RCore *core) {
|
||||
RArchConfig *cfg = core->rasm->config;
|
||||
return cfg && cfg->arch && !strcmp (cfg->arch, "mips");
|
||||
return cfg && cfg->arch && r_str_startswith (cfg->arch, "mips");
|
||||
}
|
||||
|
||||
static void load_gp(RCore *core) {
|
||||
@ -38,7 +38,7 @@ static void load_gp(RCore *core) {
|
||||
ut64 e0 = r_num_math (core->num, "entry0");
|
||||
ut64 gp = r_num_math (core->num, "loc._gp");
|
||||
if ((!gp || gp == UT64_MAX) && (e0 && e0 != UT64_MAX)) {
|
||||
r_core_cmd0 (core, "aeim; s entry0;dr PC=entry0");
|
||||
r_core_cmd0 (core, "aeim;s entry0;dr PC=entry0");
|
||||
r_config_set (core->config, "anal.roregs", "zero"); // gp is writable here
|
||||
r_core_cmd0 (core, "10aes");
|
||||
gp = r_reg_getv (core->anal->reg, "gp");
|
||||
|
@ -3932,7 +3932,7 @@ static bool is_macro_command(const char *ptr) {
|
||||
return false;
|
||||
}
|
||||
ptr = r_str_trim_head_ro (ptr);
|
||||
while (IS_DIGIT (*ptr)) {
|
||||
while (isdigit (*ptr)) {
|
||||
ptr++;
|
||||
}
|
||||
return *ptr == '(';
|
||||
@ -4666,7 +4666,7 @@ repeat:;
|
||||
pipecolor = true;
|
||||
*fdnum = 0;
|
||||
} else {
|
||||
if (IS_DIGIT (*fdnum)) {
|
||||
if (isdigit (*fdnum)) {
|
||||
fdn = *fdnum - '0';
|
||||
}
|
||||
*fdnum = 0;
|
||||
|
@ -2028,7 +2028,7 @@ static int var_cmd(RCore *core, const char *str) {
|
||||
r_anal_function_delete_vars_by_kind (fcn, type);
|
||||
} else {
|
||||
RAnalVar *var = NULL;
|
||||
if (IS_DIGIT (str[2])) {
|
||||
if (isdigit (str[2])) {
|
||||
var = r_anal_function_get_var (fcn, type, (int)r_num_math (core->num, str + 1));
|
||||
} else {
|
||||
char *name = r_str_trim_dup (str + 2);
|
||||
@ -6714,7 +6714,7 @@ void cmd_anal_reg(RCore *core, const char *str) {
|
||||
for (j = i; str[++j] && str[j] != ','; );
|
||||
if (j - i + 1 <= sizeof name) {
|
||||
r_str_ncpy (name, str + i, j - i + 1);
|
||||
if (IS_DIGIT (name[0])) { // e.g. ar 32
|
||||
if (isdigit (name[0])) { // e.g. ar 32
|
||||
__anal_reg_list (core, R_REG_TYPE_GPR, atoi (name), '\0');
|
||||
} else if (showreg (core, name) > 0) {
|
||||
// e.g. ar rax
|
||||
@ -7464,7 +7464,7 @@ static bool myregwrite(REsil *esil, const char *name, ut64 *val) {
|
||||
r_list_pop (stats->regread);
|
||||
R_FREE (oldregread)
|
||||
}
|
||||
if (!IS_DIGIT (*name)) {
|
||||
if (!isdigit (*name)) {
|
||||
if (!contains (stats->regs, name)) {
|
||||
r_list_push (stats->regs, strdup (name));
|
||||
}
|
||||
@ -7482,7 +7482,7 @@ static bool myregwrite(REsil *esil, const char *name, ut64 *val) {
|
||||
|
||||
static bool myregread(REsil *esil, const char *name, ut64 *val, int *len) {
|
||||
AeaStats *stats = esil->user;
|
||||
if (!IS_DIGIT (*name)) {
|
||||
if (!isdigit (*name)) {
|
||||
if (!contains (stats->inputregs, name)) {
|
||||
if (!contains (stats->regwrite, name)) {
|
||||
r_list_push (stats->inputregs, strdup (name));
|
||||
@ -9388,7 +9388,7 @@ static void cmd_anal_opcode(RCore *core, const char *input) {
|
||||
free (ops);
|
||||
}
|
||||
} else if (input[1] == 'l' || input[1] == '=' || input[1] == ' ' || input[1] == 'j') {
|
||||
if (input[1] == ' ' && !IS_DIGIT (input[2])) {
|
||||
if (input[1] == ' ' && !isdigit (input[2])) {
|
||||
r_cons_printf ("%d\n", r_asm_mnemonics_byname (core->rasm, input + 2));
|
||||
} else {
|
||||
// "aoml"
|
||||
|
@ -1902,7 +1902,7 @@ static int cmd_debug_map(RCore *core, const char *input) {
|
||||
sectname = r_str_word_get0 (ptr, 1);
|
||||
/* fallthrou */
|
||||
case 1: // get addr|libname
|
||||
if (IS_DIGIT (*ptr)) {
|
||||
if (isdigit (*ptr)) {
|
||||
const char *a0 = r_str_word_get0 (ptr, 0);
|
||||
addr = r_num_math (core->num, a0);
|
||||
} else {
|
||||
|
@ -863,7 +863,7 @@ static void cmd_open_banks(RCore *core, int argc, char *argv[]) {
|
||||
case '+': // "omb+ [name]"
|
||||
{
|
||||
const char *name = argv[0] + 2;
|
||||
if (IS_DIGIT (*name)) {
|
||||
if (isdigit (*name)) {
|
||||
// add a map to the current bank
|
||||
// we cant name a bank with a number :?
|
||||
r_io_bank_map_add_top (core->io, core->io->bank, atoi (name));
|
||||
@ -885,7 +885,7 @@ static void cmd_open_banks(RCore *core, int argc, char *argv[]) {
|
||||
}
|
||||
switch (argv[0][1]) {
|
||||
case 'a': // "omba"
|
||||
if (IS_DIGIT (argv[1][0])) {
|
||||
if (isdigit (argv[1][0])) {
|
||||
int mapid = atoi (argv[1]);
|
||||
if (r_io_map_get (core->io, mapid)) {
|
||||
r_io_bank_map_add_top (core->io, core->io->bank, mapid);
|
||||
|
@ -1789,7 +1789,7 @@ static void r_core_cmd_print_binformat(RCore *core, const char *arg, int mode) {
|
||||
RList *lart = lart_new ();
|
||||
|
||||
while (*arg && *arg != ' ') {
|
||||
if (IS_DIGIT (*arg)) {
|
||||
if (isdigit (*arg)) {
|
||||
n = atoi (arg);
|
||||
if (n > 64) {
|
||||
R_LOG_ERROR ("Too large. Max is 64");
|
||||
@ -1797,7 +1797,7 @@ static void r_core_cmd_print_binformat(RCore *core, const char *arg, int mode) {
|
||||
r_bitmap_free (bm);
|
||||
return;
|
||||
}
|
||||
while (IS_DIGIT (*arg)) {
|
||||
while (isdigit (*arg)) {
|
||||
arg += 1;
|
||||
}
|
||||
arg--;
|
||||
@ -5574,7 +5574,7 @@ static ut8 *decode_text(RCore *core, ut64 offset, size_t len, bool zeroend) {
|
||||
static bool cmd_pi(RCore *core, const char *input, int len, int l, ut8 *block) {
|
||||
// len is block_len
|
||||
char ch = input[1];
|
||||
if (ch == '+' || ch == '-' || IS_DIGIT (ch)) {
|
||||
if (ch == '+' || ch == '-' || isdigit (ch)) {
|
||||
ch = ' ';
|
||||
l = r_num_math (core->num, input + 1);
|
||||
}
|
||||
@ -6582,7 +6582,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
const char *sp = (input[1] == '.' || input[1] == '+')
|
||||
? input + 2: strchr (input + 1, ' ');
|
||||
|
||||
if (IS_DIGIT (input[1])) {
|
||||
if (isdigit (input[1])) {
|
||||
sp = input + 1;
|
||||
} else if (!sp && input[1] == '-') {
|
||||
sp = input + 1;
|
||||
@ -8214,7 +8214,7 @@ static int cmd_print(void *data, const char *input) {
|
||||
if (input[1] == '.') {
|
||||
sp = input + 2;
|
||||
}
|
||||
if (IS_DIGIT (input[1])) {
|
||||
if (isdigit (input[1])) {
|
||||
sp = input + 1;
|
||||
}
|
||||
if (sp) {
|
||||
|
@ -838,7 +838,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) {
|
||||
case 'D': // $D
|
||||
if (str[2] == 'B') { // $DD
|
||||
return r_debug_get_baddr (core->dbg, NULL);
|
||||
} else if (IS_DIGIT (str[2])) {
|
||||
} else if (isdigit (str[2])) {
|
||||
return getref (core, atoi (str + 2), 'r', R_ANAL_REF_TYPE_DATA);
|
||||
} else {
|
||||
RDebugMap *map;
|
||||
|
@ -6051,7 +6051,7 @@ static char *_find_next_number(char *op) {
|
||||
p++;
|
||||
}
|
||||
}
|
||||
if (IS_DIGIT (*p)) {
|
||||
if (isdigit (*p)) {
|
||||
// we found the start of the next number
|
||||
return p;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ static bool is_valid_project_name(const char *name) {
|
||||
}
|
||||
const char * const extention = r_str_endswith (name, ".zip")? r_str_last (name, ".zip"): NULL;
|
||||
for (; *name && name != extention; name++) {
|
||||
if (IS_DIGIT (*name) || IS_LOWER (*name) || *name == '_') {
|
||||
if (isdigit (*name) || islower (*name) || *name == '_') {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define TYPE_NONE 0
|
||||
#define TYPE_STR 1
|
||||
#define TYPE_SYM 2
|
||||
#define IS_ALPHA(x) (IS_UPPER(x) || IS_LOWER(x))
|
||||
#define IS_ALPHA(x) (isupper(x) || islower(x))
|
||||
#define IS_STRING(x,y) ((x)+3<end && *(x) == 's' && *((x)+1) == 't' && *((x)+2) == 'r' && *((x)+3) == '.')
|
||||
#define IS_SYMBOL(x,y) ((x)+3<end && *(x) == 's' && *((x)+1) == 'y' && *((x)+2) == 'm' && *((x)+3) == '.')
|
||||
|
||||
|
@ -870,7 +870,7 @@ R_API void r_core_rtr_add(RCore *core, const char *_input) {
|
||||
R_API void r_core_rtr_remove(RCore *core, const char *input) {
|
||||
int i;
|
||||
|
||||
if (IS_DIGIT (input[0])) {
|
||||
if (isdigit (input[0])) {
|
||||
i = r_num_math (core->num, input);
|
||||
if (i >= 0 && i < RTR_MAX_HOSTS) {
|
||||
r_socket_free (rtr_host[i].fd);
|
||||
|
@ -1682,7 +1682,7 @@ repeat:
|
||||
default:
|
||||
if (ch == ' ' || ch == '\n' || ch == '\r' || ch == 'l') {
|
||||
ret = follow_ref (core, xrefs, skip, xref);
|
||||
} else if (IS_DIGIT (ch)) {
|
||||
} else if (isdigit (ch)) {
|
||||
ret = follow_ref (core, xrefs, ch - 0x30, xref);
|
||||
} else if (ch != 'q' && ch != 'Q' && ch != 'h') {
|
||||
goto repeat;
|
||||
|
@ -77,7 +77,7 @@ R_API void r_core_vmark_del(RCore *core, ut8 ch) {
|
||||
|
||||
R_API void r_core_vmark(RCore *core, ut8 ch) {
|
||||
R_RETURN_IF_FAIL (core);
|
||||
if (IS_DIGIT (ch)) {
|
||||
if (isdigit (ch)) {
|
||||
ch += ASCII_MAX + 1;
|
||||
}
|
||||
r_core_vmark_set (core, ch, core->offset, 0, 0);
|
||||
|
@ -4582,7 +4582,7 @@ onemoretime:
|
||||
case 'Q':
|
||||
case 'q':
|
||||
default:
|
||||
if (IS_DIGIT (ch)) {
|
||||
if (isdigit (ch)) {
|
||||
if (rep < 0) {
|
||||
rep = 0;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ static inline ut64 genmask(int bits) {
|
||||
|
||||
static bool isnum(REsil *esil, const char *str, ut64 *num) {
|
||||
R_RETURN_VAL_IF_FAIL (esil && str, false);
|
||||
if (IS_DIGIT (*str)) {
|
||||
if (isdigit (*str)) {
|
||||
if (num) {
|
||||
*num = r_num_get (NULL, str);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
// defines like IS_DIGIT, etc'
|
||||
// defines like isdigit, etc'
|
||||
#include <r_types_base.h>
|
||||
#include "r_util/r_str_util.h"
|
||||
#include <r_userconf.h>
|
||||
|
@ -12,11 +12,12 @@ extern "C" {
|
||||
(x) == '(' || (x) == ')' || (x) == '{' || (x) == '}')
|
||||
#define IS_HEXCHAR(x) (((x) >= '0' && (x) <= '9') || ((x) >= 'a' && (x) <= 'f') || ((x) >= 'A' && (x) <= 'F'))
|
||||
#define IS_PRINTABLE(x) ((x) >=' ' && (x) <= '~')
|
||||
#define IS_DIGIT(x) ((x) >= '0' && (x) <= '9')
|
||||
// R2_600 - deprecate
|
||||
#define IS_DIGIT(x) isdigit((x))
|
||||
#define IS_OCTAL(x) ((x) >= '0' && (x) <= '7')
|
||||
#define IS_WHITESPACE(x) ((x) == ' ' || (x) == '\t')
|
||||
#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z')
|
||||
#define IS_LOWER(c) ((c) >= 'a' && (c) <= 'z')
|
||||
#define IS_UPPER(c) isupper((c))
|
||||
#define IS_LOWER(c) islower((c))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ static int cin_get_num(RNum *num, RNumCalc *nc, RNumCalcValue *n) {
|
||||
*n = Nset (v);
|
||||
#endif
|
||||
|
||||
if (IS_DIGIT (*str) && strchr (str, '.')) {
|
||||
if (isdigit (*str) && strchr (str, '.')) {
|
||||
if (sscanf (str, "%lf", &d) < 1) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -2096,7 +2096,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len, cons
|
||||
/* get times */
|
||||
otimes = times = atoi (arg);
|
||||
if (times > 0) {
|
||||
while (IS_DIGIT(*arg)) {
|
||||
while (isdigit(*arg)) {
|
||||
arg++;
|
||||
}
|
||||
}
|
||||
|
@ -2069,7 +2069,7 @@ R_API int r_print_format_internal(RPrint *p, RPrintFormat *pf, ut64 seek, const
|
||||
/* get times */
|
||||
otimes = times = atoi (arg);
|
||||
if (times > 0) {
|
||||
while (IS_DIGIT (*arg)) {
|
||||
while (isdigit (*arg)) {
|
||||
arg++;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
/* int c; ret = hex_to_byte(&c, 'c'); */
|
||||
R_API bool r_hex_to_byte(ut8 *val, ut8 c) {
|
||||
if (IS_DIGIT (c)) {
|
||||
if (isdigit (c)) {
|
||||
*val = (ut8)(*val) * 16 + (c - '0');
|
||||
} else if (c >= 'A' && c <= 'F') {
|
||||
*val = (ut8)(*val) * 16 + (c - 'A' + 10);
|
||||
@ -62,7 +62,7 @@ R_API char *r_hex_from_py_array(char *out, const char *code) {
|
||||
word++;
|
||||
word = skip_comment_py (word);
|
||||
}
|
||||
if (IS_DIGIT (*word)) {
|
||||
if (isdigit (*word)) {
|
||||
ut8 n = (ut8)r_num_math (NULL, word);
|
||||
*out++ = abc[(n >> 4) & 0xf];
|
||||
*out++ = abc[n & 0xf];
|
||||
@ -188,7 +188,7 @@ R_API char *r_hex_from_c_array(char *out, const char *code) {
|
||||
word++;
|
||||
word = skip_comment_c (word);
|
||||
}
|
||||
if (IS_DIGIT (*word)) {
|
||||
if (isdigit (*word)) {
|
||||
ut8 n = (ut8)r_num_math (NULL, word);
|
||||
*out++ = abc[(n >> 4) & 0xf];
|
||||
*out++ = abc[n & 0xf];
|
||||
|
@ -5,7 +5,7 @@
|
||||
/* Validate if char is printable , why not use ISPRINTABLE() ?? */
|
||||
R_API bool r_name_validate_print(const char ch) {
|
||||
// TODO: support utf8
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || IS_DIGIT (ch)) {
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || isdigit (ch)) {
|
||||
return true;
|
||||
}
|
||||
switch (ch) {
|
||||
@ -65,7 +65,7 @@ R_API bool r_name_validate_dash(const char ch) {
|
||||
}
|
||||
|
||||
R_API bool r_name_validate_char(const char ch) {
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || IS_DIGIT (ch)) {
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || isdigit (ch)) {
|
||||
return true;
|
||||
}
|
||||
return (ch == '.' || ch == ':' || ch == '_');
|
||||
|
@ -164,7 +164,7 @@ static ut32 encode_var_int(const ut32 bias, const ut32 delta, char *dst) {
|
||||
}
|
||||
|
||||
static ut32 decode_digit(ut32 v) {
|
||||
if (IS_DIGIT (v)) {
|
||||
if (isdigit (v)) {
|
||||
return v - 22;
|
||||
}
|
||||
if (v >= 'a' && v <= 'z') {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <rvc.h>
|
||||
|
||||
#define FIRST_BRANCH "branches.master"
|
||||
#define NOT_SPECIAL(c) IS_DIGIT (c) || IS_LOWER (c) || c == '_'
|
||||
#define NOT_SPECIAL(c) isdigit (c) || islower (c) || c == '_'
|
||||
#define COMMIT_BLOB_SEP "----"
|
||||
#define DBNAME "branches.sdb"
|
||||
#define CURRENTB "current_branch"
|
||||
|
@ -3551,12 +3551,12 @@ R_API size_t *r_str_split_lines(char *str, size_t *count) {
|
||||
}
|
||||
|
||||
R_API bool r_str_isnumber(const char *str) {
|
||||
if (!str || (!IS_DIGIT (*str) && *str != '-')) {
|
||||
if (!str || (!isdigit (*str) && *str != '-')) {
|
||||
return false;
|
||||
}
|
||||
for (str++; *str; str++) {
|
||||
// consider '.' part of the number?
|
||||
if (!IS_DIGIT (*str)) {
|
||||
if (!isdigit (*str)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
int chars_read = len_num;
|
||||
bool zero_read = false;
|
||||
lch = str[len > 0 ? len - 1 : 0];
|
||||
if (*str == '0' && IS_DIGIT (*(str + 1)) && lch != 'b' && lch != 'h') {
|
||||
if (*str == '0' && isdigit (*(str + 1)) && lch != 'b' && lch != 'h') {
|
||||
lch = 'o';
|
||||
len_num++;
|
||||
}
|
||||
@ -450,7 +450,7 @@ R_API ut64 r_num_get(RNum *num, const char *str) {
|
||||
if (errno == ERANGE) {
|
||||
error (num, "number won't fit into 64 bits");
|
||||
}
|
||||
if (!IS_DIGIT (*str)) {
|
||||
if (!isdigit (*str)) {
|
||||
error (num, "unknown symbol");
|
||||
}
|
||||
break;
|
||||
@ -475,7 +475,7 @@ R_API ut64 r_num_math(RNum *num, const char *str) {
|
||||
}
|
||||
|
||||
R_API int r_num_is_float(RNum *num, const char *str) {
|
||||
return (IS_DIGIT (*str) && (strchr (str, '.') || str[strlen (str) - 1] == 'f'));
|
||||
return (isdigit (*str) && (strchr (str, '.') || str[strlen (str) - 1] == 'f'));
|
||||
}
|
||||
|
||||
R_API double r_num_get_double(RNum *num, const char *str) {
|
||||
|
4
sys/counters.sh
Executable file → Normal file
4
sys/counters.sh
Executable file → Normal file
@ -19,8 +19,8 @@ git grep 'eprintf (' libr | grep Usage | wc -l
|
||||
printf -- "f(char)\t"
|
||||
git grep 'free ((char' libr | wc -l
|
||||
|
||||
printf -- "IS_DIGIT\t"
|
||||
git grep 'IS_DIGIT' libr | wc -l
|
||||
printf -- "isdigit\t"
|
||||
git grep 'isdigit' libr | wc -l
|
||||
|
||||
printf -- "f(void)\t"
|
||||
git grep 'free ((void' libr | wc -l
|
||||
|
Loading…
Reference in New Issue
Block a user