mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Get rid of hashes in config_file.c
This commit is contained in:
parent
c950613098
commit
e1461cc0de
@ -44,7 +44,6 @@
|
||||
#include <file/file_path.h>
|
||||
#include <lists/string_list.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <rhash.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#define MAX_INCLUDE_DEPTH 16
|
||||
@ -54,7 +53,6 @@ struct config_entry_list
|
||||
/* If we got this from an #include,
|
||||
* do not allow overwrite. */
|
||||
bool readonly;
|
||||
uint32_t key_hash;
|
||||
|
||||
char *key;
|
||||
char *value;
|
||||
@ -313,11 +311,11 @@ static bool parse_line(config_file_t *conf,
|
||||
|
||||
key[idx++] = *line++;
|
||||
}
|
||||
key[idx] = '\0';
|
||||
list->key = key;
|
||||
list->key_hash = djb2_calculate(key);
|
||||
key[idx] = '\0';
|
||||
list->key = key;
|
||||
|
||||
list->value = extract_value(line, true);
|
||||
|
||||
list->value = extract_value(line, true);
|
||||
if (!list->value)
|
||||
{
|
||||
list->key = NULL;
|
||||
@ -378,7 +376,6 @@ static config_file_t *config_file_new_internal(
|
||||
}
|
||||
|
||||
list->readonly = false;
|
||||
list->key_hash = 0;
|
||||
list->key = NULL;
|
||||
list->value = NULL;
|
||||
list->next = NULL;
|
||||
@ -510,7 +507,6 @@ config_file_t *config_file_new_from_string(const char *from_string)
|
||||
}
|
||||
|
||||
list->readonly = false;
|
||||
list->key_hash = 0;
|
||||
list->key = NULL;
|
||||
list->value = NULL;
|
||||
list->next = NULL;
|
||||
@ -545,17 +541,12 @@ config_file_t *config_file_new(const char *path)
|
||||
static struct config_entry_list *config_get_entry(const config_file_t *conf,
|
||||
const char *key, struct config_entry_list **prev)
|
||||
{
|
||||
struct config_entry_list *entry;
|
||||
struct config_entry_list *previous = NULL;
|
||||
|
||||
uint32_t hash = djb2_calculate(key);
|
||||
|
||||
if (prev)
|
||||
previous = *prev;
|
||||
struct config_entry_list *entry = NULL;
|
||||
struct config_entry_list *previous = prev ? *prev : NULL;
|
||||
|
||||
for (entry = conf->entries; entry; entry = entry->next)
|
||||
{
|
||||
if (hash == entry->key_hash && string_is_equal(key, entry->key))
|
||||
if (string_is_equal(key, entry->key))
|
||||
return entry;
|
||||
|
||||
previous = entry;
|
||||
@ -775,7 +766,6 @@ void config_set_string(config_file_t *conf, const char *key, const char *val)
|
||||
return;
|
||||
|
||||
entry->readonly = false;
|
||||
entry->key_hash = 0;
|
||||
entry->key = strdup(key);
|
||||
entry->value = strdup(val);
|
||||
entry->next = NULL;
|
||||
|
@ -100,11 +100,6 @@ int filestream_printf(RFILE *stream, const char* format, ...);
|
||||
|
||||
int filestream_error(RFILE *stream);
|
||||
|
||||
/* DO NOT put these functions back, unless you want to deal with
|
||||
the UNAVOIDABLE REGRESSIONS on platforms using unexpected rfile backends
|
||||
int filestream_get_fd(RFILE *stream);
|
||||
FILE* filestream_get_fp(RFILE *stream); */
|
||||
|
||||
int filestream_flush(RFILE *stream);
|
||||
|
||||
static INLINE char *filestream_getline(RFILE *stream)
|
||||
|
Loading…
x
Reference in New Issue
Block a user