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:
Jean-Philippe Andre 2017-08-31 20:31:54 +09:00
parent 23d250efef
commit 8f10ed091c
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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);
}