Eo: Change the op func sentinel to be safer.

SVN revision: 71800
This commit is contained in:
Tom Hacohen 2012-06-07 11:14:38 +00:00
parent c66f8ee33a
commit 03ccd0b0bf
2 changed files with 3 additions and 2 deletions

View File

@ -65,6 +65,7 @@ EAPI extern Eina_Lock _eo_class_creation_lock;
*/ */
enum _Eo_Op_Type enum _Eo_Op_Type
{ {
EO_OP_TYPE_INVALID = -1, /**< Invalid op. */
EO_OP_TYPE_REGULAR = 0, /**< Regular op. */ EO_OP_TYPE_REGULAR = 0, /**< Regular op. */
EO_OP_TYPE_CONST, /**< Const op - object should not change. */ EO_OP_TYPE_CONST, /**< Const op - object should not change. */
EO_OP_TYPE_CLASS, /**< Class op - a class op. Like static in Java/C++. */ EO_OP_TYPE_CLASS, /**< Class op - a class op. Like static in Java/C++. */
@ -333,7 +334,7 @@ typedef struct _Eo_Op_Func_Description Eo_Op_Func_Description;
* A convenience macro to be used when populating the #Eo_Op_Func_Description * A convenience macro to be used when populating the #Eo_Op_Func_Description
* array. It must appear at the end of the ARRAY. * array. It must appear at the end of the ARRAY.
*/ */
#define EO_OP_FUNC_SENTINEL { 0, NULL, EINA_FALSE } #define EO_OP_FUNC_SENTINEL { 0, NULL, EO_OP_TYPE_INVALID }
/** /**
* @struct _Eo_Op_Description * @struct _Eo_Op_Description

View File

@ -752,7 +752,7 @@ eo_class_funcs_set(Eo_Class *klass, const Eo_Op_Func_Description *func_descs)
itr = func_descs; itr = func_descs;
if (itr) if (itr)
{ {
for ( ; itr->op != 0 ; itr++) for ( ; itr->op_type != EO_OP_TYPE_INVALID ; itr++)
{ {
const Eo_Op_Description *op_desc = _eo_op_id_desc_get(itr->op); const Eo_Op_Description *op_desc = _eo_op_id_desc_get(itr->op);