mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 21:40:02 +00:00
(glslang_utill.c) One less string copy per iteration
This commit is contained in:
parent
1975235fd7
commit
a9b0e45013
@ -28,17 +28,17 @@
|
||||
#include "glslang_util.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
static void get_include_file(const char *line, char *s, size_t len)
|
||||
static char *slang_get_include_file(const char *line)
|
||||
{
|
||||
char *end = NULL;
|
||||
char *start = (char*)strchr(line, '\"');
|
||||
if (!start)
|
||||
return;
|
||||
return NULL;
|
||||
start++;
|
||||
if (!(end = (char*)strchr(start, '\"')))
|
||||
return;
|
||||
return NULL;
|
||||
*end = '\0';
|
||||
strlcpy(s, start, len);
|
||||
return start;
|
||||
}
|
||||
|
||||
bool slang_texture_semantic_is_array(enum slang_texture_semantic sem)
|
||||
@ -193,15 +193,8 @@ bool glslang_read_shader_file(const char *path,
|
||||
bool include_optional = !strncmp("#pragma include_optional ", line, STRLEN_CONST("#pragma include_optional "));
|
||||
if ( !strncmp("#include ", line, STRLEN_CONST("#include ")) || include_optional )
|
||||
{
|
||||
|
||||
char include_file[PATH_MAX_LENGTH];
|
||||
char include_path[PATH_MAX_LENGTH];
|
||||
|
||||
include_file[0] = '\0';
|
||||
include_path[0] = '\0';
|
||||
|
||||
/* Build include file path */
|
||||
get_include_file(line, include_file, sizeof(include_file));
|
||||
char *include_file = slang_get_include_file(line);
|
||||
|
||||
if (string_is_empty(include_file))
|
||||
{
|
||||
@ -209,6 +202,7 @@ bool glslang_read_shader_file(const char *path,
|
||||
goto error;
|
||||
}
|
||||
|
||||
include_path[0] = '\0';
|
||||
fill_pathname_resolve_relative(
|
||||
include_path, path, include_file, sizeof(include_path));
|
||||
|
||||
|
@ -185,7 +185,7 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars)
|
||||
sb++;
|
||||
}
|
||||
|
||||
if ((size_t)(sb - sb_org) > d_len-1 /* NUL */)
|
||||
if ((size_t)(sb - sb_org) > d_len-1)
|
||||
{
|
||||
sb = sb_org + d_len-1;
|
||||
while ((*sb & 0xC0) == 0x80)
|
||||
|
Loading…
x
Reference in New Issue
Block a user