summaryrefslogtreecommitdiff
path: root/lua_cjson.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua_cjson.c')
-rw-r--r--lua_cjson.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index 50f27c2..2228fee 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -1,7 +1,7 @@
1/* CJSON - JSON support for Lua 1/* CJSON - JSON support for Lua
2 * 2 *
3 * Copyright (c) 2010-2011 Mark Pulford <mark@kyne.com.au> 3 * Copyright (c) 2010-2011 Mark Pulford <mark@kyne.com.au>
4 * 4 *
5 * Permission is hereby granted, free of charge, to any person obtaining 5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the 6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including 7 * "Software"), to deal in the Software without restriction, including
@@ -9,10 +9,10 @@
9 * distribute, sublicense, and/or sell copies of the Software, and to 9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to 10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions: 11 * the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be 13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software. 14 * included in all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -105,7 +105,7 @@ typedef struct {
105 int encode_keep_buffer; 105 int encode_keep_buffer;
106} json_config_t; 106} json_config_t;
107 107
108typedef struct { 108typedef struct {
109 const char *data; 109 const char *data;
110 int index; 110 int index;
111 strbuf_t *tmp; /* Temporary storage for strings */ 111 strbuf_t *tmp; /* Temporary storage for strings */
@@ -306,7 +306,7 @@ static int json_cfg_refuse_invalid_numbers(lua_State *l)
306static int json_destroy_config(lua_State *l) 306static int json_destroy_config(lua_State *l)
307{ 307{
308 json_config_t *cfg; 308 json_config_t *cfg;
309 309
310 cfg = lua_touserdata(l, 1); 310 cfg = lua_touserdata(l, 1);
311 if (cfg) 311 if (cfg)
312 strbuf_free(&cfg->encode_buf); 312 strbuf_free(&cfg->encode_buf);
@@ -720,7 +720,7 @@ static int codepoint_to_utf8(char *utf8, int codepoint)
720 utf8[0] = codepoint; 720 utf8[0] = codepoint;
721 return 1; 721 return 1;
722 } 722 }
723 723
724 /* 110xxxxx 10xxxxxx */ 724 /* 110xxxxx 10xxxxxx */
725 if (codepoint <= 0x7FF) { 725 if (codepoint <= 0x7FF) {
726 utf8[0] = (codepoint >> 6) | 0xC0; 726 utf8[0] = (codepoint >> 6) | 0xC0;
@@ -843,7 +843,7 @@ static void json_next_string_token(json_parse_t *json, json_token_t *token)
843 json_set_token_error(token, json, "unexpected end of string"); 843 json_set_token_error(token, json, "unexpected end of string");
844 return; 844 return;
845 } 845 }
846 846
847 /* Handle escapes */ 847 /* Handle escapes */
848 if (ch == '\\') { 848 if (ch == '\\') {
849 /* Fetch escape character */ 849 /* Fetch escape character */
@@ -1102,7 +1102,7 @@ static void json_parse_object_context(lua_State *l, json_parse_t *json)
1102 json_throw_parse_error(l, json, "comma or object end", &token); 1102 json_throw_parse_error(l, json, "comma or object end", &token);
1103 1103
1104 json_next_token(json, &token); 1104 json_next_token(json, &token);
1105 } 1105 }
1106} 1106}
1107 1107
1108/* Handle the array context */ 1108/* Handle the array context */
@@ -1141,7 +1141,7 @@ static void json_parse_array_context(lua_State *l, json_parse_t *json)
1141 1141
1142/* Handle the "value" context */ 1142/* Handle the "value" context */
1143static void json_process_value(lua_State *l, json_parse_t *json, 1143static void json_process_value(lua_State *l, json_parse_t *json,
1144 json_token_t *token) 1144 json_token_t *token)
1145{ 1145{
1146 switch (token->type) { 1146 switch (token->type) {
1147 case T_STRING: 1147 case T_STRING: