(cheevos.c) Cleanups

This commit is contained in:
twinaphex 2016-07-11 14:56:23 +02:00
parent ecb69ad938
commit 3db30a9440
1 changed files with 10 additions and 13 deletions

View File

@ -277,7 +277,7 @@ static uint32_t cheevos_djb2(const char* str, size_t length)
{ {
const unsigned char *aux = (const unsigned char*)str; const unsigned char *aux = (const unsigned char*)str;
const unsigned char *end = aux + length; const unsigned char *end = aux + length;
uint32_t hash = 5381; uint32_t hash = 5381;
while (aux < end) while (aux < end)
hash = (hash << 5) + hash + *aux++; hash = (hash << 5) + hash + *aux++;
@ -838,11 +838,11 @@ static INLINE const char *cheevos_dupstr(const cheevos_field_t *field)
static int cheevos_new_cheevo(cheevos_readud_t *ud) static int cheevos_new_cheevo(cheevos_readud_t *ud)
{ {
const cheevos_condset_t *end;
unsigned set; unsigned set;
cheevos_condset_t *condset; const cheevos_condset_t *end = NULL;
cheevo_t *cheevo; cheevos_condset_t *condset = NULL;
int flags = strtol(ud->flags.string, NULL, 10); cheevo_t *cheevo = NULL;
int flags = strtol(ud->flags.string, NULL, 10);
if (flags == 3) if (flags == 3)
cheevo = cheevos_locals.core.cheevos + ud->core_count++; cheevo = cheevos_locals.core.cheevos + ud->core_count++;
@ -878,7 +878,8 @@ static int cheevos_new_cheevo(cheevos_readud_t *ud)
if (!cheevo->condsets) if (!cheevo->condsets)
return -1; return -1;
memset((void*)cheevo->condsets, 0, cheevo->count * sizeof(cheevos_condset_t)); memset((void*)cheevo->condsets, 0,
cheevo->count * sizeof(cheevos_condset_t));
end = cheevo->condsets + cheevo->count; end = cheevo->condsets + cheevo->count;
set = 0; set = 0;
@ -1419,9 +1420,7 @@ static int cheevos_login(retro_time_t *timeout)
free((void*)json); free((void*)json);
if (!res) if (!res)
{
return 0; return 0;
}
} }
runloop_msg_queue_push("Retro Achievements login error", runloop_msg_queue_push("Retro Achievements login error",
@ -2198,13 +2197,11 @@ void cheevos_populate_menu(void *data)
#ifdef HAVE_MENU #ifdef HAVE_MENU
unsigned i; unsigned i;
unsigned items_found = 0; unsigned items_found = 0;
const cheevo_t *end = NULL;
cheevo_t *cheevo = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; menu_displaylist_info_t *info = (menu_displaylist_info_t*)data;
cheevo_t *cheevo = cheevos_locals.core.cheevos;
cheevo = cheevos_locals.core.cheevos; const cheevo_t *end = cheevos_locals.core.cheevos +
end = cheevos_locals.core.cheevos + cheevos_locals.core.count; cheevos_locals.core.count;
for (i = 0; cheevo < end; i++, cheevo++) for (i = 0; cheevo < end; i++, cheevo++)
{ {