mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Reduce some local char variables which were unnecessarily big,
and reduce some temp char variables
This commit is contained in:
parent
631301b3f7
commit
2ab38eaf98
@ -262,7 +262,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
||||
break;
|
||||
case RARCH_WILDCARD_CORE_REQUESTED_ROTATION:
|
||||
{
|
||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
||||
char rotation_replace_strings[4][64] = {
|
||||
"CORE-REQ-ROT-0",
|
||||
"CORE-REQ-ROT-90",
|
||||
"CORE-REQ-ROT-180",
|
||||
@ -279,7 +279,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
||||
break;
|
||||
case RARCH_WILDCARD_VIDEO_USER_ROTATION:
|
||||
{
|
||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
||||
char rotation_replace_strings[4][64] = {
|
||||
"VID-USER-ROT-0",
|
||||
"VID-USER-ROT-90",
|
||||
"VID-USER-ROT-180",
|
||||
@ -293,7 +293,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
||||
break;
|
||||
case RARCH_WILDCARD_VIDEO_FINAL_ROTATION:
|
||||
{
|
||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
||||
char rotation_replace_strings[4][64] = {
|
||||
"VID-FINAL-ROT-0",
|
||||
"VID-FINAL-ROT-90",
|
||||
"VID-FINAL-ROT-180",
|
||||
@ -304,7 +304,7 @@ static void video_shader_replace_wildcards(char *inout_absolute_path,
|
||||
break;
|
||||
case RARCH_WILDCARD_SCREEN_ORIENTATION:
|
||||
{
|
||||
char rotation_replace_strings[4][PATH_MAX_LENGTH] = {
|
||||
char rotation_replace_strings[4][64] = {
|
||||
"SCREEN-ORIENT-0",
|
||||
"SCREEN-ORIENT-90",
|
||||
"SCREEN-ORIENT-180",
|
||||
@ -2031,7 +2031,7 @@ static bool video_shader_override_values(config_file_t *override_conf,
|
||||
/* If the texture is defined in the reference config */
|
||||
if (config_get_entry(override_conf, shader->lut[i].id))
|
||||
{
|
||||
char *tex_path = (char*)malloc(PATH_MAX_LENGTH);
|
||||
char *tex_path = (char*)malloc(PATH_MAX_LENGTH);
|
||||
|
||||
/* Texture path from the config */
|
||||
config_get_path(override_conf, shader->lut[i].id, tex_path, PATH_MAX_LENGTH);
|
||||
|
37
runloop.c
37
runloop.c
@ -669,7 +669,7 @@ void runloop_runtime_log_deinit(
|
||||
{
|
||||
if (verbosity_is_enabled())
|
||||
{
|
||||
char log[PATH_MAX_LENGTH] = {0};
|
||||
char log[256] = {0};
|
||||
unsigned hours = 0;
|
||||
unsigned minutes = 0;
|
||||
unsigned seconds = 0;
|
||||
@ -1136,8 +1136,8 @@ static bool validate_game_specific_options(char **output)
|
||||
if (!validate_game_options(
|
||||
runloop_st->system.info.library_name,
|
||||
game_options_path,
|
||||
sizeof(game_options_path), false) ||
|
||||
!path_is_valid(game_options_path))
|
||||
sizeof(game_options_path), false)
|
||||
|| !path_is_valid(game_options_path))
|
||||
return false;
|
||||
|
||||
RARCH_LOG("[Core]: %s \"%s\".\n",
|
||||
@ -1182,8 +1182,8 @@ static bool validate_folder_specific_options(
|
||||
|
||||
if (!validate_folder_options(
|
||||
folder_options_path,
|
||||
sizeof(folder_options_path), false) ||
|
||||
!path_is_valid(folder_options_path))
|
||||
sizeof(folder_options_path), false)
|
||||
|| !path_is_valid(folder_options_path))
|
||||
return false;
|
||||
|
||||
RARCH_LOG("[Core]: %s \"%s\".\n",
|
||||
@ -1365,15 +1365,15 @@ static void runloop_core_msg_queue_push(
|
||||
switch (msg->level)
|
||||
{
|
||||
case RETRO_LOG_WARN:
|
||||
category = MESSAGE_QUEUE_CATEGORY_WARNING;
|
||||
category = MESSAGE_QUEUE_CATEGORY_WARNING;
|
||||
break;
|
||||
case RETRO_LOG_ERROR:
|
||||
category = MESSAGE_QUEUE_CATEGORY_ERROR;
|
||||
category = MESSAGE_QUEUE_CATEGORY_ERROR;
|
||||
break;
|
||||
case RETRO_LOG_INFO:
|
||||
case RETRO_LOG_DEBUG:
|
||||
default:
|
||||
category = MESSAGE_QUEUE_CATEGORY_INFO;
|
||||
category = MESSAGE_QUEUE_CATEGORY_INFO;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2921,9 +2921,9 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
/* Can potentially be called every frame,
|
||||
* don't do anything unless required. */
|
||||
if ( (geom->base_width != in_geom->base_width) ||
|
||||
(geom->base_height != in_geom->base_height) ||
|
||||
(geom->aspect_ratio != in_geom->aspect_ratio))
|
||||
if ( (geom->base_width != in_geom->base_width)
|
||||
|| (geom->base_height != in_geom->base_height)
|
||||
|| (geom->aspect_ratio != in_geom->aspect_ratio))
|
||||
{
|
||||
geom->base_width = in_geom->base_width;
|
||||
geom->base_height = in_geom->base_height;
|
||||
@ -4901,8 +4901,8 @@ bool core_options_remove_override(bool game_specific)
|
||||
|
||||
/* Sanity check 1 - if there are no core options
|
||||
* or no overrides are active, there is nothing to do */
|
||||
if ( !coreopts ||
|
||||
( (!(runloop_st->flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE))
|
||||
if ( !coreopts
|
||||
|| ( (!(runloop_st->flags & RUNLOOP_FLAG_GAME_OPTIONS_ACTIVE))
|
||||
&& (!(runloop_st->flags & RUNLOOP_FLAG_FOLDER_OPTIONS_ACTIVE))
|
||||
))
|
||||
return true;
|
||||
@ -7902,9 +7902,9 @@ void runloop_path_set_redirect(settings_t *settings,
|
||||
|
||||
/* Get content directory name, if per-content-directory
|
||||
* saves/states are enabled */
|
||||
if ((sort_savefiles_by_content_enable ||
|
||||
sort_savestates_by_content_enable) &&
|
||||
!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
if ( (sort_savefiles_by_content_enable
|
||||
|| sort_savestates_by_content_enable)
|
||||
&& !string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_parent_dir_name(content_dir_name,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
sizeof(content_dir_name));
|
||||
@ -7917,8 +7917,9 @@ void runloop_path_set_redirect(settings_t *settings,
|
||||
#endif
|
||||
{
|
||||
/* Per-core and/or per-content-directory saves */
|
||||
if ((sort_savefiles_enable || sort_savefiles_by_content_enable)
|
||||
&& !string_is_empty(old_savefile_dir))
|
||||
if (( sort_savefiles_enable
|
||||
|| sort_savefiles_by_content_enable)
|
||||
&& !string_is_empty(old_savefile_dir))
|
||||
{
|
||||
/* Append content directory name to save location */
|
||||
if (sort_savefiles_by_content_enable)
|
||||
|
@ -1939,47 +1939,46 @@ bool content_load_ram_file(unsigned slot)
|
||||
static bool dump_to_file_desperate(const void *data,
|
||||
size_t size, unsigned type)
|
||||
{
|
||||
time_t time_;
|
||||
struct tm tm_;
|
||||
char timebuf[256];
|
||||
char path[PATH_MAX_LENGTH + 256 + 32];
|
||||
char application_data[PATH_MAX_LENGTH];
|
||||
|
||||
application_data[0] = '\0';
|
||||
path [0] = '\0';
|
||||
timebuf [0] = '\0';
|
||||
|
||||
if (!fill_pathname_application_data(application_data,
|
||||
sizeof(application_data)))
|
||||
return false;
|
||||
if (fill_pathname_application_data(path,
|
||||
sizeof(path)))
|
||||
{
|
||||
size_t _len;
|
||||
time_t time_;
|
||||
struct tm tm_;
|
||||
char timebuf[256];
|
||||
timebuf [0] = '\0';
|
||||
time(&time_);
|
||||
|
||||
time(&time_);
|
||||
rtime_localtime(&time_, &tm_);
|
||||
|
||||
rtime_localtime(&time_, &tm_);
|
||||
strftime(timebuf, 256 * sizeof(char),
|
||||
"%Y-%m-%d-%H-%M-%S", &tm_);
|
||||
|
||||
strftime(timebuf,
|
||||
256 * sizeof(char),
|
||||
"%Y-%m-%d-%H-%M-%S", &tm_);
|
||||
_len = strlcat(path, "/RetroArch-recovery-", sizeof(path));
|
||||
|
||||
snprintf(path, sizeof(path),
|
||||
"%s/RetroArch-recovery-%u%s",
|
||||
application_data, type,
|
||||
timebuf);
|
||||
snprintf(path + _len, sizeof(path) - _len,
|
||||
"%u%s", type, timebuf);
|
||||
|
||||
/* Fallback (emergency) saves are always
|
||||
* uncompressed
|
||||
* > If a regular save fails, then the host
|
||||
* system is experiencing serious technical
|
||||
* difficulties (most likely some kind of
|
||||
* hardware failure)
|
||||
* > In this case, we don't want to further
|
||||
* complicate matters by introducing zlib
|
||||
* compression overheads */
|
||||
if (!filestream_write_file(path, data, size))
|
||||
return false;
|
||||
/* Fallback (emergency) saves are always
|
||||
* uncompressed
|
||||
* > If a regular save fails, then the host
|
||||
* system is experiencing serious technical
|
||||
* difficulties (most likely some kind of
|
||||
* hardware failure)
|
||||
* > In this case, we don't want to further
|
||||
* complicate matters by introducing zlib
|
||||
* compression overheads */
|
||||
if (filestream_write_file(path, data, size))
|
||||
{
|
||||
RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_WARN("[SRAM]: Succeeded in saving RAM data to \"%s\".\n", path);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user