summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_device.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-04-24 12:51:34 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-04-24 12:53:01 -0400
commit3d71a10891c31de9c667f15f8f37371a5664f759 (patch)
treecc2ff822e9ffa1636ad284d6b3beb8c74146cac6 /src/lib/ecore_drm/ecore_drm_device.c
parenta01b2434054db1f7de9087634227c52abb48e291 (diff)
ecore-drm: add safety checks to all EAPI functions
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_device.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index f0908e2714..9919486cc6 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -334,7 +334,7 @@ EAPI Eina_Bool
334ecore_drm_device_close(Ecore_Drm_Device *dev) 334ecore_drm_device_close(Ecore_Drm_Device *dev)
335{ 335{
336 /* check for valid device */ 336 /* check for valid device */
337 if (!dev) return EINA_FALSE; 337 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
338 338
339 /* delete udev watch */ 339 /* delete udev watch */
340 if (dev->watch) eeze_udev_watch_del(dev->watch); 340 if (dev->watch) eeze_udev_watch_del(dev->watch);
@@ -404,7 +404,7 @@ ecore_drm_device_master_drop(Ecore_Drm_Device *dev)
404EAPI int 404EAPI int
405ecore_drm_device_fd_get(Ecore_Drm_Device *dev) 405ecore_drm_device_fd_get(Ecore_Drm_Device *dev)
406{ 406{
407 if (!dev) return -1; 407 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1);
408 return dev->drm.fd; 408 return dev->drm.fd;
409} 409}
410 410
@@ -412,7 +412,7 @@ EAPI void
412ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window) 412ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window)
413{ 413{
414 /* check for valid device */ 414 /* check for valid device */
415 if ((!dev) || (dev->drm.fd < 0)) return; 415 EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
416 416
417 dev->window = window; 417 dev->window = window;
418} 418}
@@ -421,7 +421,7 @@ EAPI const char *
421ecore_drm_device_name_get(Ecore_Drm_Device *dev) 421ecore_drm_device_name_get(Ecore_Drm_Device *dev)
422{ 422{
423 /* check for valid device */ 423 /* check for valid device */
424 if ((!dev) || (dev->drm.fd < 0)) return NULL; 424 EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (dev->drm.fd < 0), NULL);
425 425
426 return dev->drm.name; 426 return dev->drm.name;
427} 427}
@@ -437,7 +437,7 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
437 if (y) *y = 0; 437 if (y) *y = 0;
438 438
439 /* check for valid device */ 439 /* check for valid device */
440 if ((!dev) || (dev->drm.fd < 0)) return; 440 EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
441 441
442 EINA_LIST_FOREACH(dev->seats, l, seat) 442 EINA_LIST_FOREACH(dev->seats, l, seat)
443 { 443 {
@@ -508,6 +508,7 @@ ecore_drm_device_output_find(Ecore_Drm_Device *dev, int x, int y)
508 Eina_List *l; 508 Eina_List *l;
509 509
510 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL); 510 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
511 EINA_SAFETY_ON_TRUE_RETURN_VAL((x < 0) || (y < 0), NULL);
511 512
512 EINA_LIST_FOREACH(dev->outputs, l, output) 513 EINA_LIST_FOREACH(dev->outputs, l, output)
513 { 514 {