mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-29 20:43:44 +00:00
Polish code
code issues found by Clang with CFLAGS="-Os -Wall -Wextra -Werror=unused-const-variable -Wno-error=unused-parameter" enabled The details as follows: - variable initialization issue, modified them as Clang suggested - data type mismatch when comparing, fix them either by casting or changing the data type of index of iterator - get_sockaddr() in netutils may return -1 thus changed returning type from size_t to ssize_t, which makes Clang happier - recvfrom() in udprelay is identical, fix this by creating local variable for comparison and assign back to buf->len when returning value is acceptable Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
+4
-4
@@ -38,7 +38,7 @@
|
||||
#ifdef __cplusplus
|
||||
const struct _json_value json_value_none; /* zero-d by ctor */
|
||||
#else
|
||||
const struct _json_value json_value_none = { 0 };
|
||||
const struct _json_value json_value_none = { NULL, 0, {0}, {NULL} };
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -239,7 +239,7 @@ json_value *json_parse_ex(json_settings *settings,
|
||||
unsigned int cur_line;
|
||||
const json_char *cur_line_begin, *i, *end;
|
||||
json_value *top, *root, *alloc = 0;
|
||||
json_state state = { 0 };
|
||||
json_state state = { 0UL, 0U, 0UL, {0UL, 0, NULL, NULL, NULL}, 0 };
|
||||
long flags;
|
||||
long num_digits = 0, num_e = 0;
|
||||
json_int_t num_fraction = 0;
|
||||
@@ -933,7 +933,7 @@ e_failed:
|
||||
|
||||
json_value *json_parse(const json_char *json, size_t length)
|
||||
{
|
||||
json_settings settings = { 0 };
|
||||
json_settings settings = { 0UL, 0, NULL, NULL, NULL };
|
||||
return json_parse_ex(&settings, json, length, 0);
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ void json_value_free_ex(json_settings *settings, json_value *value)
|
||||
|
||||
void json_value_free(json_value *value)
|
||||
{
|
||||
json_settings settings = { 0 };
|
||||
json_settings settings = { 0UL, 0, NULL, NULL, NULL };
|
||||
settings.mem_free = default_free;
|
||||
json_value_free_ex(&settings, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user