Remove global log domain

SVN revision: 56729
This commit is contained in:
Sebastian Dransfeld 2011-02-05 19:05:55 +00:00
parent 259f8aad73
commit 6ed10251db
15 changed files with 59 additions and 100 deletions

View File

@ -29,3 +29,8 @@
2011-02-03 Sebastian Dransfeld 2011-02-03 Sebastian Dransfeld
* Fix leak in efreet_mime_type_icon_get() * Fix leak in efreet_mime_type_icon_get()
2011-02-05 Sebastian Dransfeld
* Remove global log domain and make all files define log domain
before including efreet_private.h

View File

@ -29,6 +29,9 @@ void *alloca (size_t);
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM /* no logging in this file */
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#include "efreet_xml.h" #include "efreet_xml.h"
@ -40,7 +43,6 @@ static int efreet_parsed_locale = 0;
static const char *efreet_lang = NULL; static const char *efreet_lang = NULL;
static const char *efreet_lang_country = NULL; static const char *efreet_lang_country = NULL;
static const char *efreet_lang_modifier = NULL; static const char *efreet_lang_modifier = NULL;
int _efreet_log_domain_global = -1;
static void efreet_parse_locale(void); static void efreet_parse_locale(void);
static int efreet_parse_locale_setting(const char *env); static int efreet_parse_locale_setting(const char *env);
@ -62,15 +64,9 @@ efreet_init(void)
goto shutdown_eet; goto shutdown_eet;
if (!ecore_file_init()) if (!ecore_file_init())
goto shutdown_ecore; goto shutdown_ecore;
_efreet_log_domain_global = eina_log_domain_register("efreet", EFREET_DEFAULT_LOG_COLOR);
if (_efreet_log_domain_global < 0)
{
EINA_LOG_ERR("Efreet could create a general log domain.");
goto shutdown_ecore_file;
}
if (!efreet_base_init()) if (!efreet_base_init())
goto unregister_log_domain; goto shutdown_ecore_file;
if (!efreet_cache_init()) if (!efreet_cache_init())
goto shutdown_efreet_base; goto shutdown_efreet_base;
@ -109,8 +105,6 @@ shutdown_efreet_cache:
efreet_cache_shutdown(); efreet_cache_shutdown();
shutdown_efreet_base: shutdown_efreet_base:
efreet_base_shutdown(); efreet_base_shutdown();
unregister_log_domain:
eina_log_domain_unregister(_efreet_log_domain_global);
shutdown_ecore_file: shutdown_ecore_file:
ecore_file_shutdown(); ecore_file_shutdown();
shutdown_ecore: shutdown_ecore:
@ -143,7 +137,6 @@ efreet_shutdown(void)
efreet_xml_shutdown(); efreet_xml_shutdown();
efreet_cache_shutdown(); efreet_cache_shutdown();
efreet_base_shutdown(); efreet_base_shutdown();
eina_log_domain_unregister(_efreet_log_domain_global);
IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang);
IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_country);

View File

@ -25,6 +25,10 @@ void *alloca (size_t);
#include <limits.h> #include <limits.h>
#include <unistd.h> #include <unistd.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_base_log_dom
static int _efreet_base_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
@ -45,15 +49,6 @@ static Eina_List *xdg_data_dirs = NULL;
static Eina_List *xdg_config_dirs = NULL; static Eina_List *xdg_config_dirs = NULL;
static const char *hostname = NULL; static const char *hostname = NULL;
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_base_log_dom
static int _efreet_base_log_dom = -1;
static const char *efreet_dir_get(const char *key, const char *fallback); static const char *efreet_dir_get(const char *key, const char *fallback);
static Eina_List *efreet_dirs_get(const char *key, static Eina_List *efreet_dirs_get(const char *key,
const char *fallback); const char *fallback);

View File

@ -17,6 +17,10 @@
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_cache_log_dom
static int _efreet_cache_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#include "efreet_cache_private.h" #include "efreet_cache_private.h"
@ -29,13 +33,6 @@ struct _Efreet_Old_Cache
Eet_File *ef; Eet_File *ef;
}; };
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_cache_log_dom
static int _efreet_cache_log_dom = -1;
/** /**
* Data for cache files * Data for cache files
*/ */

View File

@ -32,6 +32,10 @@ void *alloca (size_t);
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_desktop_log_dom
int _efreet_desktop_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
@ -60,13 +64,6 @@ static Eina_List *efreet_desktop_types = NULL;
static Eina_Hash *change_monitors = NULL; static Eina_Hash *change_monitors = NULL;
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_desktop_log_dom
int _efreet_desktop_log_dom = -1;
EAPI int EFREET_DESKTOP_TYPE_APPLICATION = 0; EAPI int EFREET_DESKTOP_TYPE_APPLICATION = 0;
EAPI int EFREET_DESKTOP_TYPE_LINK = 0; EAPI int EFREET_DESKTOP_TYPE_LINK = 0;
EAPI int EFREET_DESKTOP_TYPE_DIRECTORY = 0; EAPI int EFREET_DESKTOP_TYPE_DIRECTORY = 0;

View File

@ -32,16 +32,13 @@ void *alloca (size_t);
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
#include "Efreet.h" /* define macros and variable for using the eina logging system */
#include "efreet_private.h"
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_desktop_log_dom #define EFREET_MODULE_LOG_DOM _efreet_desktop_log_dom
extern int _efreet_desktop_log_dom; extern int _efreet_desktop_log_dom;
#include "Efreet.h"
#include "efreet_private.h"
/** /**
* @internal * @internal
* The different types of commands in an Exec entry * The different types of commands in an Exec entry

View File

@ -32,16 +32,13 @@ void *alloca (size_t);
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_icon_log_dom
static int _efreet_icon_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_icon_log_dom
static int _efreet_icon_log_dom = -1;
Eina_Hash *efreet_icon_themes = NULL; Eina_Hash *efreet_icon_themes = NULL;
static const char *efreet_icon_deprecated_user_dir = NULL; static const char *efreet_icon_deprecated_user_dir = NULL;

View File

@ -30,15 +30,13 @@ void *alloca (size_t);
#include <Ecore_File.h> #include <Ecore_File.h>
#include "Efreet.h" /* define macros and variable for using the eina logging system */
#include "efreet_private.h"
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_ini_log_dom #define EFREET_MODULE_LOG_DOM _efreet_ini_log_dom
static int _efreet_ini_log_dom = -1; static int _efreet_ini_log_dom = -1;
#include "Efreet.h"
#include "efreet_private.h"
static Eina_Hash *efreet_ini_parse(const char *file); static Eina_Hash *efreet_ini_parse(const char *file);
static const char *efreet_ini_unescape(const char *str) EINA_ARG_NONNULL(1); static const char *efreet_ini_unescape(const char *str) EINA_ARG_NONNULL(1);
static Eina_Bool static Eina_Bool

View File

@ -28,6 +28,10 @@ void *alloca (size_t);
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_menu_log_dom
static int _efreet_menu_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#include "efreet_xml.h" #include "efreet_xml.h"
@ -250,16 +254,6 @@ static Eina_Hash *efreet_menu_filter_cbs = NULL;
static Eina_Hash *efreet_menu_move_cbs = NULL; static Eina_Hash *efreet_menu_move_cbs = NULL;
static Eina_Hash *efreet_menu_layout_cbs = NULL; static Eina_Hash *efreet_menu_layout_cbs = NULL;
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_menu_log_dom
static int _efreet_menu_log_dom = -1;
static const char *efreet_menu_prefix_get(void); static const char *efreet_menu_prefix_get(void);
static Efreet_Menu_Internal *efreet_menu_by_name_find(Efreet_Menu_Internal *internal, static Efreet_Menu_Internal *efreet_menu_by_name_find(Efreet_Menu_Internal *internal,

View File

@ -43,6 +43,10 @@ void *alloca (size_t);
#include <Ecore.h> #include <Ecore.h>
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_mime_log_dom
static int _efreet_mime_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "Efreet_Mime.h" #include "Efreet_Mime.h"
#include "efreet_private.h" #include "efreet_private.h"
@ -161,15 +165,6 @@ struct Efreet_Mime_Icon_Entry
unsigned int size; unsigned int size;
}; };
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_mime_log_dom
static int _efreet_mime_log_dom = -1;
static int efreet_mime_glob_remove(const char *glob); static int efreet_mime_glob_remove(const char *glob);
static void efreet_mime_mime_types_load(const char *file); static void efreet_mime_mime_types_load(const char *file);
static void efreet_mime_shared_mimeinfo_globs_load(const char *file); static void efreet_mime_shared_mimeinfo_globs_load(const char *file);

View File

@ -66,13 +66,14 @@
* global log domain for efreet (see eina_log module) * global log domain for efreet (see eina_log module)
*/ */
extern int _efreet_log_dom_global;
#ifdef EFREET_DEFAULT_LOG_COLOR #ifdef EFREET_DEFAULT_LOG_COLOR
#undef EFREET_DEFAULT_LOG_COLOR #undef EFREET_DEFAULT_LOG_COLOR
#endif #endif
#define EFREET_DEFAULT_LOG_COLOR "\033[36m" #define EFREET_DEFAULT_LOG_COLOR "\033[36m"
#define EFREET_MODULE_LOG_DOM _efreet_log_dom_global /*default log domain for each module. It can redefined inside each module */ #ifndef EFREET_MODULE_LOG_DOM
#error "Need to define a log domain"
#endif
#ifdef ERROR #ifdef ERROR
#undef ERROR #undef ERROR
#endif #endif
@ -95,7 +96,6 @@ extern int _efreet_log_dom_global;
* four macros are defined ERR, WRN, DGB, INF. * four macros are defined ERR, WRN, DGB, INF.
* EFREET_MODULE_LOG_DOM should be defined individually for each module * EFREET_MODULE_LOG_DOM should be defined individually for each module
*/ */
#define EFREET_MODULE_LOG_DOM _efreet_log_dom_global /*default log domain for each module. It can redefined inside each module */
#ifdef ERR #ifdef ERR
#undef ERR #undef ERR
#endif #endif

View File

@ -13,6 +13,10 @@
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_trash_log_dom
static int _efreet_trash_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "Efreet_Trash.h" #include "Efreet_Trash.h"
#include "efreet_private.h" #include "efreet_private.h"
@ -24,14 +28,6 @@ static const char *efreet_trash_dir = NULL;
# define getuid() GetCurrentProcessId() # define getuid() GetCurrentProcessId()
#endif #endif
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_trash_log_dom
static int _efreet_trash_log_dom = -1;
/** /**
* @return Returns 1 on success or 0 on failure * @return Returns 1 on success or 0 on failure
* @brief Initializes the efreet trash system * @brief Initializes the efreet trash system

View File

@ -15,6 +15,9 @@
# include <Evil.h> # include <Evil.h>
#endif #endif
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM /* no logging in this file */
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"

View File

@ -35,18 +35,14 @@ void *alloca (size_t);
#include <Eet.h> #include <Eet.h>
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_utils_log_dom
static int _efreet_utils_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#include "efreet_cache_private.h" #include "efreet_cache_private.h"
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_utils_log_dom
static int _efreet_utils_log_dom = -1;
static char *efreet_util_path_in_default(const char *section, const char *path); static char *efreet_util_path_in_default(const char *section, const char *path);
static int efreet_util_glob_match(const char *str, const char *glob); static int efreet_util_glob_match(const char *str, const char *glob);

View File

@ -13,6 +13,10 @@
#include <Ecore_File.h> #include <Ecore_File.h>
/* define macros and variable for using the eina logging system */
#define EFREET_MODULE_LOG_DOM _efreet_xml_log_dom
static int _efreet_xml_log_dom = -1;
#include "Efreet.h" #include "Efreet.h"
#include "efreet_private.h" #include "efreet_private.h"
#include "efreet_xml.h" #include "efreet_xml.h"
@ -35,15 +39,7 @@ static void efreet_xml_comment_skip(char **data, int *size);
static int error = 0; static int error = 0;
/* define macros and variable for using the eina logging system */
#ifdef EFREET_MODULE_LOG_DOM
#undef EFREET_MODULE_LOG_DOM
#endif
#define EFREET_MODULE_LOG_DOM _efreet_xml_log_dom
static int _efreet_xml_init_count = 0; static int _efreet_xml_init_count = 0;
static int _efreet_xml_log_dom = -1;
/** /**
* @internal * @internal