Enlightenment CVS committal Author : devilhorns Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore Modified Files: ecore_strings.c Log Message: Format to 'E' style. Note: No functional changes, only formatting. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore/ecore_strings.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- ecore_strings.c 6 Jan 2006 18:06:23 -0000 1.12 +++ ecore_strings.c 23 Jun 2006 06:42:09 -0000 1.13 @@ -17,21 +17,23 @@ * Initialize the ecore string internal structure. * @return Zero on failure, non-zero on successful initialization. */ -EAPI int ecore_string_init() +EAPI int +ecore_string_init() { - /* - * No strings have been loaded at this point, so create the hash - * table for storing string info for later. - */ - if (!ecore_string_init_count) { - ecore_strings = ecore_hash_new(ecore_str_hash, ecore_str_compare); - if (!ecore_strings) - return 0; - ecore_hash_set_free_value(ecore_strings, ecore_string_free_cb); - } - ecore_string_init_count++; + /* + * No strings have been loaded at this point, so create the hash + * table for storing string info for later. + */ + if (!ecore_string_init_count) + { + ecore_strings = ecore_hash_new(ecore_str_hash, ecore_str_compare); + if (!ecore_strings) + return 0; + ecore_hash_set_free_value(ecore_strings, ecore_string_free_cb); + } + ecore_string_init_count++; - return 1; + return 1; } /** @@ -41,78 +43,85 @@ * @c NULL on failure. * @ingroup Ecore_String_Group */ -EAPI const char *ecore_string_instance(char *string) +EAPI const char * +ecore_string_instance(char *string) { - Ecore_String *str; + Ecore_String *str; + + CHECK_PARAM_POINTER_RETURN("string", string, NULL); - CHECK_PARAM_POINTER_RETURN("string", string, NULL); + /* + * Check for a previous instance of the string, if not found, create + * it. + */ + str = ecore_hash_get(ecore_strings, string); + if (!str) + { /* - * Check for a previous instance of the string, if not found, create - * it. + * Allocate and initialize a new string reference. */ - str = ecore_hash_get(ecore_strings, string); - if (!str) { + str = (Ecore_String *)malloc(sizeof(Ecore_String)); - /* - * Allocate and initialize a new string reference. - */ - str = (Ecore_String *)malloc(sizeof(Ecore_String)); + str->string = strdup(string); + str->references = 0; - str->string = strdup(string); - str->references = 0; + ecore_hash_set(ecore_strings, str->string, str); + } - ecore_hash_set(ecore_strings, str->string, str); - } + str->references++; - str->references++; - - return str->string; + return str->string; } /** * Notes that the given string has lost an instance. - * + * * It will free the string if no other instances are left. * * @param string The given string. * @ingroup Ecore_String_Group */ -EAPI void ecore_string_release(const char *string) +EAPI void +ecore_string_release(const char *string) { - Ecore_String *str; + Ecore_String *str; - CHECK_PARAM_POINTER("string", string); + CHECK_PARAM_POINTER("string", string); - str = ecore_hash_get(ecore_strings, (char *)string); - if (!str) - return; - - str->references--; - if (str->references < 1) { - ecore_hash_remove(ecore_strings, (char *)string); - FREE(str->string); - FREE(str); - } + str = ecore_hash_get(ecore_strings, (char *)string); + if (!str) + return; + + str->references--; + if (str->references < 1) + { + ecore_hash_remove(ecore_strings, (char *)string); + FREE(str->string); + FREE(str); + } } /** * Shutdown the ecore string internal structures */ -EAPI void ecore_string_shutdown() +EAPI void +ecore_string_shutdown() { - --ecore_string_init_count; - if (!ecore_string_init_count) { - ecore_hash_destroy(ecore_strings); - ecore_strings = NULL; - } + --ecore_string_init_count; + if (!ecore_string_init_count) + { + ecore_hash_destroy(ecore_strings); + ecore_strings = NULL; + } } -static void ecore_string_free_cb(void *data) +static void +ecore_string_free_cb(void *data) { - Ecore_String *str; + Ecore_String *str; - str = data; - FREE(str->string); - FREE(str); + str = data; + FREE(str->string); + FREE(str); } Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs