Use string_is_equal/stdstring.h

This commit is contained in:
twinaphex 2016-09-16 17:33:18 +02:00
parent f395e851c4
commit 99aae8537b
5 changed files with 29 additions and 23 deletions

View File

@ -19,10 +19,11 @@
#include <sstream>
#include <algorithm>
#include <retro_miscellaneous.h>
#include <file/file_path.h>
#include <streams/file_stream.h>
#include <lists/string_list.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include "glslang_util.hpp"
#include "glslang.hpp"
@ -227,7 +228,7 @@ const char *glslang_format_to_string(enum glslang_format fmt)
static glslang_format glslang_find_format(const char *fmt)
{
#undef FMT
#define FMT(x) if (!strcmp(fmt, #x)) return SLANG_FORMAT_ ## x
#define FMT(x) if (string_is_equal(fmt, #x)) return SLANG_FORMAT_ ## x
FMT(R8_UNORM);
FMT(R8_UINT);
FMT(R8_SINT);

View File

@ -1,7 +1,7 @@
DEBUG = 0
LIBRETRODB_DIR := .
LIBRETRO_COMMON_DIR := ../libretro-common
INCFLAGS = -I. -I$(LIBRETRO_COMMON_DIR)/include
LIBRETRO_COMM_DIR := ../libretro-common
INCFLAGS = -I. -I$(LIBRETRO_COMM_DIR)/include
TARGETS = rmsgpack_test libretrodb_tool c_converter
@ -12,7 +12,7 @@ CFLAGS = -g -O2 -Wall -DNDEBUG
endif
LIBRETRO_COMMON_C = \
$(LIBRETRO_COMMON_DIR)/streams/file_stream.c
$(LIBRETRO_COMM_DIR)/streams/file_stream.c
C_CONVERTER_C = \
$(LIBRETRODB_DIR)/rmsgpack.c \
@ -21,10 +21,11 @@ C_CONVERTER_C = \
$(LIBRETRODB_DIR)/bintree.c \
$(LIBRETRODB_DIR)/query.c \
$(LIBRETRODB_DIR)/c_converter.c \
$(LIBRETRO_COMMON_DIR)/hash/rhash.c \
$(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \
$(LIBRETRO_COMM_DIR)/hash/rhash.c \
$(LIBRETRO_COMM_DIR)/compat/compat_fnmatch.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c
$(LIBRETRO_COMMON_C) \
$(LIBRETRO_COMMON_DIR)/compat/compat_strl.c
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c
C_CONVERTER_OBJS := $(C_CONVERTER_C:.c=.o)
@ -35,9 +36,10 @@ RARCHDB_TOOL_C = \
$(LIBRETRODB_DIR)/bintree.c \
$(LIBRETRODB_DIR)/query.c \
$(LIBRETRODB_DIR)/libretrodb.c \
$(LIBRETRO_COMMON_DIR)/compat/compat_fnmatch.c \
$(LIBRETRO_COMM_DIR)/compat/compat_fnmatch.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c
$(LIBRETRO_COMMON_C) \
$(LIBRETRO_COMMON_DIR)/compat/compat_strl.c
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c
RARCHDB_TOOL_OBJS := $(RARCHDB_TOOL_C:.c=.o)

View File

@ -31,6 +31,7 @@
#include <rhash.h>
#include <retro_assert.h>
#include <string/stdstring.h>
#include "libretrodb.h"
@ -341,13 +342,13 @@ static dat_converter_list_t* dat_parser_table(
if (!map.key)
{
if (!strcmp(current->token.label, ")"))
if (string_is_equal(current->token.label, ")"))
{
current++;
*start_token = current;
return parsed_table;
}
else if (!strcmp(current->token.label, "("))
else if (string_is_equal(current->token.label, "("))
{
printf("%s:%d:%d: fatal error: Unexpected '(' instead of key\n",
current->token.fname,
@ -363,14 +364,14 @@ static dat_converter_list_t* dat_parser_table(
}
else
{
if (!strcmp(current->token.label, "("))
if (string_is_equal(current->token.label, "("))
{
current++;
map.type = DAT_CONVERTER_LIST_MAP;
map.value.list = dat_parser_table(&current);
dat_converter_list_append(parsed_table, &map);
}
else if (!strcmp(current->token.label, ")"))
else if (string_is_equal(current->token.label, ")"))
{
printf("%s:%d:%d: fatal error: Unexpected ')' instead of value\n",
current->token.fname,
@ -468,7 +469,7 @@ static const char* dat_converter_get_match(
{
if (list->values[i].map.hash == match_key->hash)
{
retro_assert(!strcmp(list->values[i].map.key, match_key->value));
retro_assert(string_is_equal(list->values[i].map.key, match_key->value));
if (match_key->next)
return dat_converter_get_match(
@ -510,14 +511,14 @@ static dat_converter_list_t* dat_converter_parser(
{
if (!map.key)
{
if (!strcmp(current->token.label, "game"))
if (string_is_equal(current->token.label, "game"))
skip = false;
map.key = current->token.label;
current++;
}
else
{
if (!strcmp(current->token.label, "("))
if (string_is_equal(current->token.label, "("))
{
current++;
map.value.list = dat_parser_table(&current);

View File

@ -23,6 +23,8 @@
#include <stdio.h>
#include <string.h>
#include <string/stdstring.h>
#include "libretrodb.h"
#include "rmsgpack_dom.h"
@ -59,7 +61,7 @@ int main(int argc, char ** argv)
printf("Could not open db file '%s': %s\n", path, strerror(-rv));
goto error;
}
else if (!strcmp(command, "list"))
else if (string_is_equal(command, "list"))
{
if ((rv = libretrodb_cursor_open(db, cur, NULL)) != 0)
{
@ -80,7 +82,7 @@ int main(int argc, char ** argv)
rmsgpack_dom_value_free(&item);
}
}
else if (!strcmp(command, "find"))
else if (string_is_equal(command, "find"))
{
if (argc != 4)
{
@ -111,7 +113,7 @@ int main(int argc, char ** argv)
rmsgpack_dom_value_free(&item);
}
}
else if (!strcmp(command, "create-index"))
else if (string_is_equal(command, "create-index"))
{
const char * index_name, * field_name;