summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuna Oh <duna.oh@samsung.com>2016-04-20 08:33:20 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-04-20 08:33:20 -0400
commitfbe4e4b6adcd1fadb22aa838836254673e2bbb86 (patch)
tree56390f69044fd6e44dc1513a7b51fa900036b49f
parent115b69fd479a08db2e8b401f28aa6867179e5de3 (diff)
downloadefl-fbe4e4b6adcd1fadb22aa838836254673e2bbb86.tar.gz
Ecore: Use calloc() to initialize Ecore_Event_Mouse_XXXX
Summary: To ensure initialize all fields of Ecore_Event_Mouse_XXX, use calloc() instead of malloc(). Test Plan: N/A Reviewers: gwanglim, cedric, raster, devilhorns, ManMower, zmike Subscribers: jpeg, input.hacker, JHyun Differential Revision: https://phab.enlightenment.org/D3906
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m2
-rw-r--r--src/lib/ecore_psl1ght/ecore_psl1ght.c6
-rw-r--r--src/lib/ecore_sdl/ecore_sdl.c8
-rw-r--r--src/lib/ecore_wayland/ecore_wl_input.c8
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_events.c6
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_events.c8
6 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 012fd11fe4..6197d58eed 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -295,7 +295,7 @@ _ecore_cocoa_feed_events(void *anEvent)
Ecore_Event_Mouse_Wheel *ev;
float dx, dy = 0;
- ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!ev) return pass;
if ([event hasPreciseScrollingDeltas])
diff --git a/src/lib/ecore_psl1ght/ecore_psl1ght.c b/src/lib/ecore_psl1ght/ecore_psl1ght.c
index 7f2e9ca592..adc0595432 100644
--- a/src/lib/ecore_psl1ght/ecore_psl1ght.c
+++ b/src/lib/ecore_psl1ght/ecore_psl1ght.c
@@ -383,7 +383,7 @@ _ecore_psl1ght_mouse_move(s32 x_axis, s32 y_axis)
{
Ecore_Event_Mouse_Move *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Move));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!ev) return;
mouse_x += x_axis;
@@ -416,7 +416,7 @@ _ecore_psl1ght_mouse_button(int button, int pressed)
Ecore_Event_Mouse_Button *ev;
static unsigned int previous_timestamp = 0;
- ev = malloc(sizeof(Ecore_Event_Mouse_Button));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!ev) return;
ev->window = 0;
@@ -449,7 +449,7 @@ _ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
{
Ecore_Event_Mouse_Wheel *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!ev) return;
ev->timestamp = _ecore_psl1ght_get_time ();
diff --git a/src/lib/ecore_sdl/ecore_sdl.c b/src/lib/ecore_sdl/ecore_sdl.c
index ff026f5702..2fee26ce50 100644
--- a/src/lib/ecore_sdl/ecore_sdl.c
+++ b/src/lib/ecore_sdl/ecore_sdl.c
@@ -167,7 +167,7 @@ ecore_sdl_feed_events(void)
{
Ecore_Event_Mouse_Move *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Move));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!ev) return;
ev->timestamp = timestamp;
@@ -192,7 +192,7 @@ ecore_sdl_feed_events(void)
{
Ecore_Event_Mouse_Button *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Button));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!ev) return;
ev->timestamp = timestamp;
@@ -216,7 +216,7 @@ ecore_sdl_feed_events(void)
{
Ecore_Event_Mouse_Wheel *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!ev) return;
ev->timestamp = timestamp;
@@ -234,7 +234,7 @@ ecore_sdl_feed_events(void)
{
Ecore_Event_Mouse_Button *ev;
- ev = malloc(sizeof(Ecore_Event_Mouse_Button));
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!ev) return;
ev->timestamp = timestamp;
ev->window = event.button.windowID;
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c
index 4b0845970e..6219a033e2 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -1261,7 +1261,7 @@ _ecore_wl_input_mouse_move_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
- if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
ev->timestamp = timestamp;
ev->x = input->sx;
@@ -1379,7 +1379,7 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, int
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
if (button == BTN_LEFT)
ev->buttons = 1;
@@ -1488,7 +1488,7 @@ _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, int d
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
if (button == BTN_LEFT)
ev->buttons = 1;
@@ -1551,7 +1551,7 @@ _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int v
LOGFN(__FILE__, __LINE__, __FUNCTION__);
- if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
+ if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
ev->timestamp = timestamp;
ev->modifiers = input->modifiers;
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_events.c b/src/lib/ecore_x/xcb/ecore_xcb_events.c
index 3d4a495fcb..c2c944e404 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_events.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_events.c
@@ -609,7 +609,7 @@ _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event)
{
Ecore_Event_Mouse_Wheel *e;
- if (!(e = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
+ if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
e->timestamp = ev->time;
e->modifiers = _ecore_xcb_events_modifiers_get(ev->state);
@@ -2524,7 +2524,7 @@ _ecore_xcb_event_mouse_move(uint16_t timestamp,
{
Ecore_Event_Mouse_Move *e;
- if (!(e = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
+ if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
e->window = win;
e->root_window = root_win;
@@ -2597,7 +2597,7 @@ _ecore_xcb_event_mouse_button(int event,
Ecore_Event_Mouse_Button *e;
Ecore_X_Mouse_Down_Info *info = NULL;
- if (!(e = malloc(sizeof(Ecore_Event_Mouse_Button)))) return NULL;
+ if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return NULL;
e->window = win;
e->root_window = root_win;
diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c
index cf5ec17b57..21e3489c4c 100644
--- a/src/lib/ecore_x/xlib/ecore_x_events.c
+++ b/src/lib/ecore_x/xlib/ecore_x_events.c
@@ -245,7 +245,7 @@ _ecore_mouse_move(unsigned int timestamp,
Ecore_Event_Mouse_Move *e;
Ecore_Event *event;
- e = malloc(sizeof(Ecore_Event_Mouse_Move));
+ e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
if (!e)
return;
@@ -306,7 +306,7 @@ _ecore_x_axis_update(Ecore_Window window,
Ecore_Event_Axis_Update *e;
int i;
- e = malloc(sizeof(Ecore_Event_Axis_Update));
+ e = calloc(1, sizeof(Ecore_Event_Axis_Update));
if (!e)
{
if (axis) free(axis);
@@ -449,7 +449,7 @@ _ecore_mouse_button(int event,
{
Ecore_Event_Mouse_Button *e;
- e = malloc(sizeof(Ecore_Event_Mouse_Button));
+ e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
if (!e)
return NULL;
@@ -617,7 +617,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
{
Ecore_Event_Mouse_Wheel *e;
- e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
if (!e)
return;