speedup for 32-bit: ~5%
speedup for 64-bit: ~3%
// Don't define this. It's not thread-safe.
/* #define REFCOUNT_DEBUG 1 */
-const char *json_number_chars = "0123456789.+-eE";
const char *json_hex_chars = "0123456789abcdefABCDEF";
static struct json_object* json_object_new(enum json_type o_type);
void _json_c_set_last_err(const char *err_fmt, ...);
-extern const char *json_number_chars;
extern const char *json_hex_chars;
#ifdef __cplusplus
|| (c >= 'a' && c <= 'f');
}
+static int is_number_char(char c)
+{
+ return (c >= '0' && c <= '9')
+ || c == '.'
+ || c == '+'
+ || c == '-'
+ || c == 'e'
+ || c == 'E';
+}
+
/* Use C99 NAN by default; if not available, nan("") should work too. */
#ifndef NAN
#define NAN nan("")
int case_len=0;
int is_exponent=0;
int negativesign_next_possible_location=1;
- while(c && strchr(json_number_chars, c)) {
+ while(c && is_number_char(c)) {
++case_len;
/* non-digit characters checks */