Commit 54ca1750 authored by dokutoku's avatar dokutoku
Browse files

minor changes

parent 411b6e6b
......@@ -352,7 +352,7 @@ private int do_dump(scope const jansson_d.jansson.json_t* json, size_t flags, in
case jansson_d.jansson.json_type.JSON_FALSE:
return dump("false", 5, data);
case jansson_d.jansson.json_type.JSON_INTEGER: {
case jansson_d.jansson.json_type.JSON_INTEGER:
char[.MAX_INTEGER_STR_LENGTH] buffer = void;
int size = jansson_d.jansson_private.snprintf(&(buffer[0]), buffer.length, "%" ~ jansson_d.jansson.JSON_INTEGER_FORMAT, jansson_d.value.json_integer_value(json));
......@@ -361,9 +361,8 @@ private int do_dump(scope const jansson_d.jansson.json_t* json, size_t flags, in
}
return dump(&(buffer[0]), size, data);
}
case jansson_d.jansson.json_type.JSON_REAL: {
case jansson_d.jansson.json_type.JSON_REAL:
char[.MAX_REAL_STR_LENGTH] buffer = void;
double value = jansson_d.value.json_real_value(json);
int size = jansson_d.jansson_private.jsonp_dtostr(&(buffer[0]), buffer.length, value, mixin (.FLAGS_TO_PRECISION!("flags")));
......@@ -373,12 +372,11 @@ private int do_dump(scope const jansson_d.jansson.json_t* json, size_t flags, in
}
return dump(&(buffer[0]), size, data);
}
case jansson_d.jansson.json_type.JSON_STRING:
return .dump_string(jansson_d.value.json_string_value(json), jansson_d.value.json_string_length(json), dump, data, flags);
case jansson_d.jansson.json_type.JSON_ARRAY: {
case jansson_d.jansson.json_type.JSON_ARRAY:
/*
* Space for "0x", double the sizeof a pointer for the hex and a
* terminator.
......@@ -426,9 +424,8 @@ private int do_dump(scope const jansson_d.jansson.json_t* json, size_t flags, in
jansson_d.hashtable.hashtable_del(parents, &(key[0]), key_len);
return (embed) ? (0) : (dump("]", 1, data));
}
case jansson_d.jansson.json_type.JSON_OBJECT: {
case jansson_d.jansson.json_type.JSON_OBJECT:
const (char)* separator = void;
int separator_length = void;
......@@ -548,7 +545,6 @@ private int do_dump(scope const jansson_d.jansson.json_t* json, size_t flags, in
jansson_d.hashtable.hashtable_del(parents, &(loop_key[0]), loop_key_len);
return (embed) ? (0) : (dump("}", 1, data));
}
default:
/* not reached */
......
......@@ -1095,7 +1095,7 @@ private jansson_d.jansson.json_t* parse_value(scope .lex_t* lex, size_t flags, s
jansson_d.jansson.json_t* json = null;
switch (lex.token) {
case .TOKEN_STRING: {
case .TOKEN_STRING:
const char* value = lex.value.string_.val;
size_t len = lex.value.string_.len;
......@@ -1112,19 +1112,16 @@ private jansson_d.jansson.json_t* parse_value(scope .lex_t* lex, size_t flags, s
lex.value.string_.len = 0;
break;
}
case .TOKEN_INTEGER: {
case .TOKEN_INTEGER:
json = jansson_d.value.json_integer(lex.value.integer);
break;
}
case .TOKEN_REAL: {
case .TOKEN_REAL:
json = jansson_d.value.json_real(lex.value.real_);
break;
}
case .TOKEN_TRUE:
json = jansson_d.value.json_true();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment