devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e3c3ba481127bcf03582794639f5b44dedece289
commit e3c3ba481127bcf03582794639f5b44dedece289 Author: Chris Michael <[email protected]> Date: Wed Sep 24 09:06:47 2014 -0400 ecore-drm: Remove need to use an extra variable for storing device. Summary: This commit just modifies the internal code to remove the need for an extra variable. There really is no need to store the device twice. We already have it in the list of returned devices. @fix Signed-off-by: Chris Michael <[email protected]> --- src/lib/ecore_drm/ecore_drm_device.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c index 4b7c4e3..2f7495d 100644 --- a/src/lib/ecore_drm/ecore_drm_device.c +++ b/src/lib/ecore_drm/ecore_drm_device.c @@ -153,7 +153,7 @@ ecore_drm_device_find(const char *name, const char *seat) Ecore_Drm_Device *dev = NULL; Eina_Bool found = EINA_FALSE; Eina_List *devs, *l; - const char *device, *tmpdevice; + const char *device; /* try to get a list of drm devics */ if (!(devs = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRM, name))) @@ -200,26 +200,19 @@ ecore_drm_device_find(const char *name, const char *seat) cont: eina_stringshare_del(devpath); - if (found) - { - tmpdevice = eina_stringshare_add(device); - break; - } + if (found) break; } - EINA_LIST_FREE(devs, device) - eina_stringshare_del(device); - - if (!found) return NULL; + if (!found) goto out; if ((dev = calloc(1, sizeof(Ecore_Drm_Device)))) { - dev->drm.name = eeze_udev_syspath_get_devpath(tmpdevice); - dev->drm.path = eina_stringshare_add(tmpdevice); + dev->drm.name = eeze_udev_syspath_get_devpath(device); + dev->drm.path = eina_stringshare_add(device); - dev->id = eeze_udev_syspath_get_sysnum(tmpdevice); + dev->id = eeze_udev_syspath_get_sysnum(device); - dev->seat = eeze_udev_syspath_get_property(tmpdevice, "ID_SEAT"); + dev->seat = eeze_udev_syspath_get_property(device, "ID_SEAT"); if (!dev->seat) dev->seat = eina_stringshare_add("seat0"); dev->format = 0; @@ -228,7 +221,9 @@ cont: DBG("Using Drm Device: %s", dev->drm.name); } - eina_stringshare_del(tmpdevice); +out: + EINA_LIST_FREE(devs, device) + eina_stringshare_del(device); return dev; } --
