Use string_concat in more performance critical areas

This commit is contained in:
twinaphex 2019-04-30 21:17:51 +02:00
parent 4b22522ae0
commit 39eadbab6f
10 changed files with 18 additions and 16 deletions

View File

@ -320,7 +320,7 @@ void dxgi_update_title(video_frame_info_t* video_info)
snprintf(
mem, sizeof(mem), " || MEM: %.2f/%.2fMB", mem_bytes_used / (1024.0f * 1024.0f),
mem_bytes_total / (1024.0f * 1024.0f));
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
string_concat(video_info->fps_text, mem);
#endif
}

View File

@ -497,7 +497,7 @@ static void gfx_ctx_wgl_update_title(void *data, void *data2)
snprintf(
mem, sizeof(mem), " || MEM: %.2f/%.2fMB", mem_bytes_used / (1024.0f * 1024.0f),
mem_bytes_total / (1024.0f * 1024.0f));
strlcat(video_info->fps_text, mem, sizeof(video_info->fps_text));
string_concat(video_info->fps_text, mem);
#endif
}

View File

@ -977,7 +977,7 @@ static void *gl_glsl_init(void *data, const char *path)
snprintf(define, sizeof(define), "#define %s_ALIAS\n",
glsl->shader->pass[i].alias);
strlcat(glsl->alias_define, define, sizeof(glsl->alias_define));
string_concat(glsl->alias_define, define);
}
}

View File

@ -1025,7 +1025,7 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 1; i < shader->num_parameters; i++)
{
/* O(n^2), but number of parameters is very limited. */
strlcat(parameters, ";", param_size);
string_concat(parameters, ";");
strlcat(parameters, shader->parameters[i].id, param_size);
}
@ -1052,7 +1052,7 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 1; i < shader->luts; i++)
{
/* O(n^2), but number of textures is very limited. */
strlcat(textures, ";", tex_size);
string_concat(textures, ";");
strlcat(textures, shader->lut[i].id, tex_size);
}
@ -1106,7 +1106,7 @@ void video_shader_write_conf_cgp(config_file_t *conf,
for (i = 1; i < shader->variables; i++)
{
strlcat(variables, ";", var_tmp);
string_concat(variables, ";");
strlcat(variables, shader->variable[i].id, var_tmp);
}

View File

@ -435,7 +435,7 @@ void fill_pathname_slash(char *path, size_t size)
join_str[0] = '\0';
strlcpy(join_str, last_slash, sizeof(join_str));
strlcat(path, join_str, size);
string_concat(path, join_str);
}
}

View File

@ -570,7 +570,7 @@ static int general_push(menu_displaylist_info_t *info,
#elif defined(HAVE_MPV)
libretro_mpv_retro_get_system_info(&sysinfo);
#endif
strlcat(newstring2, "|", PATH_MAX_LENGTH * sizeof(char));
string_concat(newstring2, "|");
strlcat(newstring2, sysinfo.valid_extensions,
PATH_MAX_LENGTH * sizeof(char));
}
@ -579,8 +579,7 @@ static int general_push(menu_displaylist_info_t *info,
if (settings->bools.multimedia_builtin_imageviewer_enable)
{
libretro_imageviewer_retro_get_system_info(&sysinfo);
strlcat(newstring2, "|",
PATH_MAX_LENGTH * sizeof(char));
string_concat(newstring2, "|");
strlcat(newstring2, sysinfo.valid_extensions,
PATH_MAX_LENGTH * sizeof(char));
}

View File

@ -335,8 +335,8 @@ static int action_get_title_group_settings(const char *path, const char *label,
if (!string_is_empty(elem1))
{
strlcat(s, " - ", len);
strlcat(s, elem1, len);
string_concat(s, " - ");
string_concat(s, elem1);
}
}

View File

@ -1966,7 +1966,7 @@ static void xmb_context_reset_horizontal_list(
if (!filestream_exists(content_texturepath))
{
strlcat(iconpath, "default", PATH_MAX_LENGTH * sizeof(char));
string_concat(iconpath, "default");
fill_pathname_join_delim(content_texturepath, iconpath,
file_path_str(FILE_PATH_CONTENT_BASENAME), '-',
PATH_MAX_LENGTH * sizeof(char));

View File

@ -21,6 +21,7 @@
#include <encodings/utf.h>
#include <retro_math.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include <features/features_cpu.h>
#define DG_DYNARR_IMPLEMENTATION
@ -679,7 +680,7 @@ bool menu_animation_ticker(menu_animation_ctx_ticker_t *ticker)
if (!ticker->selected)
{
utf8cpy(ticker->s, PATH_MAX_LENGTH, ticker->str, ticker->len - 3);
strlcat(ticker->s, "...", PATH_MAX_LENGTH);
string_concat(ticker->s, "...");
return false;
}

View File

@ -1125,7 +1125,8 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
strlcat(path_base,
file_path_str(FILE_PATH_LPL_EXTENSION),
sizeof(path_base));
sizeof(path_base)
);
fill_pathname_join(path_playlist,
settings->paths.directory_playlist, path_base,
@ -2100,7 +2101,8 @@ static int menu_displaylist_parse_horizontal_content_actions(
PATH_MAX_LENGTH * sizeof(char));
strlcat(db_path,
file_path_str(FILE_PATH_RDB_EXTENSION),
PATH_MAX_LENGTH * sizeof(char));
PATH_MAX_LENGTH * sizeof(char)
);
if (path_is_valid(db_path))
menu_entries_append_enum(