summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf_json.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-04-11 15:59:17 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-04-11 15:59:17 +0300
commit60ae0314c076971e786e3c56a7514f081f4b16ee (patch)
treeffe584bae86e402c2c175f39e31faa3a32b8afc6 /src/nxt_conf_json.c
parentcddbab63129dcffee4099453e304e67ecf8b6c04 (diff)
downloadunit-60ae0314c076971e786e3c56a7514f081f4b16ee.tar.gz
unit-60ae0314c076971e786e3c56a7514f081f4b16ee.tar.bz2
Fixed building on MacOSX.
Diffstat (limited to 'src/nxt_conf_json.c')
-rw-r--r--src/nxt_conf_json.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nxt_conf_json.c b/src/nxt_conf_json.c
index 109edf22..5808e5a6 100644
--- a/src/nxt_conf_json.c
+++ b/src/nxt_conf_json.c
@@ -812,31 +812,27 @@ nxt_conf_json_print(nxt_conf_json_value_t *value, nxt_mem_pool_t *pool)
static uintptr_t
nxt_conf_json_print_value(u_char *pos, nxt_conf_json_value_t *value)
{
- static const u_char null[4] = "null";
- static const u_char true[4] = "true";
- static const u_char false[5] = "false";
-
switch (value->type) {
case NXT_CONF_JSON_NULL:
if (pos == NULL) {
- return sizeof(null);
+ return sizeof("null") - 1;
}
- return (uintptr_t) nxt_cpymem(pos, null, sizeof(null));
+ return (uintptr_t) nxt_cpymem(pos, "null", 4);
case NXT_CONF_JSON_BOOLEAN:
if (pos == NULL) {
- return value->u.boolean ? 4 : 5;
+ return value->u.boolean ? sizeof("true") - 1 : sizeof("false") - 1;
}
if (value->u.boolean) {
- return (uintptr_t) nxt_cpymem(pos, true, sizeof(true));
+ return (uintptr_t) nxt_cpymem(pos, "true", 4);
}
- return (uintptr_t) nxt_cpymem(pos, false, sizeof(false));
+ return (uintptr_t) nxt_cpymem(pos, "false", 5);
case NXT_CONF_JSON_INTEGER:
return nxt_conf_json_print_integer(pos, value);