Revert "static variables are initialized to '0' automatically as per C rules"
Some checks are pending
CI 3DS / build (push) Waiting to run
CI Android / build (push) Waiting to run
CI DOS/DJGPP / build (push) Waiting to run
CI Emscripten / build (push) Waiting to run
CI GameCube / build (push) Waiting to run
CI Linux (i686) / build (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Debug, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2019) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, 2022) (push) Waiting to run
CI Windows (MSVC) / msvc (Release, x64, UWP) (push) Waiting to run
CI Windows (MSVC) / msvc (ReleaseAngle, x64, UWP) (push) Waiting to run
CI macOS / build (push) Waiting to run
CI Miyoo ARM32 / build (push) Waiting to run
CI PS2 / build (push) Waiting to run
CI PS4/ORBIS / build (push) Waiting to run
CI PSP / build (push) Waiting to run
CI PSVita / build (push) Waiting to run
CI RS90 Odbeta MIPS32 / build (push) Waiting to run
CI RetroFW MIPS32 / build (push) Waiting to run
CI Switch/libnx / build (push) Waiting to run
CI Wii / build (push) Waiting to run
CI WiiU / build (push) Waiting to run
CI Windows i686 (MXE) / build (push) Waiting to run
CI Windows x64 (MXE) / build (push) Waiting to run
RetroArch CI / linux-c89 (push) Waiting to run
CI webOS / build (push) Waiting to run

This reverts commit 2a0984b6e4.
This commit is contained in:
libretroadmin 2024-11-19 03:03:13 +01:00
parent 82e4504968
commit 2809421d4e
23 changed files with 544 additions and 544 deletions

View File

@ -172,7 +172,7 @@ audio_driver_t *audio_drivers[] = {
NULL,
};
static audio_driver_state_t audio_driver_st; /* double alignment */
static audio_driver_state_t audio_driver_st = {0}; /* double alignment */
/**************************************/
@ -1872,7 +1872,7 @@ bool audio_compute_buffer_statistics(audio_statistics_t *stats)
#ifdef HAVE_MENU
void audio_driver_menu_sample(void)
{
static int16_t samples_buf[1024];
static int16_t samples_buf[1024] = {0};
settings_t *settings = config_get_ptr();
video_driver_state_t *video_st = video_state_get_ptr();
uint32_t runloop_flags = runloop_get_flags();

View File

@ -85,7 +85,7 @@ static uint8_t g_plat_win32_flags = PLAT_WIN32_FLAG_USE_POWERSHELL;
VOID (WINAPI *DragAcceptFiles_func)(HWND, BOOL);
/* TODO/FIXME - static global variables */
static char win32_cpu_model_name[64];
static char win32_cpu_model_name[64] = {0};
#ifdef HAVE_DYLIB
/* We only load this library once, so we let it be
* unloaded at application shutdown, since unloading

View File

@ -43,10 +43,10 @@ static void android_display_server_set_screen_orientation(void *data,
static void android_display_dpi_get_density(char *s, size_t len)
{
static char string[PROP_VALUE_MAX];
static char string2[PROP_VALUE_MAX];
static bool inited_once = false;
static bool inited2_once = false;
static char string[PROP_VALUE_MAX] = {0};
static char string2[PROP_VALUE_MAX] = {0};
if (!inited_once)
{
system_property_get("getprop", "ro.sf.lcd_density", string);

View File

@ -85,7 +85,7 @@ typedef struct omapfb_data
static const char *omapfb_get_fb_device(void)
{
static char fbname[12];
static char fbname[12] = {0};
settings_t *settings = config_get_ptr();
const int fbidx = settings->uints.video_monitor_index;

View File

@ -35,7 +35,7 @@
static uintptr_t gfx_white_texture;
/* ptr alignment */
static gfx_display_t dispgfx_st;
static gfx_display_t dispgfx_st = {0};
gfx_display_t *disp_get_ptr(void)
{

View File

@ -46,7 +46,7 @@ typedef struct
gfx_thumbnail_t *thumbnail;
} gfx_thumbnail_tag_t;
static gfx_thumbnail_state_t gfx_thumb_st; /* uint64_t alignment */
static gfx_thumbnail_state_t gfx_thumb_st = {0}; /* uint64_t alignment */
gfx_thumbnail_state_t *gfx_thumb_get_ptr(void)
{
@ -289,10 +289,10 @@ void gfx_thumbnail_request(
/* Handle on demand thumbnail downloads */
else if (network_on_demand_thumbnails)
{
static char last_img_name[NAME_MAX_LENGTH];
enum playlist_thumbnail_name_flags curr_flag;
const char *system = NULL;
const char *img_name = NULL;
static char last_img_name[NAME_MAX_LENGTH] = {0};
settings_t *settings = config_get_ptr();
if (!playlist)
goto end;

View File

@ -65,7 +65,7 @@ static const char
"menu_achievements.png"
};
static dispgfx_widget_t dispwidget_st; /* uint64_t alignment */
static dispgfx_widget_t dispwidget_st = {0}; /* uint64_t alignment */
static void INLINE gfx_widgets_font_free(gfx_widget_font_data_t *font_data)
{

View File

@ -515,12 +515,12 @@ static void crt_rpi_switch(videocrt_switch_t *p_switch,
{
int w;
char buffer[1024];
static char output1[250];
static char output2[250];
static char set_hdmi[250];
static char set_hdmi_timing[250];
VCHI_INSTANCE_T vchi_instance;
VCHI_CONNECTION_T *vchi_connection = NULL;
static char output1[250] = {0};
static char output2[250] = {0};
static char set_hdmi[250] = {0};
static char set_hdmi_timing[250] = {0};
int i = 0;
int hfp = 0;
int hsp = 0;

View File

@ -3229,10 +3229,10 @@ const char* video_driver_get_gpu_api_version_string(void)
bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled)
{
video_info_t video;
static uint16_t dummy_pixels[32];
unsigned max_dim, scale, width, height;
video_viewport_t *custom_vp = NULL;
input_driver_t *tmp = NULL;
static uint16_t dummy_pixels[32] = {0};
runloop_state_t *runloop_st = runloop_state_get_ptr();
settings_t *settings = config_get_ptr();
input_driver_state_t *input_st = input_state_get_ptr();

View File

@ -63,7 +63,7 @@ enum sdl_webos_special_key
sdl_webos_spkey_size,
};
static uint8_t sdl_webos_special_keymap[sdl_webos_spkey_size];
static uint8_t sdl_webos_special_keymap[sdl_webos_spkey_size] = {0};
#endif
static void *sdl_input_init(const char *joypad_driver)

View File

@ -396,7 +396,7 @@ hid_driver_t *hid_drivers[] = {
};
#endif
static input_driver_state_t input_driver_st; /* double alignment */
static input_driver_state_t input_driver_st = {0}; /* double alignment */
/**************************************/

View File

@ -518,7 +518,7 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg)
if ( msg <= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_END
&& msg >= MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN)
{
static char hotkey_lbl[128];
static char hotkey_lbl[128] = {0};
unsigned idx = msg - MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN;
snprintf(hotkey_lbl, sizeof(hotkey_lbl), "input_hotkey_binds_%d", idx);
return hotkey_lbl;

View File

@ -846,7 +846,7 @@ int rzipstream_putc(rzipstream_t *stream, int c)
* in the event of an error */
int rzipstream_vprintf(rzipstream_t *stream, const char* format, va_list args)
{
static char buffer[8 * 1024];
static char buffer[8 * 1024] = {0};
int64_t num_chars = vsnprintf(buffer,
sizeof(buffer), format, args);

View File

@ -921,7 +921,7 @@ void *libretrodb_query_compile(libretrodb_t *db,
{
struct buffer buff;
/* TODO/FIXME - static local variable */
static char tmp_error_buff [MAX_ERROR_LEN];
static char tmp_error_buff [MAX_ERROR_LEN] = {0};
struct query *q = (struct query*)malloc(sizeof(*q));
size_t error_buff_len = sizeof(tmp_error_buff);

View File

@ -5212,7 +5212,7 @@ void cb_generic_download(retro_task_t *task,
case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_SLANG:
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
{
static char shaderdir[DIR_MAX_LENGTH];
static char shaderdir[DIR_MAX_LENGTH] = {0};
const char *dirname = NULL;
const char *dir_video_shader = settings->paths.directory_video_shader;

View File

@ -55,7 +55,7 @@ const wifi_driver_t *wifi_drivers[] = {
NULL,
};
static wifi_driver_state_t wifi_driver_st; /* double alignment */
static wifi_driver_state_t wifi_driver_st = {0}; /* double alignment */
wifi_driver_state_t *wifi_state_get_ptr(void)
{

View File

@ -1334,7 +1334,7 @@ bool playlist_push(playlist_t *playlist,
if (string_is_empty(core_name))
{
static char base_path[NAME_MAX_LENGTH];
static char base_path[NAME_MAX_LENGTH] = {0};
fill_pathname_base(base_path, real_core_path, sizeof(base_path));
path_remove_extension(base_path);

View File

@ -34,7 +34,7 @@
#include "drivers/record_ffmpeg.h"
#include "drivers/record_wav.h"
static recording_state_t recording_state;
static recording_state_t recording_state = {0};
static const record_driver_t record_null = {
NULL, /* new */

View File

@ -330,14 +330,14 @@ struct rarch_state
void libnx_apply_overclock(void);
#endif
static struct rarch_state rarch_st;
static struct rarch_state rarch_st = {0};
#ifdef HAVE_THREAD_STORAGE
static const void *MAGIC_POINTER = (void*)(uintptr_t)0x0DEFACED;
#endif
static access_state_t access_state_st;
static struct global global_driver_st; /* retro_time_t alignment */
static access_state_t access_state_st = {0};
static struct global global_driver_st = {0}; /* retro_time_t alignment */
static void retro_frame_null(const void *data, unsigned width,
unsigned height, size_t pitch) { }
@ -361,7 +361,7 @@ static const location_driver_t *location_drivers[] = {
NULL,
};
static location_driver_state_t location_driver_st;
static location_driver_state_t location_driver_st = {0};
location_driver_state_t *location_state_get_ptr(void)
{

View File

@ -322,7 +322,7 @@
#define PERF_LOG_FMT "[PERF]: Avg (%s): %llu ticks, %llu runs.\n"
#endif
static runloop_state_t runloop_state;
static runloop_state_t runloop_state = {0};
/* GLOBAL POINTER GETTERS */
runloop_state_t *runloop_state_get_ptr(void)
@ -6740,7 +6740,7 @@ static enum runloop_state_enum runloop_check_state(
if (settings->bools.video_shader_watch_files)
{
static rarch_timer_t timer;
static rarch_timer_t timer = {0};
static bool need_to_apply = false;
if (video_shader_check_for_changes())

View File

@ -990,7 +990,7 @@ static unsigned char invader_png[] = {
};
static unsigned int invader_png_len = 4008;
static ui_window_qt_t ui_window;
static ui_window_qt_t ui_window = {0};
static const QPixmap getInvader(void)
{

View File

@ -63,7 +63,7 @@ static const ui_companion_driver_t *ui_companion_drivers[] = {
};
static uico_driver_state_t uico_driver_st; /* double alignment */
static uico_driver_state_t uico_driver_st = {0}; /* double alignment */
uico_driver_state_t *uico_state_get_ptr(void)
{

View File

@ -457,7 +457,7 @@ void rarch_log_file_init(
char log_file_path[PATH_MAX_LENGTH];
verbosity_state_t *g_verbosity = &main_verbosity_st;
static bool log_file_created = false;
static char timestamped_log_file_name[64];
static char timestamped_log_file_name[64] = {0};
bool logging_to_file = g_verbosity->initialized;