rename memory.c and parser.c to be less generic; eliminate hash.c

This commit is contained in:
Jamiras 2020-08-12 08:13:37 -06:00
parent 8d34d06c76
commit 1f350be1f8
9 changed files with 19 additions and 54 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -13,7 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "memory.h"
#include "cheevos_memory.h"
#include "util.h"

View File

@ -1,6 +1,5 @@
#include "parser.h"
#include "cheevos_parser.h"
#include "hash.h"
#include "util.h"
#include <encodings/utf.h>
@ -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;

View File

@ -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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef __RARCH_CHEEVOS_HASH_H
#define __RARCH_CHEEVOS_HASH_H
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
uint32_t rcheevos_djb2(const char* str, size_t length);
RETRO_END_DECLS
#endif

View File

@ -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"