diff --git a/Makefile.common b/Makefile.common index 60e1d844df..7d5f8e43c8 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1952,9 +1952,8 @@ ifeq ($(HAVE_NETWORKING), 1) OBJ += cheevos/cheevos.o \ cheevos/badges.o \ - cheevos/memory.o \ - cheevos/parser.o \ - cheevos/hash.o \ + cheevos/cheevos_memory.o \ + cheevos/cheevos_parser.o \ $(LIBRETRO_COMM_DIR)/formats/cdfs/cdfs.o \ deps/rcheevos/src/rcheevos/alloc.o \ deps/rcheevos/src/rcheevos/compat.o \ diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 239727f385..a69c28b0cd 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -52,9 +52,8 @@ #include "badges.h" #include "cheevos.h" -#include "memory.h" -#include "parser.h" -#include "hash.h" +#include "cheevos_memory.h" +#include "cheevos_parser.h" #include "util.h" #include "../file_path_special.h" diff --git a/cheevos/memory.c b/cheevos/cheevos_memory.c similarity index 99% rename from cheevos/memory.c rename to cheevos/cheevos_memory.c index 7b8cbf2bc0..5d693aa175 100644 --- a/cheevos/memory.c +++ b/cheevos/cheevos_memory.c @@ -13,7 +13,7 @@ * If not, see . */ -#include "memory.h" +#include "cheevos_memory.h" #include "util.h" diff --git a/cheevos/memory.h b/cheevos/cheevos_memory.h similarity index 100% rename from cheevos/memory.h rename to cheevos/cheevos_memory.h diff --git a/cheevos/parser.c b/cheevos/cheevos_parser.c similarity index 98% rename from cheevos/parser.c rename to cheevos/cheevos_parser.c index 13cffaa6e9..b8e9c9fa62 100644 --- a/cheevos/parser.c +++ b/cheevos/cheevos_parser.c @@ -1,6 +1,5 @@ -#include "parser.h" +#include "cheevos_parser.h" -#include "hash.h" #include "util.h" #include @@ -34,6 +33,17 @@ Gets a value in a JSON *****************************************************************************/ +static uint32_t rcheevos_djb2(const char* str, size_t length) +{ + const unsigned char* aux = (const unsigned char*)str; + uint32_t hash = 5381; + + while (length--) + hash = (hash << 5) + hash + *aux++; + + return hash; +} + typedef struct { unsigned key_hash; diff --git a/cheevos/parser.h b/cheevos/cheevos_parser.h similarity index 100% rename from cheevos/parser.h rename to cheevos/cheevos_parser.h diff --git a/cheevos/hash.c b/cheevos/hash.c deleted file mode 100644 index 07d028a7f4..0000000000 --- a/cheevos/hash.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "hash.h" - -uint32_t rcheevos_djb2(const char* str, size_t length) -{ - const unsigned char* aux = (const unsigned char*)str; - uint32_t hash = 5381; - - while (length--) - hash = ( hash << 5 ) + hash + *aux++; - - return hash; -} diff --git a/cheevos/hash.h b/cheevos/hash.h deleted file mode 100644 index c13b5ecde7..0000000000 --- a/cheevos/hash.h +++ /dev/null @@ -1,30 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2015-2018 - Andre Leiradella - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __RARCH_CHEEVOS_HASH_H -#define __RARCH_CHEEVOS_HASH_H - -#include -#include - -#include - -RETRO_BEGIN_DECLS - -uint32_t rcheevos_djb2(const char* str, size_t length); - -RETRO_END_DECLS - -#endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 18bce931f5..b5b38e2d8a 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -195,9 +195,8 @@ ACHIEVEMENTS #include "../cheevos/cheevos.c" #include "../cheevos/badges.c" -#include "../cheevos/memory.c" -#include "../cheevos/hash.c" -#include "../cheevos/parser.c" +#include "../cheevos/cheevos_memory.c" +#include "../cheevos/cheevos_parser.c" #include "../deps/rcheevos/src/rcheevos/alloc.c" #include "../deps/rcheevos/src/rcheevos/compat.c"