From 790bb0d0d69a47166dc27aab19a4606e0b475b8a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 28 Sep 2015 22:07:40 +0200 Subject: [PATCH] Minor code cleanups based on static code analysis --- input/connect/joypad_connection.c | 5 +++-- libretro-common/net/net_http_test.c | 2 +- libretro-db/parser.c | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/input/connect/joypad_connection.c b/input/connect/joypad_connection.c index 5beda8da98..b8720ce60d 100644 --- a/input/connect/joypad_connection.c +++ b/input/connect/joypad_connection.c @@ -67,8 +67,7 @@ int32_t pad_connection_pad_init(joypad_connection_t *joyconn, if (pad != -1) { - unsigned i; - joypad_connection_t* s = (joypad_connection_t*)&joyconn[pad]; + joypad_connection_t *s = (joypad_connection_t*)&joyconn[pad]; static const struct { @@ -89,6 +88,8 @@ int32_t pad_connection_pad_init(joypad_connection_t *joyconn, if (s) { + unsigned i; + for (i = 0; name && pad_map[i].name; i++) { const char *name_match = strstr(name, pad_map[i].name); diff --git a/libretro-common/net/net_http_test.c b/libretro-common/net/net_http_test.c index b32f1bfcf3..ae56dfbb13 100644 --- a/libretro-common/net/net_http_test.c +++ b/libretro-common/net/net_http_test.c @@ -9,7 +9,7 @@ int main(void) { char *data; - http_t *http1, *http2, *http3; + http_t *http1, *http3; size_t len, pos = 0, tot = 0; if (!network_init()) diff --git a/libretro-db/parser.c b/libretro-db/parser.c index fec76435c1..ce4498b459 100644 --- a/libretro-db/parser.c +++ b/libretro-db/parser.c @@ -66,9 +66,6 @@ static void parse_map( pr_state_t* parser, int skip, int isrom ) { pr_node_t dummy; pr_node_t* node; - unsigned hash; - const char* key; - unsigned keylen; if ( skip ) { @@ -82,6 +79,10 @@ static void parse_map( pr_state_t* parser, int skip, int isrom ) while ( parser->lexer.token != LX_RPAREN ) { + unsigned hash; + const char* key; + unsigned keylen; + if ( parser->lexer.token != LX_TAG ) longjmp( parser->env, PR_UNEXPECTED_TOKEN );