eo: eo_class_name_get() supports objects and classes
authorJérémy Zurcher <jeremy@asynk.ch>
Thu, 26 Sep 2013 22:13:00 +0000 (00:13 +0200)
committerTom Hacohen <tom@stosb.com>
Fri, 27 Sep 2013 13:01:46 +0000 (14:01 +0100)
src/lib/eo/eo.c

index 786e358..f6b9d35 100644 (file)
@@ -520,9 +520,20 @@ eo_class_get(const Eo *obj_id)
 }
 
 EAPI const char *
-eo_class_name_get(const Eo *klass_id)
+eo_class_name_get(const Eo *obj_id)
 {
-   EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, NULL);
+   const _Eo_Class *klass;
+
+   if (_eo_is_a_class(obj_id))
+     {
+        EO_CLASS_POINTER_RETURN_VAL(obj_id, _klass, NULL);
+        klass = _klass;
+     }
+     else
+     {
+        EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
+        klass = obj->klass;
+     }
 
    return klass->desc->name;
 }