Cleanups - prevent implicit memsets

This commit is contained in:
twinaphex 2016-10-16 02:00:59 +02:00
parent f75a604ae8
commit df87fc7043
3 changed files with 24 additions and 14 deletions

8
dirs.c
View File

@ -108,8 +108,7 @@ bool dir_free_shader(void)
**/
void dir_check_shader(bool pressed_next, bool pressed_prev)
{
char msg[128] = {0};
char msg[128];
const char *shader = NULL;
enum rarch_shader_type type = RARCH_SHADER_NONE;
struct rarch_dir_list *dir_list = (struct rarch_dir_list*)&dir_shader_list;
@ -153,6 +152,8 @@ void dir_check_shader(bool pressed_next, bool pressed_prev)
return;
}
msg[0] = '\0';
snprintf(msg, sizeof(msg), "%s #%u: \"%s\".",
msg_hash_to_str(MSG_SHADER),
(unsigned)dir_list->ptr, shader);
@ -336,7 +337,8 @@ void dir_set(enum rarch_dir_type type, const char *path)
static void check_defaults_dir_create_dir(const char *path)
{
char new_path[PATH_MAX_LENGTH] = {0};
char new_path[PATH_MAX_LENGTH];
new_path[0] = '\0';
fill_pathname_expand_special(new_path,
path, sizeof(new_path));

View File

@ -274,8 +274,10 @@ static int file_archive_extract_cb(const char *name, const char *valid_exts,
static int file_archive_parse_file_init(file_archive_transfer_t *state,
const char *file)
{
char path[PATH_MAX_LENGTH];
char *last = NULL;
char path[PATH_MAX_LENGTH] = {0};
path[0] = '\0';
strlcpy(path, file, sizeof(path));
@ -796,11 +798,11 @@ const struct file_archive_file_backend* file_archive_get_file_backend(const char
uint32_t file_archive_get_file_crc32(const char *path)
{
const struct file_archive_file_backend *backend = file_archive_get_file_backend(path);
file_archive_transfer_t state = {0};
struct archive_extract_userdata userdata = {{0}};
bool returnerr = false;
bool contains_compressed = false;
const char *archive_path = NULL;
file_archive_transfer_t state = {0};
struct archive_extract_userdata userdata = {{0}};
bool returnerr = false;
bool contains_compressed = false;
const char *archive_path = NULL;
if (!backend)
return 0;

16
paths.c
View File

@ -61,8 +61,8 @@ static char path_core_options_file[PATH_MAX_LENGTH] = {0};
void path_set_redirect(void)
{
char new_savefile_dir[PATH_MAX_LENGTH] = {0};
char new_savestate_dir[PATH_MAX_LENGTH] = {0};
char new_savefile_dir[PATH_MAX_LENGTH];
char new_savestate_dir[PATH_MAX_LENGTH];
uint32_t library_name_hash = 0;
bool check_library_name_hash = false;
rarch_system_info_t *info = NULL;
@ -70,6 +70,8 @@ void path_set_redirect(void)
const char *old_savefile_dir = dir_get(RARCH_DIR_SAVEFILE);
const char *old_savestate_dir = dir_get(RARCH_DIR_SAVESTATE);
new_savefile_dir[0] = new_savestate_dir[0] = '\0';
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info && info->info.library_name &&
@ -321,12 +323,14 @@ static bool path_init_subsystem(void)
for (j = 0; j < info->roms[i].num_memory; j++)
{
union string_list_elem_attr attr;
char path[PATH_MAX_LENGTH] = {0};
char ext[32] = {0};
char path[PATH_MAX_LENGTH];
char ext[32];
const struct retro_subsystem_memory_info *mem =
(const struct retro_subsystem_memory_info*)
&info->roms[i].memory[j];
path[0] = ext[0] = '\0';
snprintf(ext, sizeof(ext), ".%s", mem->extension);
if (path_is_directory(dir_get(RARCH_DIR_SAVEFILE)))
@ -693,7 +697,9 @@ void path_clear_all(void)
enum rarch_content_type path_is_media_type(const char *path)
{
char ext_lower[PATH_MAX_LENGTH] = {0};
char ext_lower[PATH_MAX_LENGTH];
ext_lower[0] = '\0';
strlcpy(ext_lower, path_get_extension(path), sizeof(ext_lower));