#define JSON_PARSER_H
#include <stdio.h>
+#include <ctype.h>
#include <objson/object.h>
#include <opensrf/utils.h>
/* prints a useful error message to stderr. always returns -1 */
int json_handle_error(char* string, unsigned long* index, char* err_msg);
-/* returns true if c is 0-9 */
-int is_number(char c);
-
int json_parse_json_null(char* string, unsigned long* index, jsonObject* obj, int current_strlen);
break;
default:
- if(is_number(c) || c == '.' || c == '-') { /* are we a number? */
+ if(isdigit(c) || c == '.' || c == '-') { /* are we a number? */
status = json_parse_json_number(string, index, obj, current_strlen);
if(status) return status;
break;
while(*index < current_strlen) {
- if(is_number(c)) {
+ if(isdigit(c)) {
buffer_add_char(buf, c);
}
return 0;
}
-int is_number(char c) {
- switch(c) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- return 1;
- }
- return 0;
-}
-
int json_handle_error(char* string, unsigned long* index, char* err_msg) {
char buf[60];