enlightenment/src/bin/e_config_data.c

38 lines
1005 B
C
Raw Normal View History

Revert "reduce include deps for enlightenment_imc binary" This reverts commit ee71ea63ec02a1bd7acfb11d9dea38eb3e499147. Revert "reduce include deps for enlightenment_thumb binary" This reverts commit cce14fa8399afd3f8e244a2fb216ae4e5d50b942. both of these i reverted.... because they both CHANGE the define of E_API like: and this is wrong. e.h defines this so that these symbols are exposed. E_API, EAPI and friends are desighned to explicitly expose symbols. because if you try and make STRICTER binaries that only have symbols for what was EXPLICTLY exposed like the CFLAG -fvisibility=hidden ... then any api not explicitly marked with the attribute of visible which that E_API macro is intended for... will be invisible. it will not exist. this means a whole MOUNTAIN of modules stop loading as they can't find these symbols. E_API isn't just source sugar tagging. it's actually functional. i'd suggest using -fvisibility=hidden in your CFLAGS by default. it's also not always portable between all compilers so beware... (it was introduced years ago in gcc... i think clang offers it. i don't know about icc or any others). so since E_API is defined in e.h ... we may as well keep the e.h include there instead of hand re-writing a list of includes. does reducing the include deps really have an impact worth talking about on compile time? the commit logs didn't say. but it does break module loading and does it by adding lots of lines of code that are far mroe easily broken now (this is an examplt). :)
2017-07-14 18:07:39 -07:00
#include "e.h"
static Eina_Hash *config_hash = NULL;
E_API void
e_config_descriptor_free(E_Config_DD *edd)
{
eina_hash_del_by_key(config_hash, eet_data_descriptor_name_get((Eet_Data_Descriptor*)edd));
eet_data_descriptor_free((Eet_Data_Descriptor*)edd);
}
E_API E_Config_DD *
e_config_descriptor_new(const char *name, int size)
{
Eet_Data_Descriptor_Class eddc;
E_Config_DD *edd;
if (!eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), name, size))
return NULL;
/* FIXME: We can directly map string inside an Eet_File and reuse it.
But this need a break in all user of config every where in E.
*/
edd = (E_Config_DD *)eet_data_descriptor_stream_new(&eddc);
if (!config_hash) config_hash = eina_hash_string_superfast_new(NULL);
eina_hash_set(config_hash, name, edd);
return edd;
}
E_API E_Config_DD *
e_config_descriptor_find(const char *name)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
return eina_hash_find(config_hash, name);
}