diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-21 17:35:29 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-21 17:35:29 +0400 |
commit | fd6c856b34c8fda53b7e45e3dcc17625206ed4fb (patch) | |
tree | b4c8d1c62937038cb39bdcf7879110525fb05480 /src/lua | |
parent | 875d1dd367eb433ae77a092148f483e9b9449a47 (diff) | |
download | rspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.tar.gz rspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.zip |
Add workaround for clang under linux.
Fix problems found by static analyzing.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_cdb.c | 2 | ||||
-rw-r--r-- | src/lua/lua_classifier.c | 4 | ||||
-rw-r--r-- | src/lua/lua_config.c | 10 | ||||
-rw-r--r-- | src/lua/lua_http.c | 2 | ||||
-rw-r--r-- | src/lua/lua_message.c | 2 | ||||
-rw-r--r-- | src/lua/lua_regexp.c | 2 | ||||
-rw-r--r-- | src/lua/lua_task.c | 10 |
7 files changed, 16 insertions, 16 deletions
diff --git a/src/lua/lua_cdb.c b/src/lua/lua_cdb.c index 24f6b205f..fbbc69359 100644 --- a/src/lua/lua_cdb.c +++ b/src/lua/lua_cdb.c @@ -49,7 +49,7 @@ lua_check_cdb (lua_State * L) void *ud = luaL_checkudata (L, 1, "rspamd{cdb}"); luaL_argcheck (L, ud != NULL, 1, "'cdb' expected"); - return *((struct cdb **)ud); + return ud ? *((struct cdb **)ud) : NULL; } static gint diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c index 4e868b7f7..82fd4948d 100644 --- a/src/lua/lua_classifier.c +++ b/src/lua/lua_classifier.c @@ -72,7 +72,7 @@ lua_check_classifier (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{classifier}"); luaL_argcheck (L, ud != NULL, 1, "'classifier' expected"); - return *((struct classifier_config **)ud); + return ud ? *((struct classifier_config **)ud) : NULL; } static GList * @@ -353,7 +353,7 @@ lua_check_statfile (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{statfile}"); luaL_argcheck (L, ud != NULL, 1, "'statfile' expected"); - return *((struct statfile **)ud); + return ud ? *((struct statfile **)ud) : NULL; } diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index b4db951ff..d67176f0f 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -109,7 +109,7 @@ lua_check_config (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{config}"); luaL_argcheck (L, ud != NULL, 1, "'config' expected"); - return *((struct config_file **)ud); + return ud ? *((struct config_file **)ud) : NULL; } static radix_tree_t * @@ -117,7 +117,7 @@ lua_check_radix (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{radix}"); luaL_argcheck (L, ud != NULL, 1, "'radix' expected"); - return **((radix_tree_t ***)ud); + return ud ? **((radix_tree_t ***)ud) : NULL; } static GHashTable * @@ -125,7 +125,7 @@ lua_check_hash_table (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{hash_table}"); luaL_argcheck (L, ud != NULL, 1, "'hash_table' expected"); - return **((GHashTable ***)ud); + return ud ? **((GHashTable ***)ud) : NULL; } static rspamd_trie_t * @@ -134,7 +134,7 @@ lua_check_trie (lua_State * L) void *ud = luaL_checkudata (L, 1, "rspamd{trie}"); luaL_argcheck (L, ud != NULL, 1, "'trie' expected"); - return *((rspamd_trie_t **)ud); + return ud ? *((rspamd_trie_t **)ud) : NULL; } /*** Config functions ***/ @@ -764,7 +764,7 @@ lua_trie_search_task (lua_State *L) if (trie) { ud = luaL_checkudata (L, 2, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - task = *((struct worker_task **)ud); + task = ud ? *((struct worker_task **)ud) : NULL; if (task) { lua_newtable (L); cur = task->text_parts; diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 1ecfdfd12..99976c238 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -63,7 +63,7 @@ lua_check_task (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - return *((struct worker_task **)ud); + return ud ? *((struct worker_task **)ud) : NULL; } static void diff --git a/src/lua/lua_message.c b/src/lua/lua_message.c index 70e33981b..1026c3690 100644 --- a/src/lua/lua_message.c +++ b/src/lua/lua_message.c @@ -94,7 +94,7 @@ lua_check_message (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{message}"); luaL_argcheck (L, ud != NULL, 1, "'message' expected"); - return *((GMimeMessage **) ud); + return ud ? *((GMimeMessage **) ud) : NULL; } diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c index ee8579dec..7a0b3d0c3 100644 --- a/src/lua/lua_regexp.c +++ b/src/lua/lua_regexp.c @@ -53,7 +53,7 @@ lua_check_regexp (lua_State * L) void *ud = luaL_checkudata (L, 1, "rspamd{regexp}"); luaL_argcheck (L, ud != NULL, 1, "'regexp' expected"); - return *((GRegex **)ud); + return ud ? *((GRegex **)ud) : NULL; } static int diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index a6530160f..f3fdc3bad 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -166,7 +166,7 @@ lua_check_task (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{task}"); luaL_argcheck (L, ud != NULL, 1, "'task' expected"); - return *((struct worker_task **)ud); + return ud ? *((struct worker_task **)ud) : NULL; } static struct mime_text_part * @@ -174,7 +174,7 @@ lua_check_textpart (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{textpart}"); luaL_argcheck (L, ud != NULL, 1, "'textpart' expected"); - return *((struct mime_text_part **)ud); + return ud ? *((struct mime_text_part **)ud) : NULL; } static struct rspamd_image * @@ -182,7 +182,7 @@ lua_check_image (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{image}"); luaL_argcheck (L, ud != NULL, 1, "'image' expected"); - return *((struct rspamd_image **)ud); + return ud ? *((struct rspamd_image **)ud) : NULL; } static struct uri * @@ -190,7 +190,7 @@ lua_check_url (lua_State * L) { void *ud = luaL_checkudata (L, 1, "rspamd{url}"); luaL_argcheck (L, ud != NULL, 1, "'url' expected"); - return *((struct uri **)ud); + return ud ? *((struct uri **)ud) : NULL; } /*** Task interface ***/ @@ -1355,7 +1355,7 @@ lua_textpart_compare_distance (lua_State * L) const GMimeContentType *ct; luaL_argcheck (L, ud != NULL, 2, "'textpart' expected"); - other = *((struct mime_text_part **)ud); + other = ud ? *((struct mime_text_part **)ud) : NULL; if (part->parent && part->parent == other->parent) { parent = part->parent; |