summaryrefslogtreecommitdiff
path: root/src/lib
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 /src/lib
parent115b69fd479a08db2e8b401f28aa6867179e5de3 (diff)
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
Diffstat (limited to 'src/lib')
-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)
295 Ecore_Event_Mouse_Wheel *ev; 295 Ecore_Event_Mouse_Wheel *ev;
296 float dx, dy = 0; 296 float dx, dy = 0;
297 297
298 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); 298 ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
299 if (!ev) return pass; 299 if (!ev) return pass;
300 300
301 if ([event hasPreciseScrollingDeltas]) 301 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)
383{ 383{
384 Ecore_Event_Mouse_Move *ev; 384 Ecore_Event_Mouse_Move *ev;
385 385
386 ev = malloc(sizeof(Ecore_Event_Mouse_Move)); 386 ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
387 if (!ev) return; 387 if (!ev) return;
388 388
389 mouse_x += x_axis; 389 mouse_x += x_axis;
@@ -416,7 +416,7 @@ _ecore_psl1ght_mouse_button(int button, int pressed)
416 Ecore_Event_Mouse_Button *ev; 416 Ecore_Event_Mouse_Button *ev;
417 static unsigned int previous_timestamp = 0; 417 static unsigned int previous_timestamp = 0;
418 418
419 ev = malloc(sizeof(Ecore_Event_Mouse_Button)); 419 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
420 if (!ev) return; 420 if (!ev) return;
421 421
422 ev->window = 0; 422 ev->window = 0;
@@ -449,7 +449,7 @@ _ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt)
449{ 449{
450 Ecore_Event_Mouse_Wheel *ev; 450 Ecore_Event_Mouse_Wheel *ev;
451 451
452 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); 452 ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
453 if (!ev) return; 453 if (!ev) return;
454 454
455 ev->timestamp = _ecore_psl1ght_get_time (); 455 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)
167 { 167 {
168 Ecore_Event_Mouse_Move *ev; 168 Ecore_Event_Mouse_Move *ev;
169 169
170 ev = malloc(sizeof(Ecore_Event_Mouse_Move)); 170 ev = calloc(1, sizeof(Ecore_Event_Mouse_Move));
171 if (!ev) return; 171 if (!ev) return;
172 172
173 ev->timestamp = timestamp; 173 ev->timestamp = timestamp;
@@ -192,7 +192,7 @@ ecore_sdl_feed_events(void)
192 { 192 {
193 Ecore_Event_Mouse_Button *ev; 193 Ecore_Event_Mouse_Button *ev;
194 194
195 ev = malloc(sizeof(Ecore_Event_Mouse_Button)); 195 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
196 if (!ev) return; 196 if (!ev) return;
197 197
198 ev->timestamp = timestamp; 198 ev->timestamp = timestamp;
@@ -216,7 +216,7 @@ ecore_sdl_feed_events(void)
216 { 216 {
217 Ecore_Event_Mouse_Wheel *ev; 217 Ecore_Event_Mouse_Wheel *ev;
218 218
219 ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); 219 ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
220 if (!ev) return; 220 if (!ev) return;
221 221
222 ev->timestamp = timestamp; 222 ev->timestamp = timestamp;
@@ -234,7 +234,7 @@ ecore_sdl_feed_events(void)
234 { 234 {
235 Ecore_Event_Mouse_Button *ev; 235 Ecore_Event_Mouse_Button *ev;
236 236
237 ev = malloc(sizeof(Ecore_Event_Mouse_Button)); 237 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
238 if (!ev) return; 238 if (!ev) return;
239 ev->timestamp = timestamp; 239 ev->timestamp = timestamp;
240 ev->window = event.button.windowID; 240 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
1261 1261
1262 /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */ 1262 /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */
1263 1263
1264 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return; 1264 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
1265 1265
1266 ev->timestamp = timestamp; 1266 ev->timestamp = timestamp;
1267 ev->x = input->sx; 1267 ev->x = input->sx;
@@ -1379,7 +1379,7 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, int
1379 1379
1380 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1380 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1381 1381
1382 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; 1382 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
1383 1383
1384 if (button == BTN_LEFT) 1384 if (button == BTN_LEFT)
1385 ev->buttons = 1; 1385 ev->buttons = 1;
@@ -1488,7 +1488,7 @@ _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, int d
1488 1488
1489 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1489 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1490 1490
1491 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; 1491 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return;
1492 1492
1493 if (button == BTN_LEFT) 1493 if (button == BTN_LEFT)
1494 ev->buttons = 1; 1494 ev->buttons = 1;
@@ -1551,7 +1551,7 @@ _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int v
1551 1551
1552 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1552 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1553 1553
1554 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return; 1554 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
1555 1555
1556 ev->timestamp = timestamp; 1556 ev->timestamp = timestamp;
1557 ev->modifiers = input->modifiers; 1557 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)
609 { 609 {
610 Ecore_Event_Mouse_Wheel *e; 610 Ecore_Event_Mouse_Wheel *e;
611 611
612 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return; 612 if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)))) return;
613 613
614 e->timestamp = ev->time; 614 e->timestamp = ev->time;
615 e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); 615 e->modifiers = _ecore_xcb_events_modifiers_get(ev->state);
@@ -2524,7 +2524,7 @@ _ecore_xcb_event_mouse_move(uint16_t timestamp,
2524{ 2524{
2525 Ecore_Event_Mouse_Move *e; 2525 Ecore_Event_Mouse_Move *e;
2526 2526
2527 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Move)))) return; 2527 if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
2528 2528
2529 e->window = win; 2529 e->window = win;
2530 e->root_window = root_win; 2530 e->root_window = root_win;
@@ -2597,7 +2597,7 @@ _ecore_xcb_event_mouse_button(int event,
2597 Ecore_Event_Mouse_Button *e; 2597 Ecore_Event_Mouse_Button *e;
2598 Ecore_X_Mouse_Down_Info *info = NULL; 2598 Ecore_X_Mouse_Down_Info *info = NULL;
2599 2599
2600 if (!(e = malloc(sizeof(Ecore_Event_Mouse_Button)))) return NULL; 2600 if (!(e = calloc(1, sizeof(Ecore_Event_Mouse_Button)))) return NULL;
2601 2601
2602 e->window = win; 2602 e->window = win;
2603 e->root_window = root_win; 2603 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,
245 Ecore_Event_Mouse_Move *e; 245 Ecore_Event_Mouse_Move *e;
246 Ecore_Event *event; 246 Ecore_Event *event;
247 247
248 e = malloc(sizeof(Ecore_Event_Mouse_Move)); 248 e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
249 if (!e) 249 if (!e)
250 return; 250 return;
251 251
@@ -306,7 +306,7 @@ _ecore_x_axis_update(Ecore_Window window,
306 Ecore_Event_Axis_Update *e; 306 Ecore_Event_Axis_Update *e;
307 int i; 307 int i;
308 308
309 e = malloc(sizeof(Ecore_Event_Axis_Update)); 309 e = calloc(1, sizeof(Ecore_Event_Axis_Update));
310 if (!e) 310 if (!e)
311 { 311 {
312 if (axis) free(axis); 312 if (axis) free(axis);
@@ -449,7 +449,7 @@ _ecore_mouse_button(int event,
449{ 449{
450 Ecore_Event_Mouse_Button *e; 450 Ecore_Event_Mouse_Button *e;
451 451
452 e = malloc(sizeof(Ecore_Event_Mouse_Button)); 452 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
453 if (!e) 453 if (!e)
454 return NULL; 454 return NULL;
455 455
@@ -617,7 +617,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent)
617 { 617 {
618 Ecore_Event_Mouse_Wheel *e; 618 Ecore_Event_Mouse_Wheel *e;
619 619
620 e = malloc(sizeof(Ecore_Event_Mouse_Wheel)); 620 e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
621 if (!e) 621 if (!e)
622 return; 622 return;
623 623