Revert "(pt. 2) static variables are initialized to '0' automatically as per C rules"

This reverts commit 47410df7a3d2480dd8fc7fb97cf00319ce5e9344.
This commit is contained in:
libretroadmin 2024-11-19 03:03:05 +01:00
parent 47410df7a3
commit 82e4504968
21 changed files with 909 additions and 910 deletions

View File

@ -51,7 +51,7 @@ const bluetooth_driver_t *bluetooth_drivers[] = {
NULL,
};
static bluetooth_driver_state_t bluetooth_driver_st;
static bluetooth_driver_state_t bluetooth_driver_st = {0};
bluetooth_driver_state_t *bluetooth_state_get_ptr(void)
{

View File

@ -58,7 +58,7 @@ const camera_driver_t *camera_drivers[] = {
NULL,
};
static camera_driver_state_t camera_driver_st;
static camera_driver_state_t camera_driver_st = {0};
camera_driver_state_t *camera_state_get_ptr(void)
{

View File

@ -87,13 +87,13 @@ struct remote_joypad_message
uint16_t state;
};
static float tilt_sensor_values[3];
static float gyro_sensor_values[3];
static bool keyboard_state[RETROK_LAST];
static bool keyboard_state_validated[RETROK_LAST];
static bool tilt_sensor_enabled = false;
static bool gyro_sensor_enabled = false;
static bool lux_sensor_enabled = false;
static float tilt_sensor_values[3] = {0};
static float gyro_sensor_values[3] = {0};
static float lux_sensor_value = 0.0f;
static unsigned mouse_type = 0;
static int pointer_x = 0;

View File

@ -112,10 +112,10 @@ typedef enum
} CFDomainMask;
#if (defined(OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200))
static int speak_pid = 0;
static int speak_pid = 0;
#endif
static char darwin_cpu_model_name[64];
static char darwin_cpu_model_name[64] = {0};
static void CFSearchPathForDirectoriesInDomains(
char *s, size_t len)

View File

@ -81,7 +81,7 @@
#define MODULE_PATH "/data/self/system/common/lib/"
#define MODULE_PATH_EXT "/app0/sce_module/"
static char eboot_path[512];
static char eboot_path[512] = {0};
SceKernelModule s_piglet_module;
SceKernelModule s_shacc_module;
@ -160,7 +160,7 @@ static void frontend_orbis_get_env(int *argc, char *argv[],
if (!string_is_empty(argv[CONTENT_PATH_ARG_INDEX]))
{
static char path[PATH_MAX_LENGTH];
static char path[PATH_MAX_LENGTH] = {0};
struct rarch_main_wrap *args =
(struct rarch_main_wrap*)params_data;

View File

@ -50,10 +50,10 @@
#define DEFAULT_PARTITION "hdd0:__common:pfs"
#endif
static char mountPoint[50];
static char mountString[10];
static char cwd[FILENAME_MAX];
static enum frontend_fork ps2_fork_mode = FRONTEND_FORK_NONE;
static char cwd[FILENAME_MAX] = {0};
static char mountString[10] = {0};
static char mountPoint[50] = {0};
static enum HDD_MOUNT_STATUS hddMountStatus = HDD_MOUNT_INIT_STATUS_NOT_READY;
static enum HDD_INIT_STATUS hddStatus = HDD_INIT_STATUS_UNKNOWN;
@ -265,7 +265,7 @@ static void frontend_ps2_get_env(int *argc, char *argv[],
#ifndef IS_SALAMANDER
if (!string_is_empty(argv[1]))
{
static char path[FILENAME_MAX];
static char path[FILENAME_MAX] = {0};
struct rarch_main_wrap *args =
(struct rarch_main_wrap*)params_data;

View File

@ -81,8 +81,8 @@ PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|THREAD_ATTR_VFPU);
unsigned int sceLibcHeapSize = SCE_LIBC_SIZE;
#endif
static char eboot_path[512];
static char user_path[512];
static char eboot_path[512] = {0};
static char user_path[512] = {0};
static enum frontend_fork psp_fork_mode = FRONTEND_FORK_NONE;
static void frontend_psp_get_env_settings(int *argc, char *argv[],

View File

@ -124,7 +124,7 @@ static uint8_t g_platform_android_flags = 0;
#define PROC_ACPI_SYSFS_AC_ADAPTER_PATH "/sys/class/power_supply/ACAD"
#define PROC_ACPI_SYSFS_BATTERY_PATH "/sys/class/power_supply"
#define PROC_ACPI_AC_ADAPTER_PATH "/proc/acpi/ac_adapter"
static char unix_cpu_model_name[64];
static char unix_cpu_model_name[64] = {0};
#endif
/* /proc/meminfo parameters */
@ -1366,7 +1366,7 @@ static void frontend_unix_get_env(int *argc,
if (android_app->getStringExtra && jstr)
{
static char config_path[PATH_MAX_LENGTH];
static char config_path[PATH_MAX_LENGTH] = {0};
const char *argv = (*env)->GetStringUTFChars(env, jstr, 0);
if (argv && *argv)

View File

@ -59,7 +59,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
DWORD volume_device_type;
#endif
#ifndef IS_SALAMANDER
static char path[PATH_MAX_LENGTH];
static char path[PATH_MAX_LENGTH] = {0};
#if defined(_XBOX1)
LAUNCH_DATA ptr;
DWORD launch_type;

View File

@ -73,19 +73,18 @@ Colormap g_x11_cmap;
#ifdef HAVE_XF86VM
static XF86VidModeModeInfo desktop_mode;
#endif
static XConfigureEvent g_x11_xce;
static bool xdg_screensaver_available = true;
static bool g_x11_has_focus = false;
static bool g_x11_true_full = false;
static XConfigureEvent g_x11_xce = {0};
static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW;
static Atom g_x11_quit_atom;
static XIM g_x11_xim;
static XIC g_x11_xic;
static enum retro_key x11_keysym_lut[RETROK_LAST];
static bool xdg_screensaver_available = true;
static bool g_x11_has_focus = false;
static bool g_x11_true_full = false;
static unsigned *x11_keysym_rlut = NULL;
static unsigned x11_keysym_rlut_size = 0;

View File

@ -39,7 +39,7 @@
/* TODO/FIXME - static globals */
static int psp2_model;
static SceCtrlPortInfo old_ctrl_info, curr_ctrl_info;
static SceCtrlActuator actuators[DEFAULT_MAX_PADS];
static SceCtrlActuator actuators[DEFAULT_MAX_PADS] = {0};
#define LERP(p, f, t) ((((p * 10) * (t * 10)) / (f * 10)) / 10)
#define AREA(lx, ly, rx, ry, x, y) (lx <= x && x < rx && ly <= y && y < ry)

View File

@ -198,7 +198,7 @@ struct audio_mixer_voice
};
/* TODO/FIXME - static globals */
static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES];
static struct audio_mixer_voice s_voices[AUDIO_MIXER_MAX_VOICES] = {0};
static unsigned s_rate = 0;
static void audio_mixer_release(audio_mixer_voice_t* voice);

View File

@ -115,8 +115,8 @@ int inet_pton(int af, const char *src, void *dst)
#elif defined(_XBOX)
struct hostent *gethostbyname(const char *name)
{
static struct in_addr addr;
static struct hostent he;
static struct in_addr addr = {0};
static struct hostent he = {0};
WSAEVENT event;
XNDNS *dns = NULL;
struct hostent *ret = NULL;
@ -180,8 +180,8 @@ uint32_t inet_addr(const char *cp)
struct hostent *gethostbyname(const char *name)
{
static struct SceNetInAddr addr;
static struct hostent he;
static struct SceNetInAddr addr = {0};
static struct hostent he = {0};
int rid;
struct hostent *ret = NULL;

View File

@ -31,7 +31,7 @@
#endif
/* TODO/FIXME - static global variable */
static cdrom_toc_t vfs_cdrom_toc;
static cdrom_toc_t vfs_cdrom_toc = {0};
const cdrom_toc_t* retro_vfs_file_get_cdrom_toc(void)
{

View File

@ -61,7 +61,7 @@ typedef struct
unsigned nc;
} webdav_state_t;
static webdav_state_t webdav_driver_st;
static webdav_state_t webdav_driver_st = {0};
webdav_state_t *webdav_state_get_ptr(void)
{

View File

@ -35,7 +35,7 @@ const cloud_sync_driver_t *cloud_sync_drivers[] = {
NULL
};
static cloud_sync_driver_state_t cloud_sync_driver_st;
static cloud_sync_driver_state_t cloud_sync_driver_st = {0};
cloud_sync_driver_state_t *cloud_sync_state_get_ptr(void)
{

View File

@ -53,7 +53,7 @@ extern "C"
}
#endif
static discord_state_t discord_state_st; /* int64_t alignment */
static discord_state_t discord_state_st = {0}; /* int64_t alignment */
discord_state_t *discord_state_get_ptr(void)
{

View File

@ -209,7 +209,7 @@ const mitm_server_t netplay_mitm_server_list[NETPLAY_MITM_SERVERS] = {
{ "custom", MENU_ENUM_LABEL_VALUE_NETPLAY_MITM_SERVER_LOCATION_CUSTOM }
};
static net_driver_state_t networking_driver_st;
static net_driver_state_t networking_driver_st = {0};
net_driver_state_t *networking_state_get_ptr(void)
{

View File

@ -91,7 +91,7 @@ struct netplay_crc_scan_data
char hostname[512];
};
static struct netplay_crc_scan_state scan_state;
static struct netplay_crc_scan_state scan_state = {0};
static bool find_content_by_crc(playlist_config_t *playlist_config,
const struct string_list *playlists, uint32_t crc,

View File

@ -87,7 +87,7 @@ static void task_netplay_lan_scan_callback(retro_task_t *task,
bool task_push_netplay_lan_scan(void (*cb)(const void*), unsigned timeout)
{
static struct netplay_lan_scan_data data;
static struct netplay_lan_scan_data data = {0};
retro_task_t *task;
/* Do not run more than one LAN scan task at a time. */

View File

@ -163,8 +163,8 @@ done:
static void task_netplay_nat_traversal_handler(retro_task_t *task)
{
static struct natt_device device;
static struct natt_discovery discovery = {-1, -1};
static struct natt_device device = {0};
struct nat_traversal_data *data = (struct nat_traversal_data*)task->task_data;
/* Try again on the next call. */