mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 00:40:09 +00:00
Try to avoid directly calling strcmp
This commit is contained in:
parent
82c62b1693
commit
dd517f4660
@ -45,6 +45,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include <rthreads/rthreads.h>
|
#include <rthreads/rthreads.h>
|
||||||
#include <queues/fifo_queue.h>
|
#include <queues/fifo_queue.h>
|
||||||
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
#include <libretro.h>
|
#include <libretro.h>
|
||||||
#ifdef RARCH_INTERNAL
|
#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 (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;
|
temporal_interpolation = true;
|
||||||
else if (!strcmp(var.value, "disabled"))
|
else if (string_is_equal(var.value, "disabled"))
|
||||||
temporal_interpolation = false;
|
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)
|
if (CORE_PREFIX(environ_cb)(RETRO_ENVIRONMENT_GET_VARIABLE, &color_var) && color_var.value)
|
||||||
{
|
{
|
||||||
slock_lock(decode_thread_lock);
|
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;
|
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;
|
colorspace = AVCOL_SPC_BT470BG;
|
||||||
else if (!strcmp(color_var.value, "FCC"))
|
else if (string_is_equal(color_var.value, "FCC"))
|
||||||
colorspace = AVCOL_SPC_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;
|
colorspace = AVCOL_SPC_SMPTE240M;
|
||||||
else
|
else
|
||||||
colorspace = AVCOL_SPC_UNSPECIFIED;
|
colorspace = AVCOL_SPC_UNSPECIFIED;
|
||||||
|
@ -59,7 +59,10 @@
|
|||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct video_buffer {
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
|
struct video_buffer
|
||||||
|
{
|
||||||
void *start;
|
void *start;
|
||||||
size_t len;
|
size_t len;
|
||||||
};
|
};
|
||||||
@ -215,7 +218,7 @@ enumerate_audio_devices(char *buf, size_t buflen)
|
|||||||
{
|
{
|
||||||
name = snd_device_name_get_hint(*n, "NAME");
|
name = snd_device_name_get_hint(*n, "NAME");
|
||||||
ioid = snd_device_name_get_hint(*n, "IOID");
|
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, "hw:", strlen("hw:")) ||
|
||||||
!strncmp(name, "default:", strlen("default:"))))
|
!strncmp(name, "default:", strlen("default:"))))
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
#include <libretro_dspfilter.h>
|
#include <libretro_dspfilter.h>
|
||||||
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
#define sqr(a) ((a) * (a))
|
#define sqr(a) ((a) * (a))
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ static void iir_process(void *data, struct dspfilter_output *output,
|
|||||||
iir->r.yn2 = yn2_r;
|
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)
|
static enum IIRFilter str_to_type(const char *str)
|
||||||
{
|
{
|
||||||
CHECK(LPF);
|
CHECK(LPF);
|
||||||
|
@ -59,7 +59,7 @@ bool path_mkdir(const char *dir)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
path_parent_dir(basedir);
|
path_parent_dir(basedir);
|
||||||
if (!*basedir || !strcmp(basedir, dir))
|
if (!*basedir || string_is_equal(basedir, dir))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (path_is_directory(basedir))
|
if (path_is_directory(basedir))
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <streams/file_stream.h>
|
#include <streams/file_stream.h>
|
||||||
#include <compat/posix_string.h>
|
#include <compat/posix_string.h>
|
||||||
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
#include <formats/rxml.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;
|
struct rxml_attrib_node *attribs = NULL;
|
||||||
for (attribs = node->attrib; attribs; attribs = attribs->next)
|
for (attribs = node->attrib; attribs; attribs = attribs->next)
|
||||||
{
|
{
|
||||||
if (!strcmp(attrib, attribs->attrib))
|
if (string_is_equal(attrib, attribs->attrib))
|
||||||
return attribs->value;
|
return attribs->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +437,7 @@ void SHA1PadMessage(SHA1Context *context)
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <string/stdstring.h>
|
||||||
/*#include "sha1.h"*/
|
/*#include "sha1.h"*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -477,8 +478,8 @@ int main(int argc, char *argv[])
|
|||||||
* Check the program arguments and print usage information if -?
|
* Check the program arguments and print usage information if -?
|
||||||
* or --help is passed as the first argument.
|
* or --help is passed as the first argument.
|
||||||
*/
|
*/
|
||||||
if (argc > 1 && (!strcmp(argv[1],"-?") ||
|
if (argc > 1 && (string_is_equal(argv[1],"-?") ||
|
||||||
!strcmp(argv[1],"--help")))
|
string_is_equal(argv[1],"--help")))
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
return 1;
|
return 1;
|
||||||
@ -498,7 +499,7 @@ int main(int argc, char *argv[])
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (argc == 1 || !strcmp(argv[i],"-"))
|
if (argc == 1 || string_is_equal(argv[i],"-"))
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
setmode(fileno(stdin), _O_BINARY);
|
setmode(fileno(stdin), _O_BINARY);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <string/stdstring.h>
|
||||||
|
|
||||||
int libretrodb_lua_to_rmsgpack_value(lua_State *L, int index,
|
int libretrodb_lua_to_rmsgpack_value(lua_State *L, int index,
|
||||||
struct rmsgpack_dom_value * out)
|
struct rmsgpack_dom_value * out)
|
||||||
{
|
{
|
||||||
@ -137,7 +139,7 @@ set_nil:
|
|||||||
int j;
|
int j;
|
||||||
for(j = 0; j < out->val.map.len; 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];
|
*ordered_pairs_outp++ = out->val.map.items[j];
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user