Fixed some codacy stuff

This commit is contained in:
Linus Probert 2017-12-19 23:02:24 +01:00
parent 4bbe82a705
commit 025bd3eda2
2 changed files with 5 additions and 2 deletions

View File

@ -70,7 +70,7 @@ ht_set(Hashtable *table, const char *key, void *val)
{ {
int hashkey = 0; int hashkey = 0;
Entry *newEntry = NULL; Entry *newEntry = NULL;
Entry *next = NULL; Entry *next;
Entry *last = NULL; Entry *last = NULL;
hashkey = hash(table, key); hashkey = hash(table, key);
@ -86,6 +86,9 @@ ht_set(Hashtable *table, const char *key, void *val)
next = next->next; next = next->next;
} }
if (last == NULL)
last = table->entries[hashkey];
if (next && next->key && strcmp(key, next->key) == 0) { if (next && next->key && strcmp(key, next->key) == 0) {
/* Collision */ /* Collision */
free(next->value); free(next->value);

View File

@ -217,7 +217,7 @@ player_print(Player *p)
printf("\n"); printf("\n");
printf("--------=== <[ Player Stats ]> ===--------\n"); printf("--------=== <[ Player Stats ]> ===--------\n");
printf("HP: %d\n", p->stats.hp); printf("HP: %d\n", p->stats.hp);
printf("Level: %d XP: %u\n", p->stats.lvl, p->xp); printf("Level: %u XP: %u\n", p->stats.lvl, p->xp);
printf("Pos: %dx%d RoomPos: %dx%d\n", pos.x, pos.y, roomPos.x, roomPos.y); printf("Pos: %dx%d RoomPos: %dx%d\n", pos.x, pos.y, roomPos.x, roomPos.y);
printf("Steps: %u\n", p->total_steps); printf("Steps: %u\n", p->total_steps);
printf("------------------------------------------\n"); printf("------------------------------------------\n");