Try to avoid directly calling strcmp

This commit is contained in:
twinaphex 2017-04-21 13:56:15 +02:00
parent 82c62b1693
commit dd517f4660
7 changed files with 24 additions and 15 deletions

View File

@ -45,6 +45,7 @@ extern "C" {
#include <rthreads/rthreads.h>
#include <queues/fifo_queue.h>
#include <string/stdstring.h>
#include <libretro.h>
#ifdef RARCH_INTERNAL
@ -339,9 +340,9 @@ static void check_variables(void)
if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "enabled"))
if (string_is_equal(var.value, "enabled"))
temporal_interpolation = true;
else if (!strcmp(var.value, "disabled"))
else if (string_is_equal(var.value, "disabled"))
temporal_interpolation = false;
}
@ -373,13 +374,13 @@ static void check_variables(void)
if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &color_var) && color_var.value)
{
slock_lock(decode_thread_lock);
if (!strcmp(color_var.value, "BT.709"))
if (string_is_equal(color_var.value, "BT.709"))
colorspace = AVCOL_SPC_BT709;
else if (!strcmp(color_var.value, "BT.601"))
else if (string_is_equal(color_var.value, "BT.601"))
colorspace = AVCOL_SPC_BT470BG;
else if (!strcmp(color_var.value, "FCC"))
else if (string_is_equal(color_var.value, "FCC"))
colorspace = AVCOL_SPC_FCC;
else if (!strcmp(color_var.value, "SMPTE240M"))
else if (string_is_equal(color_var.value, "SMPTE240M"))
colorspace = AVCOL_SPC_SMPTE240M;
else
colorspace = AVCOL_SPC_UNSPECIFIED;

View File

@ -59,7 +59,10 @@
#include <libudev.h>
#endif
struct video_buffer {
#include <string/stdstring.h>
struct video_buffer
{
void *start;
size_t len;
};
@ -215,7 +218,7 @@ enumerate_audio_devices(char *buf, size_t buflen)
{
name = snd_device_name_get_hint(*n, "NAME");
ioid = snd_device_name_get_hint(*n, "IOID");
if ((ioid == NULL || !strcmp(ioid, "Input")) &&
if ((ioid == NULL || string_is_equal(ioid, "Input")) &&
(!strncmp(name, "hw:", strlen("hw:")) ||
!strncmp(name, "default:", strlen("default:"))))
{

View File

@ -26,6 +26,7 @@
#include <retro_miscellaneous.h>
#include <libretro_dspfilter.h>
#include <string/stdstring.h>
#define sqr(a) ((a) * (a))
@ -123,7 +124,7 @@ static void iir_process(void *data, struct dspfilter_output *output,
iir->r.yn2 = yn2_r;
}
#define CHECK(x) if (!strcmp(str, #x)) return x
#define CHECK(x) if (string_is_equal(str, #x)) return x
static enum IIRFilter str_to_type(const char *str)
{
CHECK(LPF);

View File

@ -59,7 +59,7 @@ bool path_mkdir(const char *dir)
return false;
path_parent_dir(basedir);
if (!*basedir || !strcmp(basedir, dir))
if (!*basedir || string_is_equal(basedir, dir))
goto end;
if (path_is_directory(basedir))

View File

@ -31,6 +31,7 @@
#include <boolean.h>
#include <streams/file_stream.h>
#include <compat/posix_string.h>
#include <string/stdstring.h>
#include <formats/rxml.h>
@ -483,7 +484,7 @@ char *rxml_node_attrib(struct rxml_node *node, const char *attrib)
struct rxml_attrib_node *attribs = NULL;
for (attribs = node->attrib; attribs; attribs = attribs->next)
{
if (!strcmp(attrib, attribs->attrib))
if (string_is_equal(attrib, attribs->attrib))
return attribs->value;
}

View File

@ -437,6 +437,7 @@ void SHA1PadMessage(SHA1Context *context)
#include <io.h>
#endif
#include <fcntl.h>
#include <string/stdstring.h>
/*#include "sha1.h"*/
/*
@ -477,8 +478,8 @@ int main(int argc, char *argv[])
* Check the program arguments and print usage information if -?
* or --help is passed as the first argument.
*/
if (argc > 1 && (!strcmp(argv[1],"-?") ||
!strcmp(argv[1],"--help")))
if (argc > 1 && (string_is_equal(argv[1],"-?") ||
string_is_equal(argv[1],"--help")))
{
usage();
return 1;
@ -498,7 +499,7 @@ int main(int argc, char *argv[])
if (i == 0)
i++;
if (argc == 1 || !strcmp(argv[i],"-"))
if (argc == 1 || string_is_equal(argv[i],"-"))
{
#ifdef WIN32
setmode(fileno(stdin), _O_BINARY);

View File

@ -3,6 +3,8 @@
#include <stdlib.h>
#include <string.h>
#include <string/stdstring.h>
int libretrodb_lua_to_rmsgpack_value(lua_State *L, int index,
struct rmsgpack_dom_value * out)
{
@ -137,7 +139,7 @@ set_nil:
int j;
for(j = 0; j < out->val.map.len; j++)
{
if(!strcmp(ordered_keys[i], out->val.map.items[j].key.val.string.buff))
if(string_is_equal(ordered_keys[i], out->val.map.items[j].key.val.string.buff))
{
*ordered_pairs_outp++ = out->val.map.items[j];
break;