poor ChangeLog, alone, without anybody to update it
Vincent On Sun, 17 Jan 2010, Enlightenment SVN wrote: > Log: > * eet: Add mempool for Eet_Node structure. > > Author: cedric > Date: 2010-01-17 06:32:58 -0800 (Sun, 17 Jan 2010) > New Revision: 45259 > > Modified: > trunk/eet/src/lib/Eet_private.h trunk/eet/src/lib/eet_data.c > trunk/eet/src/lib/eet_lib.c trunk/eet/src/lib/eet_node.c > > Modified: trunk/eet/src/lib/Eet_private.h > =================================================================== > --- trunk/eet/src/lib/Eet_private.h 2010-01-17 13:57:52 UTC (rev 45258) > +++ trunk/eet/src/lib/Eet_private.h 2010-01-17 14:32:58 UTC (rev 45259) > @@ -136,6 +136,11 @@ > void eet_identity_unref(Eet_Key *key); > void eet_identity_ref(Eet_Key *key); > > +void eet_node_shutdown(void); > +int eet_node_init(void); > +Eet_Node *eet_node_new(void); > +void eet_node_free(Eet_Node *node); > + > #ifndef PATH_MAX > # define PATH_MAX 4096 > #endif > > Modified: trunk/eet/src/lib/eet_data.c > =================================================================== > --- trunk/eet/src/lib/eet_data.c 2010-01-17 13:57:52 UTC (rev 45258) > +++ trunk/eet/src/lib/eet_data.c 2010-01-17 14:32:58 UTC (rev 45259) > @@ -2133,7 +2133,7 @@ > if (!strcmp(tok4, "{")) > { > /* we have 'group NAM TYP {' */ > - n = calloc(1, sizeof(Eet_Node)); > + n = eet_node_new(); > if (n) > { > n->parent = node; > @@ -2192,7 +2192,7 @@ > /* we have 'value NAME TYP XXX' */ > if (node_base) > { > - n = calloc(1, sizeof(Eet_Node)); > + n = eet_node_new(); > if (n) > { > n->parent = node; > > Modified: trunk/eet/src/lib/eet_lib.c > =================================================================== > --- trunk/eet/src/lib/eet_lib.c 2010-01-17 13:57:52 UTC (rev 45258) > +++ trunk/eet/src/lib/eet_lib.c 2010-01-17 14:32:58 UTC (rev 45259) > @@ -773,6 +773,12 @@ > goto shutdown_eina; > } > > + if (!eet_node_init()) > + { > + EINA_LOG_ERR("Eet: Eet_Node mempool creation failed"); > + goto unregister_log_domain; > + } > + > #ifdef HAVE_GNUTLS > /* Before the library can be used, it must initialize itself if needed. */ > if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P) == 0) > @@ -781,7 +787,7 @@ > /* Disable warning messages about problems with the secure memory > subsystem. > This command should be run right after gcry_check_version. */ > if (gcry_control(GCRYCTL_DISABLE_SECMEM_WARN)) > - goto unregister_log_domain; > + goto shutdown_eet; > /* This command is used to allocate a pool of secure memory and thus > enabling the use of secure memory. It also drops all extra > privileges the > process has (i.e. if it is run as setuid (root)). If the argument > nbytes > @@ -792,7 +798,7 @@ > WRN("BIG FAT WARNING: I AM UNABLE TO REQUEST SECMEM, Cryptographic > operation are at risk !"); > } > if (gnutls_global_init()) > - goto unregister_log_domain; > + goto shutdown_eet; > #endif > #ifdef HAVE_OPENSSL > ERR_load_crypto_strings(); > @@ -801,6 +807,8 @@ > > return eet_init_count; > > + shutdown_eet: > + eet_node_shutdown(); > unregister_log_domain: > eina_log_domain_unregister(_eet_log_dom_global); > _eet_log_dom_global = -1; > @@ -816,6 +824,7 @@ > return eet_init_count; > > eet_clearcache(); > + eet_node_shutdown(); > #ifdef HAVE_GNUTLS > gnutls_global_deinit(); > #endif > > Modified: trunk/eet/src/lib/eet_node.c > =================================================================== > --- trunk/eet/src/lib/eet_node.c 2010-01-17 13:57:52 UTC (rev 45258) > +++ trunk/eet/src/lib/eet_node.c 2010-01-17 14:32:58 UTC (rev 45259) > @@ -6,6 +6,7 @@ > # include <config.h> > #endif > > +#include <string.h> > #include <stdio.h> > > #include <Eina.h> > @@ -13,12 +14,33 @@ > #include "Eet.h" > #include "Eet_private.h" > > +static Eina_Mempool *_eet_node_mp = NULL; > + > +Eet_Node * > +eet_node_new(void) > +{ > + Eet_Node *result; > + > + result = eina_mempool_malloc(_eet_node_mp, sizeof (Eet_Node)); > + if (!result) > + return NULL; > + > + memset(result, 0, sizeof (Eet_Node)); > + return result; > +} > + > +void > +eet_node_free(Eet_Node *node) > +{ > + eina_mempool_free(_eet_node_mp, node); > +} > + > static Eet_Node * > _eet_node_new(const char *name, int type) > { > Eet_Node *n; > > - n = calloc(1, sizeof (Eet_Node)); > + n = eet_node_new(); > if (!n) return NULL; > > n->type = type; > @@ -317,7 +339,7 @@ > } > > eina_stringshare_del(n->name); > - free(n); > + eet_node_free(n); > } > > static const char *eet_node_dump_g_name[6] = { > @@ -534,3 +556,26 @@ > break; > } > } > + > +int > +eet_node_init(void) > +{ > + char *choice; > + char *tmp; > + > + choice = "chained_mempool"; > + tmp = getenv("EET_MEMPOOL"); > + if (tmp && tmp[0]) > + choice = tmp; > + > + _eet_node_mp = eina_mempool_add(choice, "eet-node-alloc", NULL, > sizeof(Eet_Node), 1024); > + > + return _eet_node_mp ? 1 : 0; > +} > + > +void > +eet_node_shutdown(void) > +{ > + eina_mempool_del(_eet_node_mp); > + _eet_node_mp = NULL; > +} > > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for Conference > attendees to learn about information security's most important issues through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel