本文整理匯總了C++中EINA_SAFETY_ON_NULL_RETURN_VAL函數的典型用法代碼示例。如果您正苦於以下問題:C++ EINA_SAFETY_ON_NULL_RETURN_VAL函數的具體用法?C++ EINA_SAFETY_ON_NULL_RETURN_VAL怎麽用?C++ EINA_SAFETY_ON_NULL_RETURN_VAL使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EINA_SAFETY_ON_NULL_RETURN_VAL函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ewk_js_object_new
Ewk_JS_Object* ewk_js_object_new(const Ewk_JS_Class_Meta* jsMetaClass)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
Ewk_JS_Object* object;
EINA_SAFETY_ON_NULL_RETURN_VAL(jsMetaClass, 0);
object = static_cast<Ewk_JS_Object*>(malloc(sizeof(Ewk_JS_Object)));
if (!object) {
ERR("Could not allocate memory for ewk_js_object");
return 0;
}
EINA_MAGIC_SET(object, EWK_JS_OBJECT_MAGIC);
object->cls = ewk_js_class_new(jsMetaClass);
object->view = 0;
object->name = 0;
object->type = EWK_JS_OBJECT_OBJECT;
if (eina_hash_population(object->cls->properties) < 25)
object->properties = eina_hash_string_small_new(reinterpret_cast<Eina_Free_Cb>(ewk_js_variant_free));
else
object->properties = eina_hash_string_superfast_new(reinterpret_cast<Eina_Free_Cb>(ewk_js_variant_free));
for (int i = 0; object->cls->meta->properties && object->cls->meta->properties[i].name; i++) {
Ewk_JS_Property prop = object->cls->meta->properties[i];
const char* key = object->cls->meta->properties[i].name;
Ewk_JS_Variant* value = static_cast<Ewk_JS_Variant*>(malloc(sizeof(Ewk_JS_Variant)));
if (!value) {
ERR("Could not allocate memory for ewk_js_variant");
goto error;
}
if (prop.get)
prop.get(object, key, value);
else {
value->type = prop.value.type;
switch (value->type) {
case EWK_JS_VARIANT_VOID:
case EWK_JS_VARIANT_NULL:
value->value.o = 0;
break;
case EWK_JS_VARIANT_STRING:
value->value.s = eina_stringshare_add(prop.value.value.s);
break;
case EWK_JS_VARIANT_BOOL:
value->value.b = prop.value.value.b;
break;
case EWK_JS_VARIANT_INT32:
value->value.i = prop.value.value.i;
break;
case EWK_JS_VARIANT_DOUBLE:
value->value.d = prop.value.value.d;
break;
case EWK_JS_VARIANT_OBJECT:
value->value.o = prop.value.value.o;
break;
}
}
eina_hash_add(object->properties, key, value);
}
object->base.object.referenceCount = 1;
object->base.object._class = &EWK_NPCLASS;
return object;
error:
ewk_js_object_free(object);
return 0;
#else
UNUSED_PARAM(jsMetaClass);
return 0;
#endif
}
示例2: eolian_function_type_get
EAPI Eolian_Function_Type
eolian_function_type_get(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EOLIAN_UNRESOLVED);
return fid->type;
}
示例3: efreet_desktop_category_count_get
EAPI unsigned int
efreet_desktop_category_count_get(Efreet_Desktop *desktop)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(desktop, 0);
return eina_list_count(desktop->categories);
}
示例4: eolian_function_implement_get
EAPI const Eolian_Implement *
eolian_function_implement_get(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, NULL);
return fid->impl;
}
示例5: eolian_function_object_is_const
EAPI Eina_Bool
eolian_function_object_is_const(const Eolian_Function *fid)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
return fid->obj_is_const;
}
示例6: ewk_context_menu_item_title_set
const char* ewk_context_menu_item_title_set(Ewk_Context_Menu_Item* o, const char* title)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(o, 0);
eina_stringshare_replace(&o->title, title);
return o->title;
}
示例7: ewk_context_menu_item_enabled_set
Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
o->enabled = enabled;
return EINA_TRUE;
}
示例8: eolian_typedecl_type_get
EAPI Eolian_Typedecl_Type
eolian_typedecl_type_get(const Eolian_Typedecl *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPEDECL_UNKNOWN);
return tp->type;
}
示例9: eolian_typedecl_is_extern
EAPI Eina_Bool
eolian_typedecl_is_extern(const Eolian_Typedecl *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
return tp->is_extern;
}
示例10: eolian_typedecl_base_type_get
EAPI const Eolian_Type *
eolian_typedecl_base_type_get(const Eolian_Typedecl *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
return tp->base_type;
}
示例11: eolian_type_is_ptr
EAPI Eina_Bool
eolian_type_is_ptr(const Eolian_Type *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EINA_FALSE);
return tp->is_ptr;
}
示例12: eolian_type_builtin_type_get
EAPI Eolian_Type_Builtin_Type
eolian_type_builtin_type_get(const Eolian_Type *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, EOLIAN_TYPE_BUILTIN_INVALID);
return tp->btype;
}
示例13: eolian_type_next_type_get
EAPI const Eolian_Type *
eolian_type_next_type_get(const Eolian_Type *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
return tp->next_type;
}
示例14: eolian_typedecl_documentation_get
EAPI const Eolian_Documentation *
eolian_typedecl_documentation_get(const Eolian_Typedecl *tp)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
return tp->doc;
}
示例15: ewk_context_menu_item_action_set
Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item* o, Ewk_Context_Menu_Action action)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(o, EINA_FALSE);
o->action = action;
return EINA_TRUE;
}