summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJiwoong Im <jiwoong.im@samsung.com>2015-05-29 16:54:32 +0900
committerJiwoong Im <jiwoong.im@samsung.com>2015-06-03 14:08:32 +0900
commitba3841dce24c90e1795436997fa408696ed21311 (patch)
tree7389037a1716a7d30de213ce2c545ad87a35664b /include
parent864cfb623d9467091502d16b006daa307869ed83 (diff)
downloadapplication-ba3841dce24c90e1795436997fa408696ed21311.tar.gz
application-ba3841dce24c90e1795436997fa408696ed21311.tar.bz2
application-ba3841dce24c90e1795436997fa408696ed21311.zip
change logic and apply inotify. Change-Id: If361b058c81cf1cb235c661e967417fc9cca9e19 Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/app_preference.h176
-rwxr-xr-xinclude/app_preference_internal.h142
-rwxr-xr-xinclude/app_preference_log.h92
3 files changed, 338 insertions, 72 deletions
diff --git a/include/app_preference.h b/include/app_preference.h
index 9aeb3af..8b2ff86 100644
--- a/include/app_preference.h
+++ b/include/app_preference.h
@@ -11,7 +11,7 @@
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
@@ -25,32 +25,38 @@ extern "C" {
#endif
/**
- * @addtogroup CAPI_PREFERENCE_MODULE
+ * @file app_preference.h
+ */
+
+/**
+ * @addtogroup CAPI_PREFERENCE_MODULE
* @{
*/
/**
- * @brief Enumerations of error code for Preference.
+ * @brief Enumeration for Preference Error.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
PREFERENCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
PREFERENCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
PREFERENCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- PREFERENCE_ERROR_NO_KEY = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Required key not available */
+ PREFERENCE_ERROR_NO_KEY = TIZEN_ERROR_APPLICATION | 0x30, /**< Required key not available */
PREFERENCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR , /**< Internal I/O Error */
} preference_error_e;
/**
- * @brief Called when the given key's value in the preference changes.
+ * @brief Called when the given key's value in the preference changes.
*
- * @details When the @a key is added or removed, this callback function is skipped. (only update can be handled)
+ * @details When the @a key is added or removed, this callback function is skipped(only update can be handled).
*
- * @param [in] key The name of the key in the preference
- * @param [in] user_data The user data passed from the callback registration function
- * @pre This function is invoked when the value of the key is overwritten after you register this callback using preference_set_changed_cb()
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key in the preference
+ * @param[in] user_data The user data passed from the callback registration function
+ * @pre This function is invoked when the value of the key is overwritten after you register this callback using preference_set_changed_cb().
* @see preference_set_changed_cb()
* @see preference_unset_changed_cb()
* @see preference_set_boolean()
@@ -62,42 +68,47 @@ typedef void (*preference_changed_cb) (const char *key, void *user_data);
/**
-* @brief Called to get key string once for each key-value pair in the preference.
-*
-* @remarks You should not free @a key returned by this function.
-*
-* @param [in] key The key of the value added to the preference
-* @param [in] value The value associated with the key
-* @param [in] user_data The user data passed from the foreach function
-* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
-* @pre preference_foreach_item() will invoke this callback function.
-* @see preference_foreach_item()
-*/
+ * @brief Called to get key string, once for each key-value pair in the preference.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You should not free the @a key returned by this function.
+ *
+ * @param[in] key The key of the value added to the preference
+ * @param[in] value The value associated with the key
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop,
+ * otherwise @c false to break out of the loop
+ * @pre preference_foreach_item() will invoke this callback function.
+ * @see preference_foreach_item()
+ */
typedef bool (*preference_item_cb)(const char *key, void *user_data);
/**
* @brief Sets an integer value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c int value for the given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c int value for the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_int()
- *
*/
int preference_set_int(const char *key, int value);
/**
- * @brief Gets a integer value from the preference.
+ * @brief Gets an integer value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c int value for the given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #PREFERENCE_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c int value for the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
@@ -109,14 +120,15 @@ int preference_get_int(const char *key, int *value);
/**
* @brief Sets a double value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c double value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c double value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_double()
- *
*/
int preference_set_double(const char *key, double value);
@@ -124,15 +136,16 @@ int preference_set_double(const char *key, double value);
/**
* @brief Gets a double value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c double value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c double value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_set_double()
- *
*/
int preference_get_double(const char *key, double *value);
@@ -141,15 +154,16 @@ int preference_get_double(const char *key, double *value);
* @brief Sets a string value in the preference.
*
* @details It makes a deep copy of the added string value.
- *
- * @param [in] key The name of the key to modify
- * @param [in] value The new @c string value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c string value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_string()
- *
*/
int preference_set_string(const char *key, const char *value);
@@ -157,11 +171,13 @@ int preference_set_string(const char *key, const char *value);
/**
* @brief Gets a string value from the preference.
*
- * @remarks @a value must be released with free() by you.
- * @param [in] key The name of the key to retrieve
- * @param [out] value The @c string value associated with given key
- * @return 0 on success, otherwise a negative error value.
- * @retval #PREFERENCE_ERROR_NONE Successful
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks @a value must be released using free().
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c string value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
@@ -174,12 +190,14 @@ int preference_get_string(const char *key, char **value);
/**
* @brief Sets a boolean value in the preference.
*
- * @param [in] key The name of the key to modify
- * @param [in] value The new boolean @c value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to modify
+ * @param[in] value The new @c boolean value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
+ * @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_get_boolean()
*/
int preference_set_boolean(const char *key, bool value);
@@ -188,9 +206,11 @@ int preference_set_boolean(const char *key, bool value);
/**
* @brief Gets a boolean value from the preference.
*
- * @param [in] key The name of the key to retrieve
- * @param [out] value The boolean @c value associated with given key
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to retrieve
+ * @param[out] value The @c boolean value associated with the given key
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_NO_KEY Required key not available
@@ -203,22 +223,26 @@ int preference_get_boolean(const char *key, bool *value);
/**
* @brief Removes any value with the given @a key from the preference.
*
- * @param [in] key The name of the key to remove
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to remove
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
- * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
- *
*/
int preference_remove(const char *key);
/**
- * @brief Checks whether if the given @a key exists in the preference.
+ * @brief Checks whether the given @a key exists in the preference.
*
- * @param [in] key The name of the key to check
- * @param [out] existing @c true if the @a key exists in the preference, otherwise @c false
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to check
+ * @param[out] existing If @c true the @a key exists in the preference,
+ * otherwise @c false
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
@@ -229,7 +253,9 @@ int preference_is_existing(const char *key, bool *existing);
/**
* @brief Removes all key-value pairs from the preference.
*
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
* @see preference_remove()
@@ -240,10 +266,12 @@ int preference_remove_all(void);
/**
* @brief Registers a callback function to be invoked when value of the given key in the preference changes.
*
- * @param [in] key The name of the key to monitor
- * @param [in] callback The callback function to register
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to monitor
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_OUT_OF_MEMORY Out of memory
@@ -259,8 +287,10 @@ int preference_set_changed_cb(const char *key, preference_changed_cb callback, v
/**
* @brief Unregisters the callback function.
*
- * @param [in] key The name of the key to monitor
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] key The name of the key to monitor
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
@@ -272,9 +302,11 @@ int preference_unset_changed_cb(const char *key);
/**
* @brief Retrieves all key-value pairs in the preference by invoking the callback function.
*
- * @param [in] callback The callback function to get key value once for each key-value pair in the preference
- * @param [in] user_data The user data to be passed to the callback function
- * @return 0 on success, otherwise a negative error value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] callback The callback function to get key value once for each key-value pair in the preference
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ * otherwise a negative error value
* @retval #PREFERENCE_ERROR_NONE Successful
* @retval #PREFERENCE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PREFERENCE_ERROR_IO_ERROR Internal I/O Error
diff --git a/include/app_preference_internal.h b/include/app_preference_internal.h
new file mode 100755
index 0000000..8108903
--- /dev/null
+++ b/include/app_preference_internal.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
+#define __TIZEN_APPFW_PREFERENCE_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "app_preference_log.h"
+
+#define BUF_LEN (4096)
+#define PREF_DIR ".pref/"
+
+#define PREFERENCE_KEY_PATH_LEN 1024
+#define ERR_LEN 128
+
+#define PREF_DB_NAME ".pref.db"
+#define PREF_TBL_NAME "pref"
+#define PREF_F_KEY_NAME "pref_key"
+#define PREF_F_TYPE_NAME "pref_type"
+#define PREF_F_DATA_NAME "pref_data"
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_WRONG_PREFIX.
+ */
+#define PREFERENCE_ERROR_WRONG_PREFIX -2
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_WRONG_TYPE.
+ */
+#define PREFERENCE_ERROR_WRONG_TYPE -3
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_OPEN.
+ */
+#define PREFERENCE_ERROR_FILE_OPEN -21
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_FREAD.
+ */
+#define PREFERENCE_ERROR_FILE_FREAD -22
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_FGETS.
+ */
+#define PREFERENCE_ERROR_FILE_FGETS -23
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_WRITE.
+ */
+#define PREFERENCE_ERROR_FILE_WRITE -24
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_SYNC.
+ */
+#define PREFERENCE_ERROR_FILE_SYNC -25
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_CHMOD.
+ */
+#define PREFERENCE_ERROR_FILE_CHMOD -28
+
+/**
+ * @brief Definition for PREFERENCE_ERROR_FILE_LOCK.
+ */
+#define PREFERENCE_ERROR_FILE_LOCK -29
+
+typedef enum
+{
+ PREFERENCE_TYPE_NONE = 0,
+ PREFERENCE_TYPE_STRING,
+ PREFERENCE_TYPE_INT,
+ PREFERENCE_TYPE_DOUBLE,
+ PREFERENCE_TYPE_BOOLEAN,
+} preference_type_e;
+
+typedef struct _pref_changed_cb_node_t{
+ char *key;
+ preference_changed_cb cb;
+ void *user_data;
+ struct _pref_changed_cb_node_t *prev;
+ struct _pref_changed_cb_node_t *next;
+} pref_changed_cb_node_t;
+
+typedef struct _keynode_t {
+ char *keyname; /**< Keyname for keynode */
+ int type; /**< Keynode type */
+ union {
+ int i; /**< Integer type */
+ int b; /**< Bool type */
+ double d; /**< Double type */
+ char *s; /**< String type */
+ } value; /**< Value for keynode */
+ struct _keynode_t *next; /**< Next keynode */
+} keynode_t;
+
+/**
+ * @brief The structure type for opaque type. It must be used via accessor functions.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _keylist_t {
+ int num; /**< Number of list */
+ keynode_t *head; /**< Head node */
+ keynode_t *cursor; /**< Cursor node */
+} keylist_t;
+
+
+int _preference_kdb_add_notify
+ (const char *keyname, preference_changed_cb cb, void *data);
+int _preference_kdb_del_notify
+ (const char *keyname);
+
+int _preference_get_key_path(const char *keyname, char *path);
+int _preference_get_key(keynode_t *keynode);
+
+int _preference_keynode_set_keyname(keynode_t *keynode, const char *keyname);
+inline void _preference_keynode_set_null(keynode_t *keynode);
+inline keynode_t *_preference_keynode_new(void);
+inline void _preference_keynode_free(keynode_t *keynode);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_PREFERENCE_INTERNAL_H__ */
diff --git a/include/app_preference_log.h b/include/app_preference_log.h
new file mode 100755
index 0000000..8bd87a7
--- /dev/null
+++ b/include/app_preference_log.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_APPFW_APPLICATION_PREFERENCE"
+#define DBG_MODE (1)
+
+#ifndef __PREFERENCE_LOG_H__
+#define __PREFERENCE_LOG_H__
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+
+#define INFO(fmt, arg...)
+#define DBG(fmt, arg...) SECURE_SLOGI(fmt, ##arg)
+#define ERR(fmt, arg...) LOGE(fmt, ##arg)
+#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
+#define FATAL(fmt, arg...) SECURE_SLOGF(fmt, ##arg)
+#define WARN(fmt, arg...) SECURE_SLOGW(fmt, ##arg)
+
+
+/************** Return ***************/
+#define ret_if(expr) \
+ do { \
+ if (expr) { \
+ ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+ } while (0)
+#define retv_if(expr, val) \
+ do { \
+ if (expr) { \
+ ERR("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+ } while (0)
+#define retm_if(expr, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ return; \
+ } \
+ } while (0)
+#define retvm_if(expr, val, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ return (val); \
+ } \
+ } while (0)
+#define retex_if(expr, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR(fmt, ##arg); \
+ goto CATCH; \
+ } \
+ } while (0)
+
+
+/************** TimeCheck ***************/
+#ifdef PREFERENCE_TIMECHECK
+#define START_TIME_CHECK \
+ init_time();\
+ startT = set_start_time();
+#define END_TIME_CHECK \
+ PREFERENCE_DEBUG("time = %f ms\n", exec_time(startT));
+#else
+#define START_TIME_CHECK
+#define END_TIME_CHECK
+#endif
+
+
+#endif /* __PREFERENCE_LOG_H__ */