Skip to content

Commit

Permalink
Revert "static variables are initialized to '0' automatically as per …
Browse files Browse the repository at this point in the history
…C rules"

This reverts commit 2a0984b.
  • Loading branch information
LibretroAdmin committed Nov 19, 2024
1 parent 82e4504 commit 2809421
Show file tree
Hide file tree
Showing 23 changed files with 544 additions and 544 deletions.
4 changes: 2 additions & 2 deletions audio/audio_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/**************************************/

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion frontend/drivers/platform_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gfx/display_servers/dispserv_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers/omap_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion gfx/gfx_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions gfx/gfx_thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gfx/gfx_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions gfx/video_crt_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions input/drivers/sdl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -249,7 +249,7 @@ static int16_t sdl_input_state(
if (idx == 0)
{
struct video_viewport vp;
bool screen = device ==
bool screen = device ==
RARCH_DEVICE_POINTER_SCREEN;
const int edge_detect = 32700;
bool inside = false;
Expand All @@ -275,7 +275,7 @@ static int16_t sdl_input_state(
res_y = res_screen_y;
}

inside = (res_x >= -edge_detect)
inside = (res_x >= -edge_detect)
&& (res_y >= -edge_detect)
&& (res_x <= edge_detect)
&& (res_y <= edge_detect);
Expand Down Expand Up @@ -397,7 +397,7 @@ static void sdl_input_poll(void *data)
switch ((int) event.key.keysym.scancode)
{
case SDL_WEBOS_SCANCODE_BACK:
/* Because webOS is sending DOWN/UP at the same time,
/* Because webOS is sending DOWN/UP at the same time,
we save this flag for later */
sdl_webos_special_keymap[sdl_webos_spkey_back] |= event.type == SDL_KEYDOWN;
code = RETROK_BACKSPACE;
Expand Down
2 changes: 1 addition & 1 deletion input/input_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/**************************************/

Expand Down
2 changes: 1 addition & 1 deletion intl/msg_hash_us.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions libretro-common/streams/rzip_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static bool rzipstream_read_file_header(rzipstream_t *stream)
/* Check 'magic numbers' - first 8 bytes
* of header */
if (
(length < RZIP_HEADER_SIZE) ||
(length < RZIP_HEADER_SIZE) ||
(header_bytes[0] != 35) || /* # */
(header_bytes[1] != 82) || /* R */
(header_bytes[2] != 90) || /* Z */
Expand Down Expand Up @@ -270,7 +270,7 @@ static bool rzipstream_init_stream(
stream->in_buf_size = stream->chunk_size;
stream->out_buf_size = stream->chunk_size * 2;
/* > Account for minimum zlib overhead
* of 11 bytes... */
* of 11 bytes... */
stream->out_buf_size =
(stream->out_buf_size < (stream->in_buf_size + 11)) ?
stream->out_buf_size + 11 :
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions libretro-db/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ static struct rmsgpack_dom_value query_func_between(

if (argc != 2)
return res;
if ( argv[0].type != AT_VALUE
if ( argv[0].type != AT_VALUE
|| argv[1].type != AT_VALUE)
return res;
if ( argv[0].a.value.type != RDT_INT
if ( argv[0].a.value.type != RDT_INT
|| argv[1].a.value.type != RDT_INT)
return res;

Expand Down Expand Up @@ -301,7 +301,7 @@ static void query_argument_free(struct argument *arg)
}

static struct buffer query_parse_integer(
char *s, size_t len,
char *s, size_t len,
struct buffer buff,
struct rmsgpack_dom_value *value,
const char **error)
Expand Down Expand Up @@ -495,7 +495,7 @@ static struct buffer query_parse_value(
}
else if (
query_peek(buff, "b", STRLEN_CONST("b"))
|| query_peek(buff, "\"", STRLEN_CONST("\""))
|| query_peek(buff, "\"", STRLEN_CONST("\""))
|| query_peek(buff, "'", STRLEN_CONST("'")))
buff = query_parse_string(s, len,
buff, value, error);
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 2809421

Please sign in to comment.