forked from enlightenment/efl
efl_config: Fix type of returned value (EO)
An ugly const char * is returned from strdup, freed later with a custom function that just calls free(). This was probably intended for stringshare but now free is used. We have to fix the free function for the EO API so let's keep free(). I'd rather avoid declaring elm_config_profile_dir_free in the EO files.
This commit is contained in:
parent
23d250efef
commit
8f10ed091c
|
@ -66,7 +66,7 @@ class Efl.Config.Global (Efl.Object, Efl.Config)
|
|||
is_user: bool; [[$true to lookup for a user profile or $false for
|
||||
a system one.]]
|
||||
}
|
||||
return: own(stringshare); [[Directory of the profile]]
|
||||
return: own(string); [[Directory of the profile, free after use.]]
|
||||
}
|
||||
profile_derived_add @protected {
|
||||
[[Add a new profile of the given name to be derived from the current
|
||||
|
|
|
@ -937,6 +937,7 @@ _elm_config_profile_dir_get(const char *prof,
|
|||
|
||||
_elm_config_user_dir_snprintf(buf, sizeof(buf), "config/%s", prof);
|
||||
|
||||
// See elm_config_profile_dir_free: always use strdup+free
|
||||
if (ecore_file_is_dir(buf))
|
||||
return strdup(buf);
|
||||
|
||||
|
@ -945,6 +946,7 @@ _elm_config_profile_dir_get(const char *prof,
|
|||
not_user:
|
||||
snprintf(buf, sizeof(buf), "%s/config/%s", _elm_data_dir, prof);
|
||||
|
||||
// See elm_config_profile_dir_free: always use strdup+free
|
||||
if (ecore_file_is_dir(buf))
|
||||
return strdup(buf);
|
||||
|
||||
|
@ -2793,6 +2795,7 @@ elm_config_profile_dir_get(const char *profile,
|
|||
EAPI void
|
||||
elm_config_profile_dir_free(const char *p_dir)
|
||||
{
|
||||
// Don't change this: EO relies on free() to be used.
|
||||
free((void *)p_dir);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue