1. Change tag style for error log 32/68632/2 submit/tizen/20160512.070253
authorkj7.sung <kj7.sung@samsung.com>
Mon, 9 May 2016 04:49:10 +0000 (13:49 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Mon, 9 May 2016 06:21:33 +0000 (15:21 +0900)
2. Applied Tizen coding rule

Change-Id: I724e171f45225d1aa3256afac96d4d46951f5263
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
20 files changed:
location/include/location-log.h
location/manager/location-accuracy.c
location/manager/location-boundary.c
location/manager/location-common-util.c
location/manager/location-common-util.h
location/manager/location-gps.c
location/manager/location-hybrid-mobile.c
location/manager/location-mock.c
location/manager/location-position.c
location/manager/location-privacy.c
location/manager/location-satellite.c
location/manager/location-setting.c
location/manager/location-setting.h
location/manager/location-signaling-util.c
location/manager/location-velocity.c
location/manager/location-wps.c
location/manager/location.c
location/module/module-internal.c
packaging/liblbs-location.changes
packaging/liblbs-location.spec

index bffe368..8752d1d 100644 (file)
 #define LOCATION_LOGE(fmt, args...)            LOGE(fmt, ##args)
 #define LOCATION_SECLOG(fmt, args...)  SECURE_LOGD(fmt, ##args)
 
+#define _D(fmt, args...)               LOGD(fmt, ##args)
+#define _W(fmt, args...)               LOGW(fmt, ##args)
+#define _I(fmt, args...)               LOGI(fmt, ##args)
+#define _E(fmt, args...)               LOGE(fmt, ##args)
+
+#define LOC_IF_FAIL(ret, tag, fmt, arg...) \
+       do { if (ret != 0) { tag(fmt, ##arg); return ret; } } while (0)
+
+#define LOC_IF_FAIL_LOG(ret, tag, fmt, arg...) \
+       do { if (ret != 0) tag(fmt, ##arg); } while (0)
+
+#define LOC_COND_RET(cond, ret, tag, fmt, arg...) \
+       do { if (cond) { tag(fmt, ##arg); return ret; } } while (0)
+
+#define LOC_COND_VOID(cond, tag, fmt, arg...) \
+       do { if (cond) { tag(fmt, ##arg); return ; } } while (0)
+
+#define LOC_COND_LOG(cond, tag, fmt, arg...) \
+       do { if (cond) tag(fmt, ##arg); } while (0)
+
+#define LOC_FUNC_LOG           LOGI("%s", __func__);
 
 #endif
index 034b9f8..5e9bcdd 100644 (file)
@@ -31,10 +31,9 @@ location_accuracy_get_type(void)
 {
        static volatile gsize type_volatile = 0;
        if (g_once_init_enter(&type_volatile)) {
-               GType type = g_boxed_type_register_static(
-                                               g_intern_static_string("LocationAccuracy"),
-                                               (GBoxedCopyFunc) location_accuracy_copy,
-                                               (GBoxedFreeFunc) location_accuracy_free);
+               GType type = g_boxed_type_register_static(g_intern_static_string("LocationAccuracy"),
+                                       (GBoxedCopyFunc) location_accuracy_copy, (GBoxedFreeFunc) location_accuracy_free);
+
                g_once_init_leave(&type_volatile, type);
        }
        return type_volatile;
index 6f3a6ac..822c2da 100644 (file)
@@ -175,13 +175,13 @@ EXPORT_API LocationBoundary *
 location_boundary_copy(const LocationBoundary *boundary)
 {
        g_return_val_if_fail(boundary, NULL);
-       if (boundary->type == LOCATION_BOUNDARY_RECT) {
+       if (boundary->type == LOCATION_BOUNDARY_RECT)
                return location_boundary_new_for_rect(boundary->rect.left_top, boundary->rect.right_bottom);
-       } else if (boundary->type == LOCATION_BOUNDARY_CIRCLE) {
+       else if (boundary->type == LOCATION_BOUNDARY_CIRCLE)
                return location_boundary_new_for_circle(boundary->circle.center, boundary->circle.radius);
-       } else if (boundary->type == LOCATION_BOUNDARY_POLYGON) {
+       else if (boundary->type == LOCATION_BOUNDARY_POLYGON)
                return location_boundary_new_for_polygon(boundary->polygon.position_list);
-       }
+
        return NULL;
 }
 
index 7542431..b03bc00 100644 (file)
@@ -50,9 +50,8 @@ static gint compare_position(gconstpointer a, gconstpointer b)
        g_return_val_if_fail(a, 1);
        g_return_val_if_fail(b, -1);
 
-       if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE) {
+       if (location_position_equal((LocationPosition *) a, (LocationPosition *)b) == TRUE)
                return 0;
-       }
 
        return -1;
 }
@@ -87,9 +86,8 @@ boundary_compare(gconstpointer comp1, gconstpointer comp2)
                        case LOCATION_BOUNDARY_POLYGON: {
                                        GList *boundary1_next = NULL;
                                        GList *boundary2_start = NULL, *boundary2_prev = NULL, *boundary2_next = NULL;
-                                       if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list)) {
+                                       if (g_list_length(priv1->boundary->polygon.position_list) != g_list_length(priv2->boundary->polygon.position_list))
                                                return -1;
-                                       }
 
                                        /* Find a matching index of Boundary2 with Boundary1's 1st postion. */
                                        boundary2_start = g_list_find_custom(priv2->boundary->polygon.position_list, g_list_nth_data(priv1->boundary->polygon.position_list, 0), (GCompareFunc) compare_position);
@@ -108,10 +106,12 @@ boundary_compare(gconstpointer comp1, gconstpointer comp2)
                                                boundary1_next = g_list_next(boundary1_next);
                                                while (boundary1_next) {
                                                        boundary2_prev = g_list_previous(boundary2_prev);
-                                                       if (boundary2_prev == NULL) boundary2_prev = g_list_last(priv2->boundary->polygon.position_list);
-                                                       if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_prev->data) == FALSE) {
+                                                       if (boundary2_prev == NULL)
+                                                               boundary2_prev = g_list_last(priv2->boundary->polygon.position_list);
+
+                                                       if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_prev->data) == FALSE)
                                                                return -1;
-                                                       }
+
                                                        boundary1_next = g_list_next(boundary1_next);
                                                }
                                                ret = 0;
@@ -119,10 +119,12 @@ boundary_compare(gconstpointer comp1, gconstpointer comp2)
                                                boundary1_next = g_list_next(boundary1_next);
                                                while (boundary1_next) {
                                                        boundary2_next = g_list_next(boundary2_next);
-                                                       if (boundary2_next == NULL) boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
-                                                       if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_next->data) == FALSE) {
+                                                       if (boundary2_next == NULL)
+                                                               boundary2_next = g_list_first(priv2->boundary->polygon.position_list);
+
+                                                       if (location_position_equal((LocationPosition *)boundary1_next->data, (LocationPosition *) boundary2_next->data) == FALSE)
                                                                return -1;
-                                                       }
+
                                                        boundary1_next = g_list_next(boundary1_next);
                                                }
                                                ret = 0;
@@ -144,7 +146,7 @@ boundary_compare(gconstpointer comp1, gconstpointer comp2)
 
 int set_prop_boundary(GList **prev_boundary_priv_list, GList *new_boundary_priv_list)
 {
-       LOCATION_LOGD("ENTER >>>");
+       LOC_FUNC_LOG
        g_return_val_if_fail(new_boundary_priv_list, LOCATION_ERROR_PARAMETER);
 
        int index = 0;
@@ -174,7 +176,7 @@ int set_prop_boundary(GList **prev_boundary_priv_list, GList *new_boundary_priv_
 
 int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary)
 {
-       LOCATION_LOGD("ENTER >>>");
+       LOC_FUNC_LOG
        g_return_val_if_fail(*prev_boundary_list, LOCATION_ERROR_PARAMETER);
 
        GList *check_list = NULL;
@@ -222,10 +224,7 @@ int location_get_app_type(char *target_app_id)
        if (target_app_id == NULL) {
                pid = getpid();
                ret = app_manager_get_app_id(pid, &app_id);
-                       if (ret != APP_MANAGER_ERROR_NONE) {
-                               LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-                       return LOCATION_ERROR_NONE;
-               }
+               LOC_COND_RET(ret != APP_MANAGER_ERROR_NONE, LOCATION_ERROR_NONE, _E, "Fail to get app_id. Err[%d]", ret);
        } else {
                app_id = g_strdup(target_app_id);
        }
@@ -258,3 +257,22 @@ int location_get_app_type(char *target_app_id)
 
        return ret;
 }
+
+const char* err_msg(int err)
+{
+       switch (err) {
+       case LOCATION_ERROR_NONE: return "LOCATION_ERROR_NONE";
+       case LOCATION_ERROR_NOT_ALLOWED: return "LOCATION_ERROR_NOT_ALLOWED";
+       case LOCATION_ERROR_NOT_AVAILABLE: return "LOCATION_ERROR_NOT_AVAILABLE";
+       case LOCATION_ERROR_NETWORK_FAILED: return "LOCATION_ERROR_NETWORK_FAILED";
+       case LOCATION_ERROR_NETWORK_NOT_CONNECTED: return "LOCATION_ERROR_NETWORK_NOT_CONNECTED";
+       case LOCATION_ERROR_CONFIGURATION: return "LOCATION_ERROR_CONFIGURATION";
+       case LOCATION_ERROR_PARAMETER: return "LOCATION_ERROR_PARAMETER";
+       case LOCATION_ERROR_NOT_FOUND: return "LOCATION_ERROR_NOT_FOUND";
+       case LOCATION_ERROR_NOT_SUPPORTED: return "LOCATION_ERROR_NOT_SUPPORTED";
+       case LOCATION_ERROR_UNKNOWN: return "LOCATION_ERROR_UNKNOWN";
+       case LOCATION_ERROR_SETTING_OFF: return "LOCATION_ERROR_SETTING_OFF";
+       case LOCATION_ERROR_SECURITY_DENIED: return "LOCATION_ERROR_SECURITY_DENIED";
+       default: return "LOCATION_ERROR_UNKNOWN";
+       }
+}
index 828c520..333b2e2 100644 (file)
@@ -63,6 +63,7 @@ void free_boundary_list(gpointer data);
 
 int location_get_app_type(char *app_id);
 
+const char* err_msg(int err);
 
 G_END_DECLS
 
index 8482bbd..286d7b5 100755 (executable)
@@ -120,23 +120,20 @@ static gboolean _location_timeout_cb(gpointer data)
        LocationVelocity *vel = NULL;
        LocationAccuracy *acc = NULL;
 
-       if (priv->pos) {
+       if (priv->pos)
                pos = location_position_copy(priv->pos);
-       } else {
+       else
                pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
-       }
 
-       if (priv->vel) {
+       if (priv->vel)
                vel = location_velocity_copy(priv->vel);
-       } else {
+       else
                vel = location_velocity_new(0, 0.0, 0.0, 0.0);
-       }
 
-       if (priv->acc) {
+       if (priv->acc)
                acc = location_accuracy_copy(priv->acc);
-       } else {
+       else
                acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
 
        g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
        priv->signal_type = 0;
@@ -183,7 +180,7 @@ static gboolean _velocity_timeout_cb(gpointer data)
 
 static void __reset_pos_data_from_priv(LocationGpsPrivate *priv)
 {
-       LOCATION_LOGD("__reset_pos_data_from_priv");
+       LOC_FUNC_LOG
        g_return_if_fail(priv);
 
        if (priv->pos) {
@@ -246,7 +243,7 @@ static int __set_started(gpointer self, gboolean started)
 
 static void gps_status_cb(gboolean enabled, LocationStatus status, gpointer self)
 {
-       LOCATION_LOGD("gps_status_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(self);
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
@@ -308,9 +305,9 @@ static void gps_batch_cb(gboolean enabled, guint num_of_location, gpointer self)
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
-       if (priv->batch != NULL) {
+       if (priv->batch != NULL)
                location_batch_free(priv->batch);
-       }
+
        priv->batch = location_get_batch_file(num_of_location);
 
        g_signal_emit(self, signals[BATCH_UPDATED], 0, num_of_location);
@@ -329,7 +326,7 @@ static void gps_satellite_cb(gboolean enabled, LocationSatellite *sat, gpointer
 #ifdef TIZEN_PROFILE_MOBILE
 static void location_setting_search_cb(keynode_t *key, gpointer self)
 {
-       LOCATION_LOGD("location_setting_search_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(key);
        g_return_if_fail(self);
        LocationGpsPrivate *priv = GET_PRIVATE(self);
@@ -349,7 +346,7 @@ static void location_setting_search_cb(keynode_t *key, gpointer self)
 
 static void location_setting_gps_cb(keynode_t *key, gpointer self)
 {
-       LOCATION_LOGD("location_setting_gps_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(key);
        g_return_if_fail(self);
        LocationGpsPrivate *priv = GET_PRIVATE(self);
@@ -363,11 +360,10 @@ static void location_setting_gps_cb(keynode_t *key, gpointer self)
                LOCATION_LOGD("location stopped by setting");
                __set_started(self, FALSE);
                ret = priv->mod->ops.stop(priv->mod->handler);
-               if (ret == LOCATION_ERROR_NONE) {
+               if (ret == LOCATION_ERROR_NONE)
                        __reset_pos_data_from_priv(priv);
-               } else {
+               else
                        LOCATION_LOGI("Fail to stop[%d]", ret);
-               }
 
        } else if (1 == location_setting_get_key_val(key) && priv->mod->ops.start && !__get_started(self)) {
                LOCATION_LOGD("location resumed by setting");
@@ -382,7 +378,7 @@ static void location_setting_gps_cb(keynode_t *key, gpointer self)
 
 static int location_gps_start(LocationGps *self)
 {
-       LOCATION_LOGD("ENTER >>>");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -422,7 +418,7 @@ static int location_gps_start(LocationGps *self)
 
 static int location_gps_stop(LocationGps *self)
 {
-       LOCATION_LOGD("location_gps_stop");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -434,9 +430,7 @@ static int location_gps_stop(LocationGps *self)
        if (__get_started(self) == TRUE) {
                __set_started(self, FALSE);
                ret = priv->mod->ops.stop(priv->mod->handler);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGE("Failed to stop. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
        } else {
                return LOCATION_ERROR_NONE;
        }
@@ -496,7 +490,7 @@ static void __sensor_event_cb(sensor_h s, sensor_event_s *event, void *data)
 
 static int __set_sensor_batch(LocationGps *self, int batch_interval)
 {
-       LOCATION_LOGD("__set_sensor_batch");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
@@ -510,44 +504,31 @@ static int __set_sensor_batch(LocationGps *self, int batch_interval)
        bool supported = false;
 
        ret = sensor_is_supported((sensor_type_e)0x1A02, &supported);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_is_supported() failed");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
-
-       if (!supported) {
-               LOCATION_LOGD("Not supported");
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to sensor_is_supported [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
+       LOC_COND_RET(!supported, LOCATION_ERROR_NOT_SUPPORTED, _E, "Batch sensor is not supported [%s]", err_msg(LOCATION_ERROR_NOT_SUPPORTED));
 
        ret = sensor_get_default_sensor((sensor_type_e)0x1A02, &priv->sensor);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_get_default_sensor() failed (%d)", ret);
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to sensor_get_default_sensor [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        ret = sensor_create_listener(priv->sensor, &priv->sensor_listener);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_create_listener() failed (%d)", ret);
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to sensor_create_listener [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        ret = sensor_listener_set_event_cb(priv->sensor_listener, update_interval, __sensor_event_cb, self);
        if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_listener_set_event_cb() failed");
+               LOCATION_LOGE("sensor_listener_set_event_cb() failed");
                sensor_destroy_listener(priv->sensor_listener);
                return LOCATION_ERROR_NOT_AVAILABLE;
        }
 
        ret = sensor_listener_set_option(priv->sensor_listener, SENSOR_OPTION_ALWAYS_ON);
        if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_listener_set_option() failed");
+               LOCATION_LOGE("sensor_listener_set_option() failed");
                sensor_destroy_listener(priv->sensor_listener);
                return LOCATION_ERROR_NOT_AVAILABLE;
        }
        ret = sensor_listener_start(priv->sensor_listener);
        if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_listener_set_event_cb() failed");
+               LOCATION_LOGE("sensor_listener_set_event_cb() failed");
                sensor_destroy_listener(priv->sensor_listener);
                return LOCATION_ERROR_NOT_AVAILABLE;
        }
@@ -558,7 +539,7 @@ static int __set_sensor_batch(LocationGps *self, int batch_interval)
 
 static int location_gps_start_batch(LocationGps *self)
 {
-       LOCATION_LOGD("location_gps_start_batch");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -578,7 +559,7 @@ static int location_gps_start_batch(LocationGps *self)
                __set_started(self, TRUE);
                ret = priv->mod->ops.start_batch(priv->mod->handler, gps_batch_cb, priv->batch_interval, priv->batch_period, self);
                if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGE("Fail to start_batch. Error[%d]", ret);
+                       LOCATION_LOGE("Fail to start_batch [%s]", err_msg(ret));
                        __set_started(self, FALSE);
                        return ret;
                }
@@ -590,7 +571,7 @@ static int location_gps_start_batch(LocationGps *self)
 
 static int location_gps_stop_batch(LocationGps *self)
 {
-       LOCATION_LOGD("location_gps_stop_batch");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -601,25 +582,18 @@ static int location_gps_stop_batch(LocationGps *self)
 
 #ifdef TIZEN_DEVICE
        ret = sensor_listener_stop(priv->sensor_listener);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_listener_stop() failed (%d)", ret);
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to listener_stop [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
+
        ret = sensor_listener_unset_event_cb(priv->sensor_listener);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_listener_unset_event_cb() failed (%d)", ret);
-       }
+       LOC_IF_FAIL_LOG(ret, _E, "Fail to listener_unset_event_cb [%s]", err_msg(ret));
+
        ret = sensor_destroy_listener(priv->sensor_listener);
-       if (ret != SENSOR_ERROR_NONE) {
-               LOCATION_LOGD("sensor_destroy_listener() failed (%d)", ret);
-       }
+       LOC_IF_FAIL_LOG(ret, _E, "Fail to destroy_listener [%s]", err_msg(ret));
 #else
        if (__get_started(self) == TRUE) {
                __set_started(self, FALSE);
                ret = priv->mod->ops.stop_batch(priv->mod->handler);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGE("Failed to stop_batch. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to stop_batch [%s]", err_mgs(ret));
        } else {
                return LOCATION_ERROR_NONE;
        }
@@ -632,7 +606,7 @@ static int location_gps_stop_batch(LocationGps *self)
 
 static void location_gps_dispose(GObject *gobject)
 {
-       LOCATION_LOGD("location_gps_dispose");
+       LOC_FUNC_LOG
 
        LocationGpsPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
@@ -660,7 +634,7 @@ static void location_gps_dispose(GObject *gobject)
 
 static void location_gps_finalize(GObject *gobject)
 {
-       LOCATION_LOGD("location_gps_finalize");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
 
@@ -711,14 +685,14 @@ static void location_gps_set_property(GObject *object, guint property_id, const
        case PROP_BOUNDARY: {
                                GList *boundary_list = g_list_copy(g_value_get_pointer(value));
                                ret = set_prop_boundary(&priv->boundary_list, boundary_list);
-                               if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Set boundary. Error[%s]", err_msg(ret));
                                if (boundary_list) g_list_free(boundary_list);
                                break;
                        }
        case PROP_REMOVAL_BOUNDARY: {
                                LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
                                ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
-                               if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Removal boundary. Error[%s]", err_msg(ret));
                                break;
                        }
        case PROP_POS_INTERVAL: {
@@ -875,72 +849,72 @@ static void location_gps_get_property(GObject *object, guint property_id, GValue
        g_return_if_fail(priv->mod->handler);
        LocModGpsOps ops = priv->mod->ops;
        switch (property_id) {
-               case PROP_METHOD_TYPE:
-                       g_value_set_int(value, LOCATION_METHOD_GPS);
-                       break;
-               case PROP_IS_STARTED:
-                       g_value_set_boolean(value, __get_started(object));
-                       break;
-               case PROP_LAST_POSITION:
-                       g_value_set_boxed(value, priv->pos);
-                       break;
-               case PROP_POS_INTERVAL:
-                       g_value_set_uint(value, priv->pos_interval);
-                       break;
-               case PROP_VEL_INTERVAL:
-                       g_value_set_uint(value, priv->vel_interval);
-                       break;
-               case PROP_SAT_INTERVAL:
-                       g_value_set_uint(value, priv->sat_interval);
-                       break;
-               case PROP_LOC_INTERVAL:
-                       g_value_set_uint(value, priv->loc_interval);
-                       break;
-               case PROP_BATCH_INTERVAL:
-                       g_value_set_uint(value, priv->batch_interval);
-                       break;
-               case PROP_BATCH_PERIOD:
-                       g_value_set_uint(value, priv->batch_period);
-                       break;
-               case PROP_MIN_INTERVAL:
-                       g_value_set_uint(value, priv->min_interval);
-                       break;
-               case PROP_MIN_DISTANCE:
-                       g_value_set_double(value, priv->min_distance);
-                       break;
-               case PROP_BOUNDARY:
-                       g_value_set_pointer(value, g_list_first(priv->boundary_list));
-                       break;
-               case PROP_NMEA: {
-                               char *nmea_data = NULL;
-                               if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
-                                       LOCATION_SECLOG("Get prop>> Lastest nmea: \n%s", nmea_data);
-                                       g_value_set_string(value, nmea_data);
-                                       g_free(nmea_data);
-                               } else {
-                                       LOCATION_LOGW("Get prop>> Lastest nmea: failed");
-                                       g_value_set_string(value, NULL);
-                               }
-                               break;
-                       }
-               case PROP_SATELLITE: {
-                               LocationSatellite *satellite = NULL;
-                               if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite) {
-                                       LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
-                                       g_value_set_boxed(value, satellite);
-                                       location_satellite_free(satellite);
-                               } else {
-                                       LOCATION_LOGW("Get prop>> Last sat: failed");
-                                       g_value_set_boxed(value, NULL);
-                               }
-                               break;
+       case PROP_METHOD_TYPE:
+               g_value_set_int(value, LOCATION_METHOD_GPS);
+               break;
+       case PROP_IS_STARTED:
+               g_value_set_boolean(value, __get_started(object));
+               break;
+       case PROP_LAST_POSITION:
+               g_value_set_boxed(value, priv->pos);
+               break;
+       case PROP_POS_INTERVAL:
+               g_value_set_uint(value, priv->pos_interval);
+               break;
+       case PROP_VEL_INTERVAL:
+               g_value_set_uint(value, priv->vel_interval);
+               break;
+       case PROP_SAT_INTERVAL:
+               g_value_set_uint(value, priv->sat_interval);
+               break;
+       case PROP_LOC_INTERVAL:
+               g_value_set_uint(value, priv->loc_interval);
+               break;
+       case PROP_BATCH_INTERVAL:
+               g_value_set_uint(value, priv->batch_interval);
+               break;
+       case PROP_BATCH_PERIOD:
+               g_value_set_uint(value, priv->batch_period);
+               break;
+       case PROP_MIN_INTERVAL:
+               g_value_set_uint(value, priv->min_interval);
+               break;
+       case PROP_MIN_DISTANCE:
+               g_value_set_double(value, priv->min_distance);
+               break;
+       case PROP_BOUNDARY:
+               g_value_set_pointer(value, g_list_first(priv->boundary_list));
+               break;
+       case PROP_NMEA: {
+                       char *nmea_data = NULL;
+                       if (ops.get_nmea && LOCATION_ERROR_NONE == ops.get_nmea(priv->mod->handler, &nmea_data) && nmea_data) {
+                               LOCATION_SECLOG("Get prop>> Lastest nmea: \n%s", nmea_data);
+                               g_value_set_string(value, nmea_data);
+                               g_free(nmea_data);
+                       } else {
+                               LOCATION_LOGW("Get prop>> Lastest nmea: failed");
+                               g_value_set_string(value, NULL);
                        }
-               case PROP_SERVICE_STATUS:
-                       g_value_set_int(value, priv->enabled);
                        break;
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+               }
+       case PROP_SATELLITE: {
+                       LocationSatellite *satellite = NULL;
+                       if (ops.get_satellite && priv->mod->handler && LOCATION_ERROR_NONE == ops.get_satellite(priv->mod->handler, &satellite) && satellite) {
+                               LOCATION_LOGD("Get prop>> Last sat: num_used(%d) num_view(%d)", satellite->num_of_sat_used, satellite->num_of_sat_inview);
+                               g_value_set_boxed(value, satellite);
+                               location_satellite_free(satellite);
+                       } else {
+                               LOCATION_LOGW("Get prop>> Last sat: failed");
+                               g_value_set_boxed(value, NULL);
+                       }
                        break;
+               }
+       case PROP_SERVICE_STATUS:
+               g_value_set_int(value, priv->enabled);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+               break;
        }
 }
 
@@ -951,10 +925,7 @@ static int location_gps_get_position(LocationGps *self, LocationPosition **posit
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->pos) {
                *position = location_position_copy(priv->pos);
@@ -974,10 +945,7 @@ location_gps_get_position_ext(LocationGps *self, LocationPosition **position, Lo
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->pos && priv->vel) {
                *position = location_position_copy(priv->pos);
@@ -1034,10 +1002,7 @@ location_gps_get_velocity(LocationGps *self, LocationVelocity **velocity, Locati
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->vel) {
                *velocity = location_velocity_copy(priv->vel);
@@ -1071,7 +1036,7 @@ location_gps_get_last_velocity(LocationGps *self, LocationVelocity **velocity, L
 
 static gboolean __single_location_timeout_cb(void *data)
 {
-       LOCATION_LOGD("__single_location_timeout_cb");
+       LOC_FUNC_LOG
        LocationGps *self = (LocationGps *)data;
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, FALSE);
@@ -1092,7 +1057,7 @@ static gboolean __single_location_timeout_cb(void *data)
 static void
 gps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
 {
-       LOCATION_LOGD("gps_single_location_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(self);
        g_return_if_fail(pos);
        g_return_if_fail(vel);
@@ -1113,7 +1078,7 @@ gps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity
 static int
 location_gps_request_single_location(LocationGps *self, int timeout)
 {
-       LOCATION_LOGD("location_gps_request_single_location");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -1131,9 +1096,9 @@ location_gps_request_single_location(LocationGps *self, int timeout)
                __set_started(self, FALSE);
                return ret;
        } else {
-               if (priv->loc_timeout != 0) {
+               if (priv->loc_timeout != 0)
                        g_source_remove(priv->loc_timeout);
-               }
+
                priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
        }
 
@@ -1152,9 +1117,7 @@ static int location_gps_get_nmea(LocationGps *self, char **nmea_data)
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
        ret = priv->mod->ops.get_nmea(priv->mod->handler, nmea_data);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Failed to get_nmea. Error[%d]", ret);
-       }
+       LOC_IF_FAIL_LOG(ret, _E, "Failed to get_nmea [%s]", err_msg(ret));
 
        return ret;
 }
@@ -1169,10 +1132,7 @@ static int location_gps_get_batch(LocationGps *self, LocationBatch **batch)
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
 #ifndef TIZEN_DEVICE
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 #endif
 
        if (priv->batch) {
@@ -1194,10 +1154,7 @@ static int location_gps_get_satellite(LocationGps *self, LocationSatellite **sat
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "Location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->sat) {
                *satellite = location_satellite_copy(priv->sat);
@@ -1222,9 +1179,7 @@ static int location_gps_set_option(LocationGps *self, const char *option)
 
        int ret = LOCATION_ERROR_NONE;
        ret = priv->mod->ops.set_option(priv->mod->handler, option);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Failed to set_option. Error[%d]", ret);
-       }
+       LOC_IF_FAIL_LOG(ret, _E, "Failed to set_option [%s]", err_msg(ret));
 
        return ret;
 }
@@ -1253,12 +1208,12 @@ static void location_ielement_interface_init(LocationIElementInterface *iface)
 
 static void location_gps_init(LocationGps *self)
 {
-       LOCATION_LOGD("location_gps_init");
+       LOC_FUNC_LOG
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
        priv->mod = (LocationGpsMod *)module_new("gps");
-       if (!priv->mod) LOCATION_LOGW("module loading failed");
+       LOC_COND_LOG(!priv->mod, _E, "Module loading failed");
 
        g_mutex_init(&priv->mutex);
        priv->is_started = FALSE;
@@ -1299,14 +1254,12 @@ static void location_gps_init(LocationGps *self)
 #endif
 
        priv->app_type = location_get_app_type(NULL);
-       if (priv->app_type == 0) {
-               LOCATION_LOGW("Fail to get app_type");
-       }
+       LOC_COND_LOG(priv->app_type == 0, _W, "Fail to get app_type");
 }
 
 static void location_gps_class_init(LocationGpsClass *klass)
 {
-       LOCATION_LOGD("location_gps_class_init");
+       LOC_FUNC_LOG
        GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
        gobject_class->set_property = location_gps_set_property;
index e660777..93ba75f 100755 (executable)
@@ -111,15 +111,15 @@ hybrid_set_current_method(LocationHybridPrivate *priv, GType g_type)
 {
        g_return_val_if_fail(priv, FALSE);
 
-       if (g_type == LOCATION_TYPE_GPS) {
+       if (g_type == LOCATION_TYPE_GPS)
                priv->current_method = LOCATION_METHOD_GPS;
-       } else if (g_type == LOCATION_TYPE_WPS) {
+       else if (g_type == LOCATION_TYPE_WPS)
                priv->current_method = LOCATION_METHOD_WPS;
-       } else if (g_type == LOCATION_TYPE_MOCK) {
-                       priv->current_method = LOCATION_METHOD_MOCK;
-       } else if (g_type == LOCATION_TYPE_HYBRID) {
+       else if (g_type == LOCATION_TYPE_MOCK)
+               priv->current_method = LOCATION_METHOD_MOCK;
+       else if (g_type == LOCATION_TYPE_HYBRID)
                priv->current_method = LOCATION_METHOD_HYBRID;
-       else
+       else
                return FALSE;
 
        return TRUE;
@@ -131,15 +131,14 @@ hybrid_get_update_method(LocationHybridPrivate *priv)
 {
        if (!priv->gps && !priv->wps & !priv->mock) return -1;
 
-       if (priv->gps_enabled) {
+       if (priv->gps_enabled)
                hybrid_set_current_method(priv, LOCATION_TYPE_GPS);
-       } else if (priv->wps_enabled) {
+       else if (priv->wps_enabled)
                hybrid_set_current_method(priv, LOCATION_TYPE_WPS);
-       } else if (priv->mock_enabled) {
+       else if (priv->mock_enabled)
                hybrid_set_current_method(priv, LOCATION_TYPE_MOCK);
-       } else {
+       else
                hybrid_set_current_method(priv, LOCATION_TYPE_HYBRID);
-       }
 
        return 0;
 }
@@ -200,23 +199,20 @@ _location_timeout_cb(gpointer data)
        LocationVelocity *vel = NULL;
        LocationAccuracy *acc = NULL;
 
-       if (priv->pos) {
+       if (priv->pos)
                pos = location_position_copy(priv->pos);
-       } else {
+       else
                pos = location_position_new(0, 0.0, 0.0, 0.0, LOCATION_STATUS_NO_FIX);
-       }
 
-       if (priv->vel) {
+       if (priv->vel)
                vel = location_velocity_copy(priv->vel);
-       } else {
+       else
                vel = location_velocity_new(0, 0.0, 0.0, 0.0);
-       }
 
-       if (priv->acc) {
+       if (priv->acc)
                acc = location_accuracy_copy(priv->acc);
-       } else {
+       else
                acc = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
 
        g_signal_emit(object, signals[SERVICE_UPDATED], 0, priv->signal_type, pos, vel, acc);
        priv->signal_type = 0;
@@ -265,7 +261,7 @@ _velocity_timeout_cb(gpointer data)
 static void
 location_hybrid_gps_cb(keynode_t *key, gpointer self)
 {
-       LOCATION_LOGD("location_hybrid_gps_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(key);
        g_return_if_fail(self);
        LocationHybridPrivate *priv = GET_PRIVATE(self);
@@ -283,10 +279,7 @@ location_hybrid_gps_cb(keynode_t *key, gpointer self)
                if (wps_started == FALSE && 1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
                        LOCATION_LOGD("GPS stoped by setting, so restart WPS");
                        ret = location_start(priv->wps);
-                       if (ret != LOCATION_ERROR_NONE) {
-                               LOCATION_LOGW("Fail hyhrid/wps location_start : [%d]", ret);
-                               return;
-                       }
+                       LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hybrid/wps location_start : [%s]", err_msg(ret));
                }
        } else if (1 == onoff) {
                LOCATION_LOGD("Hybrid GPS resumed by setting");
@@ -318,7 +311,7 @@ hybrid_location_updated(GObject *obj,
 static void
 hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity, gpointer accuracy, gpointer self)
 {
-       LOCATION_LOGD("hybrid_service_updated");
+       LOC_FUNC_LOG
        LocationPosition *pos = NULL;
        LocationVelocity *vel = NULL;
        LocationAccuracy *acc = NULL;
@@ -353,10 +346,7 @@ hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity
                        if (priv->wps && wps_started == FALSE) {
                                LOCATION_LOGD("Starting WPS");
                                ret = location_start(priv->wps);
-                               if (ret != LOCATION_ERROR_NONE) {
-                                       LOCATION_LOGW("Fail hyhrid location_start : [%d]", ret);
-                                       return;
-                               }
+                               LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hyhrid location_start : [%s]", err_msg(ret));
                        }
                        return;
                }
@@ -378,9 +368,8 @@ hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity
                if (acc) priv->acc = location_accuracy_copy(acc);
 
                if (pos) {
-                       if (!priv->enabled) {
+                       if (!priv->enabled)
                                enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
-                       }
 
                        if (type == DISTANCE_UPDATED) {
                                distance_based_position_signaling(self, signals, priv->enabled, pos, vel, acc,
@@ -398,10 +387,7 @@ hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity
                if (g_type == LOCATION_TYPE_GPS && wps_started == TRUE) {
                        LOCATION_LOGD("Calling WPS stop");
                        ret = location_stop(priv->wps);
-                       if (ret != LOCATION_ERROR_NONE) {
-                               LOCATION_LOGW("Fail hybrid location_stop : [%d]", ret);
-                               return;
-                       }
+                       LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Fail hyhrid location_stop : [%s]", err_msg(ret));
                }
 
        } else if (g_type == LOCATION_TYPE_WPS
@@ -418,9 +404,8 @@ hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity
                if (acc) priv->acc = location_accuracy_copy(acc);
 
                if (pos) {
-                       if (!priv->enabled) {
+                       if (!priv->enabled)
                                enable_signaling(self, signals, &(priv->enabled), TRUE, pos->status);
-                       }
 
                        if (type == DISTANCE_UPDATED) {
                                distance_based_position_signaling(self, signals, priv->enabled, pos, vel, acc,
@@ -439,7 +424,7 @@ hybrid_service_updated(GObject *obj, gint type, gpointer data, gpointer velocity
 static void
 hybrid_service_enabled(GObject *obj, guint status, gpointer self)
 {
-       LOCATION_LOGD("hybrid_service_enabled");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
        g_return_if_fail(priv);
 
@@ -460,7 +445,7 @@ hybrid_service_enabled(GObject *obj, guint status, gpointer self)
 static void
 hybrid_service_disabled(GObject *obj, guint status, gpointer self)
 {
-       LOCATION_LOGD("hybrid_service_disabled");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
        g_return_if_fail(priv);
        GType g_type = G_TYPE_FROM_INSTANCE(obj);
@@ -556,7 +541,7 @@ hybrid_status_changed(GObject *obj, guint status, gpointer self)
 static int
 location_hybrid_start(LocationHybrid *self)
 {
-       LOCATION_LOGD("location_hybrid_start");
+       LOC_FUNC_LOG
 
        int ret_gps = LOCATION_ERROR_NONE;
        int ret_wps = LOCATION_ERROR_NONE;
@@ -567,10 +552,7 @@ location_hybrid_start(LocationHybrid *self)
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
-       if (!priv->gps && !priv->wps) {
-               LOCATION_LOGE("GPS and WPS Object are not created.");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(!priv->gps && !priv->wps, LOCATION_ERROR_NOT_AVAILABLE, _E, "GPS and WPS Object are not created.");
 
        if (priv->gps) g_object_get(priv->gps, "is_started", &gps_started, NULL);
        if (priv->wps) g_object_get(priv->wps, "is_started", &wps_started, NULL);
@@ -587,15 +569,14 @@ location_hybrid_start(LocationHybrid *self)
 
        if (ret_gps != LOCATION_ERROR_NONE && ret_wps != LOCATION_ERROR_NONE && ret_mock != LOCATION_ERROR_NONE) {
                LOCATION_LOGD("ret_gps = %d, ret_wps = %d, ret_mock = %d", ret_gps, ret_wps, ret_mock);
-               if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED || ret_mock == LOCATION_ERROR_SECURITY_DENIED) {
+               if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED || ret_mock == LOCATION_ERROR_SECURITY_DENIED)
                        return LOCATION_ERROR_SECURITY_DENIED;
-               } else if (ret_gps == LOCATION_ERROR_SETTING_OFF || ret_wps == LOCATION_ERROR_SETTING_OFF || ret_mock == LOCATION_ERROR_SETTING_OFF) {
+               else if (ret_gps == LOCATION_ERROR_SETTING_OFF || ret_wps == LOCATION_ERROR_SETTING_OFF || ret_mock == LOCATION_ERROR_SETTING_OFF)
                        return LOCATION_ERROR_SETTING_OFF;
-               } else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED || ret_wps == LOCATION_ERROR_NOT_ALLOWED || ret_mock == LOCATION_ERROR_NOT_ALLOWED) {
+               else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED || ret_wps == LOCATION_ERROR_NOT_ALLOWED || ret_mock == LOCATION_ERROR_NOT_ALLOWED)
                        return LOCATION_ERROR_NOT_ALLOWED;
-               } else {
+               else
                        return LOCATION_ERROR_NOT_AVAILABLE;
-               }
        }
 
        if (priv->set_noti == FALSE) {
@@ -609,7 +590,7 @@ location_hybrid_start(LocationHybrid *self)
 static int
 location_hybrid_stop(LocationHybrid *self)
 {
-       LOCATION_LOGD("location_hybrid_stop");
+       LOC_FUNC_LOG
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
@@ -627,9 +608,8 @@ location_hybrid_stop(LocationHybrid *self)
        if (priv->wps) g_object_get(priv->wps, "is_started", &wps_started, NULL);
        if (priv->mock) g_object_get(priv->mock, "is_started", &mock_started, NULL);
 
-       if ((gps_started == FALSE) && (wps_started == FALSE) && (mock_started == FALSE)) {
+       if ((gps_started == FALSE) && (wps_started == FALSE) && (mock_started == FALSE))
                return LOCATION_ERROR_NONE;
-       }
 
        if (priv->gps) ret_gps = location_stop(priv->gps);
        if (priv->wps) ret_wps = location_stop(priv->wps);
@@ -658,7 +638,7 @@ location_hybrid_stop(LocationHybrid *self)
 static void
 location_hybrid_dispose(GObject *gobject)
 {
-       LOCATION_LOGD("location_hybrid_dispose");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
 
@@ -678,7 +658,7 @@ location_hybrid_dispose(GObject *gobject)
 static void
 location_hybrid_finalize(GObject *gobject)
 {
-       LOCATION_LOGD("location_hybrid_finalize");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
 
@@ -751,13 +731,13 @@ location_hybrid_set_property(GObject *object, guint property_id, const GValue *v
        case PROP_BOUNDARY: {
                                GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
                                ret = set_prop_boundary(&priv->boundary_list, boundary_list);
-                               if (ret != 0) LOCATION_LOGD("Set boundary. Error[%d]", ret);
+                               LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Set boundary. Error[%s]", err_msg(ret));
                                break;
                        }
        case PROP_REMOVAL_BOUNDARY: {
                                LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
                                ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
-                               if (ret != 0) LOCATION_LOGD("Removal boundary. Error[%d]", ret);
+                               LOC_COND_VOID(ret != LOCATION_ERROR_NONE, _E, "Removal boundary. Error[%s]", err_msg(ret));
                                break;
                        }
        case PROP_POS_INTERVAL: {
@@ -877,10 +857,8 @@ location_hybrid_get_property(GObject *object, guint property_id, GValue *value,
 {
        LocationHybridPrivate *priv = GET_PRIVATE(object);
        g_return_if_fail(priv);
-       if (!priv->gps && !priv->wps) {
-               LOCATION_LOGW("Get property is not available now");
-               return;
-       }
+
+       LOC_COND_VOID(!priv->gps && !priv->wps, _E, "Error : Get property is not available now");
 
        LOCATION_LOGW("Get Propery ID[%d]", property_id);
 
@@ -924,11 +902,10 @@ location_hybrid_get_property(GObject *object, guint property_id, GValue *value,
 static int
 location_hybrid_get_position(LocationHybrid *self, LocationPosition **position, LocationAccuracy **accuracy)
 {
+       LOC_FUNC_LOG
        int ret = LOCATION_ERROR_NOT_AVAILABLE;
-       LOCATION_LOGD("location_hybrid_get_position");
-       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
                return LOCATION_ERROR_SETTING_OFF;
-       }
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
@@ -938,9 +915,8 @@ location_hybrid_get_position(LocationHybrid *self, LocationPosition **position,
                ret = LOCATION_ERROR_NONE;
        }
 
-       if (priv->acc) {
+       if (priv->acc)
                *accuracy = location_accuracy_copy(priv->acc);
-       }
 
        return ret;
 }
@@ -948,10 +924,9 @@ location_hybrid_get_position(LocationHybrid *self, LocationPosition **position,
 static int
 location_hybrid_get_position_ext(LocationHybrid *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
 {
-       LOCATION_LOGD("location_hybrid_get_position_ext");
-       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+       LOC_FUNC_LOG
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
                return LOCATION_ERROR_SETTING_OFF;
-       }
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
@@ -964,11 +939,10 @@ location_hybrid_get_position_ext(LocationHybrid *self, LocationPosition **positi
                return LOCATION_ERROR_NOT_AVAILABLE;
        }
 
-       if (priv->acc) {
+       if (priv->acc)
                *accuracy = location_accuracy_copy(priv->acc);
-       } else {
+       else
                *accuracy = location_accuracy_new(LOCATION_ACCURACY_LEVEL_NONE, 0.0, 0.0);
-       }
 
        return LOCATION_ERROR_NONE;
 }
@@ -977,7 +951,7 @@ location_hybrid_get_position_ext(LocationHybrid *self, LocationPosition **positi
 static int
 location_hybrid_get_last_position(LocationHybrid *self, LocationPosition **position, LocationAccuracy **accuracy)
 {
-       LOCATION_LOGD("location_hybrid_get_last_position");
+       LOC_FUNC_LOG
 
        int ret = LOCATION_ERROR_NONE;
        LocationPosition *gps_pos = NULL, *wps_pos = NULL;
@@ -1016,7 +990,7 @@ location_hybrid_get_last_position(LocationHybrid *self, LocationPosition **posit
 static int
 location_hybrid_get_last_position_ext(LocationHybrid *self, LocationPosition **position, LocationVelocity **velocity, LocationAccuracy **accuracy)
 {
-       LOCATION_LOGD("location_hybrid_get_last_position_ext");
+       LOC_FUNC_LOG
 
        int ret = LOCATION_ERROR_NONE;
        LocationPosition *gps_pos = NULL, *wps_pos = NULL, *mock_pos = NULL;
@@ -1070,11 +1044,10 @@ location_hybrid_get_last_position_ext(LocationHybrid *self, LocationPosition **p
 static int
 location_hybrid_get_velocity(LocationHybrid *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
 {
+       LOC_FUNC_LOG
        int ret = LOCATION_ERROR_NOT_AVAILABLE;
-       LOCATION_LOGD("location_hybrid_get_velocity");
-       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
                return LOCATION_ERROR_SETTING_OFF;
-       }
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
@@ -1084,9 +1057,8 @@ location_hybrid_get_velocity(LocationHybrid *self, LocationVelocity **velocity,
                ret = LOCATION_ERROR_NONE;
        }
 
-       if (priv->acc) {
+       if (priv->acc)
                *accuracy = location_accuracy_copy(priv->acc);
-       }
 
        return ret;
 }
@@ -1094,7 +1066,7 @@ location_hybrid_get_velocity(LocationHybrid *self, LocationVelocity **velocity,
 static int
 location_hybrid_get_last_velocity(LocationHybrid *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
 {
-       LOCATION_LOGD("location_hybrid_get_last_velocity");
+       LOC_FUNC_LOG
 
        int ret = LOCATION_ERROR_NONE;
        LocationHybridPrivate *priv = GET_PRIVATE(self);
@@ -1144,11 +1116,10 @@ location_hybrid_get_last_velocity(LocationHybrid *self, LocationVelocity **veloc
 static int
 location_hybrid_get_satellite(LocationHybrid *self, LocationSatellite **satellite)
 {
+       LOC_FUNC_LOG
        int ret = LOCATION_ERROR_NOT_AVAILABLE;
-       LOCATION_LOGD("location_hybrid_get_satellite");
-       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED)) {
+       if (!location_setting_get_int(VCONFKEY_LOCATION_ENABLED) && !location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED))
                return LOCATION_ERROR_SETTING_OFF;
-       }
 
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
@@ -1163,7 +1134,7 @@ location_hybrid_get_satellite(LocationHybrid *self, LocationSatellite **satellit
 static int
 location_hybrid_get_last_satellite(LocationHybrid *self, LocationSatellite **satellite)
 {
-       LOCATION_LOGD("location_hybrid_get_last_satellite");
+       LOC_FUNC_LOG
 
        int ret = LOCATION_ERROR_NONE;
        LocationHybridPrivate *priv = GET_PRIVATE(self);
@@ -1182,7 +1153,7 @@ location_hybrid_get_last_satellite(LocationHybrid *self, LocationSatellite **sat
 static int
 location_hybrid_set_option(LocationHybrid *self, const char *option)
 {
-       LOCATION_LOGD("location_hybrid_set_option");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
@@ -1201,19 +1172,18 @@ location_hybrid_set_option(LocationHybrid *self, const char *option)
 static int
 location_hybrid_request_single_location(LocationHybrid *self, int timeout)
 {
-       LOCATION_LOGD("location_hybrid_request_single_location");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
        int ret = LOCATION_ERROR_NOT_AVAILABLE;
 
-       if (priv->gps) {
+       if (priv->gps)
                ret = location_request_single_location(priv->gps, timeout);
-       } else if (priv->wps) {
+       else if (priv->wps)
                ret = location_request_single_location(priv->wps, timeout);
-       } else if (priv->mock) {
+       else if (priv->mock)
                ret = location_request_single_location(priv->mock, timeout);
-       }
 
        return ret;
 }
@@ -1221,7 +1191,7 @@ location_hybrid_request_single_location(LocationHybrid *self, int timeout)
 static int
 location_hybrid_get_nmea(LocationHybrid *self, char **nmea_data)
 {
-       LOCATION_LOGD("location_hybrid_get_nmea");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
@@ -1245,14 +1215,12 @@ location_hybrid_set_mock_location(LocationMock *self, LocationPosition *position
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
        int ret = LOCATION_ERROR_NONE;
+       LOC_COND_RET(!priv->mock, LOCATION_ERROR_NOT_AVAILABLE, _E, "MOCK Object is not created [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
-       if (!priv->mock) {
-               LOCATION_LOGE("MOCK Object is not created.");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       if (priv->mock)
+               ret = location_set_mock_location(priv->mock, position, velocity, accuracy);
 
-       if (priv->mock) ret = location_set_mock_location(priv->mock, position, velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("ret = %d", ret);
+       LOC_IF_FAIL_LOG(ret, _E, "set_mock_location [%s]", err_msg(ret));
 
        return ret;
 }
@@ -1264,14 +1232,12 @@ location_hybrid_clear_mock_location(LocationMock *self)
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
 
        int ret = LOCATION_ERROR_NONE;
+       LOC_COND_RET(!priv->mock, LOCATION_ERROR_NOT_AVAILABLE, _E, "MOCK Object is not created [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
-       if (!priv->mock) {
-               LOCATION_LOGE("MOCK Object is not created.");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       if (priv->mock)
+               ret = location_clear_mock_location(priv->mock);
 
-       if (priv->mock) ret = location_clear_mock_location(priv->mock);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGD("ret = %d", ret);
+       LOC_IF_FAIL_LOG(ret, _E, "clear_mock_location [%s]", err_msg(ret));
 
        return ret;
 }
@@ -1300,7 +1266,7 @@ location_ielement_interface_init(LocationIElementInterface *iface)
 static void
 location_hybrid_init(LocationHybrid *self)
 {
-       LOCATION_LOGD("location_hybrid_init");
+       LOC_FUNC_LOG
        LocationHybridPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
@@ -1365,7 +1331,7 @@ location_hybrid_init(LocationHybrid *self)
 static void
 location_hybrid_class_init(LocationHybridClass *klass)
 {
-       LOCATION_LOGD("location_hybrid_class_init");
+       LOC_FUNC_LOG
        GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
        gobject_class->set_property = location_hybrid_set_property;
index 4cac6f4..0f05271 100755 (executable)
@@ -94,7 +94,7 @@ G_DEFINE_TYPE_WITH_CODE(LocationMock, location_mock, G_TYPE_OBJECT,
 static void
 __reset_pos_data_from_priv(LocationMockPrivate *priv)
 {
-       LOCATION_LOGD("__reset_pos_data_from_priv");
+       LOC_FUNC_LOG
        g_return_if_fail(priv);
 
        if (priv->pos) {
@@ -140,7 +140,7 @@ __set_started(gpointer self, gboolean started)
 static void
 mock_status_cb(gboolean enabled, LocationStatus status, gpointer self)
 {
-       LOCATION_LOGD("mock_status_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(self);
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
@@ -200,7 +200,7 @@ mock_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel,
 static void
 location_setting_mock_cb(keynode_t *key, gpointer self)
 {
-       LOCATION_LOGD("location_setting_mock_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(key);
        g_return_if_fail(self);
        LocationMockPrivate *priv = GET_PRIVATE(self);
@@ -214,9 +214,8 @@ location_setting_mock_cb(keynode_t *key, gpointer self)
                if (priv->mod->ops.stop && __get_started(self)) {
                        __set_started(self, FALSE);
                        ret = priv->mod->ops.stop(priv->mod->handler);
-                       if (ret == LOCATION_ERROR_NONE) {
+                       if (ret == LOCATION_ERROR_NONE)
                                __reset_pos_data_from_priv(priv);
-                       }
                }
        } else {
                if (location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED) == 1 && priv->mod->ops.start && !__get_started(self)) {
@@ -235,7 +234,7 @@ location_setting_mock_cb(keynode_t *key, gpointer self)
 static int
 location_mock_start(LocationMock *self)
 {
-       LOCATION_LOGD("ENTER >>>");
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -270,7 +269,7 @@ location_mock_start(LocationMock *self)
 static int
 location_mock_stop(LocationMock *self)
 {
-       LOCATION_LOGD("location_mock_stop");
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -282,9 +281,7 @@ location_mock_stop(LocationMock *self)
        if (__get_started(self) == TRUE) {
                __set_started(self, FALSE);
                ret = priv->mod->ops.stop(priv->mod->handler);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGD("Failed to stop. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
        }
 
        if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
@@ -300,8 +297,7 @@ location_mock_stop(LocationMock *self)
 static void
 location_mock_dispose(GObject *gobject)
 {
-       LOCATION_LOGD("location_mock_dispose");
-
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
 
@@ -318,7 +314,7 @@ location_mock_dispose(GObject *gobject)
 static void
 location_mock_finalize(GObject *gobject)
 {
-       LOCATION_LOGD("location_mock_finalize");
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
        module_free(priv->mod, "mock");
@@ -357,14 +353,14 @@ location_mock_set_property(GObject *object, guint property_id, const GValue *val
        case PROP_BOUNDARY: {
                                GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
                                ret = set_prop_boundary(&priv->boundary_list, boundary_list);
-                               if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Set boundary. Error[%s]", err_msg(ret));
                                if (boundary_list) g_list_free(boundary_list);
                                break;
                        }
        case PROP_REMOVAL_BOUNDARY: {
                                LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
                                ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
-                               if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Set removal boundary. Error[%s]", err_msg(ret));
                                break;
                        }
        case PROP_POS_INTERVAL: {
@@ -489,10 +485,7 @@ location_mock_get_position(LocationMock *self, LocationPosition **position, Loca
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->pos) {
                *position = location_position_copy(priv->pos);
@@ -514,10 +507,7 @@ location_mock_get_position_ext(LocationMock *self, LocationPosition **position,
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->pos && priv->vel) {
                *position = location_position_copy(priv->pos);
@@ -581,10 +571,7 @@ location_mock_get_velocity(LocationMock *self, LocationVelocity **velocity, Loca
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_MOCK_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->vel) {
                *velocity = location_velocity_copy(priv->vel);
@@ -618,7 +605,7 @@ location_mock_get_last_velocity(LocationMock *self, LocationVelocity **velocity,
 static gboolean
 __single_location_timeout_cb(void *data)
 {
-       LOCATION_LOGD("__single_location_timeout_cb");
+       LOC_FUNC_LOG
        LocationMock *self = (LocationMock *)data;
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, FALSE);
@@ -640,7 +627,7 @@ __single_location_timeout_cb(void *data)
 static void
 mock_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
 {
-       LOCATION_LOGD("mock_single_location_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(self);
        g_return_if_fail(pos);
        g_return_if_fail(vel);
@@ -660,7 +647,7 @@ mock_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocit
 static int
 location_mock_request_single_location(LocationMock *self, int timeout)
 {
-       LOCATION_LOGD("location_mock_request_single_location");
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -678,9 +665,9 @@ location_mock_request_single_location(LocationMock *self, int timeout)
                __set_started(self, FALSE);
                return ret;
        } else {
-               if (priv->loc_timeout != 0) {
+               if (priv->loc_timeout != 0)
                        g_source_remove(priv->loc_timeout);
-               }
+
                priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
        }
 
@@ -711,9 +698,7 @@ location_mock_set_option(LocationMock *self, const char *option)
        int ret = LOCATION_ERROR_NONE;
 
        ret = priv->mod->ops.set_option(priv->mod->handler, option);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Failed to set_option. Error[%d]", ret);
-       }
+       LOC_IF_FAIL_LOG(ret, _E, "Failed to set_option. Error[%d]", ret);
 
        return ret;
 }
@@ -763,20 +748,17 @@ __set_mock_location_cb(gboolean enabled, LocationStatus status, gpointer self)
 static int
 location_mock_set_mock_location(LocationMock *self, LocationPosition *position, LocationVelocity *velocity, LocationAccuracy *accuracy)
 {
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod->ops.set_mock_location, LOCATION_ERROR_NOT_AVAILABLE);
 
-       LOCATION_LOGD("ENTER >>>");
-
        int ret = LOCATION_ERROR_NONE;
        if (!location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED)) {
                ret = LOCATION_ERROR_SETTING_OFF;
        } else {
                ret = priv->mod->ops.set_mock_location(priv->mod->handler, position, velocity, accuracy, __set_mock_location_cb, self);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGE("Failed to set_mock_location. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to set_mock_location [%s]", err_msg(ret));
        }
 
        return ret;
@@ -785,20 +767,17 @@ location_mock_set_mock_location(LocationMock *self, LocationPosition *position,
 static int
 location_mock_clear_mock_location(LocationMock *self)
 {
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod->ops.set_mock_location, LOCATION_ERROR_NOT_AVAILABLE);
 
-       LOCATION_LOGD("ENTER >>>");
-
        int ret = LOCATION_ERROR_NONE;
        if (!location_setting_get_int(VCONFKEY_LOCATION_MOCK_ENABLED)) {
                ret = LOCATION_ERROR_SETTING_OFF;
        } else {
                ret = priv->mod->ops.clear_mock_location(priv->mod->handler, __set_mock_location_cb, self);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGE("Failed to set_mock_location. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to clear_mock_location [%s]", err_msg(ret));
        }
 
        return ret;
@@ -835,12 +814,12 @@ location_ielement_interface_init(LocationIElementInterface *iface)
 static void
 location_mock_init(LocationMock *self)
 {
-       LOCATION_LOGD("location_mock_init");
+       LOC_FUNC_LOG
        LocationMockPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
        priv->mod = (LocationMockMod *)module_new("mock");
-       if (!priv->mod) LOCATION_LOGW("module loading failed");
+       LOC_COND_LOG(!priv->mod, _E, "Module loading failed");
 
        g_mutex_init(&priv->mutex);
        priv->is_started = FALSE;
@@ -864,15 +843,13 @@ location_mock_init(LocationMock *self)
        priv->loc_timeout = 0;
 
        priv->app_type = location_get_app_type(NULL);
-       if (priv->app_type == 0) {
-               LOCATION_LOGW("Fail to get app_type");
-       }
+       LOC_COND_LOG(priv->app_type == 0, _E, "Fail to get app_type");
 }
 
 static void
 location_mock_class_init(LocationMockClass *klass)
 {
-       LOCATION_LOGD("location_mock_class_init");
+       LOC_FUNC_LOG
 
        GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
index 4c534c0..b53d0a6 100644 (file)
@@ -48,11 +48,7 @@ location_position_get_type(void)
 }
 
 EXPORT_API LocationPosition *
-location_position_new(guint timestamp,
-                                       gdouble latitude,
-                                       gdouble longitude,
-                                       gdouble altitude,
-                                       LocationStatus status)
+location_position_new(guint timestamp, gdouble latitude, gdouble longitude, gdouble altitude, LocationStatus status)
 {
        if (latitude < -90 || latitude > 90) return NULL;
        if (longitude < -180 || longitude > 180) return NULL;
@@ -95,11 +91,7 @@ location_position_copy(const LocationPosition *position)
 
        LocationPosition *new_position = NULL;
 
-       new_position = location_position_new(position->timestamp,
-                                                                               position->latitude,
-                                                                               position->longitude,
-                                                                               position->altitude,
-                                                                               position->status);
+       new_position = location_position_new(position->timestamp, position->latitude, position->longitude, position->altitude, position->status);
 
        return new_position;
 
@@ -195,10 +187,9 @@ location_last_position_a2i(char *position, int *lat, int *lon)
        *lat = atoi(latitude);
        *lon = atoi(longitude);
 
-       if (*d_lat == 'S') {
+       if (*d_lat == 'S')
                *lat = *lat * -1;
-       }
-       if (*d_lon == 'W') {
+
+       if (*d_lon == 'W')
                *lon = *lon * -1;
-       }
 }
index d0a3fa9..ceccfdd 100644 (file)
@@ -43,8 +43,7 @@ int location_check_cynara(const char *privilege_name)
        char *session = NULL;
        char smack_label[100] = {0, };
 
-       if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS)
-       {
+       if (cynara_initialize(&cynara, NULL) != CYNARA_API_SUCCESS) {
                LOCATION_LOGE("cynara initialize failed");
                cynara = NULL;
                return LOCATION_ERROR_NOT_ALLOWED;
@@ -66,18 +65,13 @@ int location_check_cynara(const char *privilege_name)
        snprintf(uid, 16, "%d", getuid());
        ret = cynara_check(cynara, smack_label, session, uid, privilege_name);
 
-       if (session) {
+       if (session)
                free(session);
-       }
 
-       if (cynara) {
+       if (cynara)
                cynara_finish(cynara);
-       }
 
-       if (ret != CYNARA_API_ACCESS_ALLOWED) {
-               LOCATION_LOGE("cynara_check failed [%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_COND_RET(ret != CYNARA_API_ACCESS_ALLOWED, LOCATION_ERROR_NOT_ALLOWED, _E, "Cynara_check failed [%s]", err_msg(LOCATION_ERROR_NOT_ALLOWED));
 
        return LOCATION_ERROR_NONE;
 }
index 6dafa38..427314b 100755 (executable)
@@ -31,10 +31,8 @@ location_satellite_get_type(void)
 {
        static volatile gsize type_volatile = 0;
        if (g_once_init_enter(&type_volatile)) {
-               GType type = g_boxed_type_register_static(
-                                                g_intern_static_string("LocationSatellite"),
-                                                (GBoxedCopyFunc) location_satellite_copy,
-                                                (GBoxedFreeFunc) location_satellite_free);
+               GType type = g_boxed_type_register_static(g_intern_static_string("LocationSatellite"),
+                                               (GBoxedCopyFunc) location_satellite_copy, (GBoxedFreeFunc) location_satellite_free);
                g_once_init_leave(&type_volatile, type);
        }
        return type_volatile;
@@ -48,7 +46,7 @@ update_num_of_used(LocationSatellite *satellite)
        if (satellite->num_of_sat_inview > 0 && satellite->sat_inview) {
                int i = 0;
                for (i = 0 ; i < satellite->num_of_sat_inview ; i++)
-                       if (satellite->sat_inview[i].used)(satellite->num_of_sat_used)++;
+                       if (satellite->sat_inview[i].used) (satellite->num_of_sat_used)++;
        }
 }
 
@@ -92,12 +90,7 @@ location_satellite_copy(const LocationSatellite *satellite)
 
 EXPORT_API gboolean
 location_satellite_get_satellite_details(const LocationSatellite *satellite,
-                                                                               guint index,
-                                                                               guint *prn,
-                                                                               gboolean *used,
-                                                                               guint *elevation,
-                                                                               guint *azimuth,
-                                                                               gint *snr)
+                                                                               guint index, guint *prn, gboolean *used, guint *elevation, guint *azimuth, gint *snr)
 {
        g_return_val_if_fail(satellite, FALSE);
        g_return_val_if_fail(prn, FALSE);
@@ -119,12 +112,7 @@ location_satellite_get_satellite_details(const LocationSatellite *satellite,
 
 EXPORT_API gboolean
 location_satellite_set_satellite_details(LocationSatellite *satellite,
-                                                                               guint index,
-                                                                               guint prn,
-                                                                               gboolean used,
-                                                                               guint elevation,
-                                                                               guint azimuth,
-                                                                               gint snr)
+                                                                               guint index, guint prn, gboolean used, guint elevation, guint azimuth, gint snr)
 {
        g_return_val_if_fail(satellite, FALSE);
        g_return_val_if_fail(satellite->sat_inview, FALSE);
index 39bce6b..0b9ab32 100644 (file)
@@ -52,9 +52,9 @@ gint location_setting_get_int(const gchar *path)
 {
        g_return_val_if_fail(path, 0);
        int val = 0;
-       if (vconf_get_int(path, &val)) {
+       if (vconf_get_int(path, &val))
                LOCATION_SECLOG("failed [%s]", path);
-       }
+
        return val;
 }
 
@@ -62,9 +62,9 @@ gboolean location_setting_get_bool(const gchar *path)
 {
        g_return_val_if_fail(path, FALSE);
        gboolean val = FALSE;
-       if (vconf_get_bool(path, &val)) {
+       if (vconf_get_bool(path, &val))
                LOCATION_SECLOG("failed [%s]", path);
-       }
+
        return val;
 }
 
@@ -77,13 +77,12 @@ gchar *location_setting_get_string(const gchar *path)
 static char *__convert_event_from_vconf(const char *vconf)
 {
        char *event = NULL;
-       if (g_strcmp0(vconf, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+       if (g_strcmp0(vconf, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0)
                event = g_strdup(SYS_EVENT_LOCATION_ENABLE_STATE);
-       } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_ENABLED) == 0) {
+       else if (g_strcmp0(vconf, VCONFKEY_LOCATION_ENABLED) == 0)
                event = g_strdup(SYS_EVENT_GPS_ENABLE_STATE);
-       } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+       else if (g_strcmp0(vconf, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0)
                event = g_strdup(SYS_EVENT_NPS_ENABLE_STATE);
-       }
 
        return event;
 }
@@ -92,13 +91,12 @@ static void __event_handler(const char *event_name, bundle *data, void *self)
 {
        const char *value = NULL;
 
-       if (g_strcmp0(event_name, SYS_EVENT_LOCATION_ENABLE_STATE) == 0) {
+       if (g_strcmp0(event_name, SYS_EVENT_LOCATION_ENABLE_STATE) == 0)
                value = bundle_get_val(data, EVT_KEY_LOCATION_ENABLE_STATE);
-       } else if (g_strcmp0(event_name, SYS_EVENT_GPS_ENABLE_STATE) == 0) {
+       else if (g_strcmp0(event_name, SYS_EVENT_GPS_ENABLE_STATE) == 0)
                value = bundle_get_val(data, EVT_KEY_GPS_ENABLE_STATE);
-       } else if (g_strcmp0(event_name, SYS_EVENT_NPS_ENABLE_STATE) == 0) {
+       else if (g_strcmp0(event_name, SYS_EVENT_NPS_ENABLE_STATE) == 0)
                value = bundle_get_val(data, EVT_KEY_NPS_ENABLE_STATE);
-       }
 
        LOCATION_SECLOG("[%s: %s]", event_name, value);
 }
index 9d0da24..ed166d1 100644 (file)
@@ -61,11 +61,11 @@ gint location_state_ignore_notify(const gchar *path, SettingCB setting_cb);
 
 #define setting_retval_if_fail(path) {\
                int val = location_setting_get_int(path);\
-               if (val == -1){\
+               if (val == -1) {\
                        return LOCATION_ERROR_UNKNOWN;\
                } else if (val == 0) {\
                        return LOCATION_ERROR_SETTING_OFF;\
-               }\
+               } \
        }
 
 /* For test
index 1057bbf..a623e22 100755 (executable)
@@ -105,9 +105,8 @@ position_velocity_signaling(LocationObject *obj,
                }
        }
 
-       if (signal_type != 0) {
+       if (signal_type != 0)
                g_signal_emit(obj, signals[SERVICE_UPDATED], 0, signal_type, pos, vel, acc);
-       }
 
        if (boundary_list) {
                while ((priv = (LocationBoundaryPrivate *)g_list_nth_data(boundary_list, index)) != NULL) {
index 08e6537..a9c83ea 100644 (file)
@@ -31,10 +31,9 @@ location_velocity_get_type(void)
 {
        static volatile gsize type_volatile = 0;
        if (g_once_init_enter(&type_volatile)) {
-               GType type = g_boxed_type_register_static(
-                                               g_intern_static_string("LocationVelocity"),
-                                               (GBoxedCopyFunc) location_velocity_copy,
-                                               (GBoxedFreeFunc) location_velocity_free);
+               GType type = g_boxed_type_register_static(g_intern_static_string("LocationVelocity"),
+                                               (GBoxedCopyFunc) location_velocity_copy, (GBoxedFreeFunc) location_velocity_free);
+
                g_once_init_leave(&type_volatile, type);
        }
        return type_volatile;
@@ -78,9 +77,7 @@ EXPORT_API LocationVelocity *
 location_velocity_copy(const LocationVelocity *velocity)
 {
        g_return_val_if_fail(velocity, NULL);
-
        LocationVelocity *new_velocity = NULL;
-
        new_velocity = location_velocity_new(velocity->timestamp, velocity->speed, velocity->direction, velocity->climb);
 
        return new_velocity;
index ad6af3b..bc6d086 100755 (executable)
@@ -93,7 +93,7 @@ G_DEFINE_TYPE_WITH_CODE(LocationWps, location_wps, G_TYPE_OBJECT,
 static void
 __reset_pos_data_from_priv(LocationWpsPrivate *priv)
 {
-       LOCATION_LOGD("__reset_pos_data_from_priv");
+       LOC_FUNC_LOG
        g_return_if_fail(priv);
 
        if (priv->pos) {
@@ -196,7 +196,7 @@ wps_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel,
 static void
 location_setting_wps_cb(keynode_t *key, gpointer self)
 {
-       LOCATION_LOGD("location_setting_wps_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(key);
        g_return_if_fail(self);
        LocationWpsPrivate *priv = GET_PRIVATE(self);
@@ -210,9 +210,8 @@ location_setting_wps_cb(keynode_t *key, gpointer self)
                if (priv->mod->ops.stop && __get_started(self)) {
                        __set_started(self, FALSE);
                        ret = priv->mod->ops.stop(priv->mod->handler);
-                       if (ret == LOCATION_ERROR_NONE) {
+                       if (ret == LOCATION_ERROR_NONE)
                                __reset_pos_data_from_priv(priv);
-                       }
                }
        } else {
                if (1 == location_setting_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED) && priv->mod->ops.start && !__get_started(self)) {
@@ -231,7 +230,7 @@ location_setting_wps_cb(keynode_t *key, gpointer self)
 static int
 location_wps_start(LocationWps *self)
 {
-       LOCATION_LOGD("location_wps_start");
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -265,7 +264,7 @@ location_wps_start(LocationWps *self)
 static int
 location_wps_stop(LocationWps *self)
 {
-       LOCATION_LOGD("location_wps_stop");
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -277,9 +276,7 @@ location_wps_stop(LocationWps *self)
        if (__get_started(self) == TRUE) {
                __set_started(self, FALSE);
                ret = priv->mod->ops.stop(priv->mod->handler);
-               if (ret != LOCATION_ERROR_NONE) {
-                       LOCATION_LOGD("Failed to stop. Error[%d]", ret);
-               }
+               LOC_IF_FAIL_LOG(ret, _E, "Failed to stop [%s]", err_msg(ret));
        }
 
        if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
@@ -295,8 +292,7 @@ location_wps_stop(LocationWps *self)
 static void
 location_wps_dispose(GObject *gobject)
 {
-       LOCATION_LOGD("location_wps_dispose");
-
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
 
@@ -313,7 +309,7 @@ location_wps_dispose(GObject *gobject)
 static void
 location_wps_finalize(GObject *gobject)
 {
-       LOCATION_LOGD("location_wps_finalize");
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(gobject);
        g_return_if_fail(priv);
        module_free(priv->mod, "wps");
@@ -351,14 +347,14 @@ location_wps_set_property(GObject *object, guint property_id, const GValue *valu
        case PROP_BOUNDARY: {
                                GList *boundary_list = (GList *)g_list_copy(g_value_get_pointer(value));
                                ret = set_prop_boundary(&priv->boundary_list, boundary_list);
-                               if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Set boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Set boundary [%s]", err_msg(ret));
                                if (boundary_list) g_list_free(boundary_list);
                                break;
                        }
        case PROP_REMOVAL_BOUNDARY: {
                                LocationBoundary *req_boundary = (LocationBoundary *) g_value_dup_boxed(value);
                                ret = set_prop_removal_boundary(&priv->boundary_list, req_boundary);
-                               if (ret != 0) LOCATION_LOGD("Set removal boundary. Error[%d]", ret);
+                               LOC_IF_FAIL_LOG(ret, _E, "Set removal boundary [%s]", err_msg(ret));
                                break;
                        }
        case PROP_POS_INTERVAL: {
@@ -514,10 +510,7 @@ location_wps_get_position_ext(LocationWps *self, LocationPosition **position, Lo
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->pos && priv->vel) {
                *position = location_position_copy(priv->pos);
@@ -572,16 +565,12 @@ static int
 location_wps_get_velocity(LocationWps *self, LocationVelocity **velocity, LocationAccuracy **accuracy)
 {
        int ret = LOCATION_ERROR_NOT_AVAILABLE;
-
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_NETWORK_ENABLED);
 
-       if (__get_started(self) != TRUE) {
-               LOCATION_LOGE("location is not started");
-               return LOCATION_ERROR_NOT_AVAILABLE;
-       }
+       LOC_COND_RET(__get_started(self) != TRUE, LOCATION_ERROR_NOT_AVAILABLE, _E, "location is not started [%s]", err_msg(LOCATION_ERROR_NOT_AVAILABLE));
 
        if (priv->vel) {
                *velocity = location_velocity_copy(priv->vel);
@@ -614,7 +603,7 @@ location_wps_get_last_velocity(LocationWps *self, LocationVelocity **velocity, L
 
 static gboolean __single_location_timeout_cb(void *data)
 {
-       LOCATION_LOGD("__single_location_timeout_cb");
+       LOC_FUNC_LOG
        LocationWps *self = (LocationWps *)data;
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, FALSE);
@@ -636,7 +625,7 @@ static gboolean __single_location_timeout_cb(void *data)
 static void
 wps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity *vel, LocationAccuracy *acc, gpointer self)
 {
-       LOCATION_LOGD("wps_single_location_cb");
+       LOC_FUNC_LOG
        g_return_if_fail(self);
        g_return_if_fail(pos);
        g_return_if_fail(vel);
@@ -656,7 +645,7 @@ wps_single_location_cb(gboolean enabled, LocationPosition *pos, LocationVelocity
 static int
 location_wps_request_single_location(LocationWps *self, int timeout)
 {
-       LOCATION_LOGD("location_wps_request_single_location");
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -674,9 +663,9 @@ location_wps_request_single_location(LocationWps *self, int timeout)
                __set_started(self, FALSE);
                return ret;
        } else {
-               if (priv->loc_timeout != 0) {
+               if (priv->loc_timeout != 0)
                        g_source_remove(priv->loc_timeout);
-               }
+
                priv->loc_timeout = g_timeout_add_seconds(timeout, __single_location_timeout_cb, self);
        }
 
@@ -733,7 +722,7 @@ location_ielement_interface_init(LocationIElementInterface *iface)
 static void
 location_wps_init(LocationWps *self)
 {
-       LOCATION_LOGD("location_wps_init");
+       LOC_FUNC_LOG
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
@@ -762,15 +751,14 @@ location_wps_init(LocationWps *self)
        priv->loc_timeout = 0;
 
        priv->app_type = location_get_app_type(NULL);
-       if (priv->app_type == 0) {
+       if (priv->app_type == 0)
                LOCATION_LOGW("Fail to get app_type");
-       }
 }
 
 static void
 location_wps_class_init(LocationWpsClass *klass)
 {
-       LOCATION_LOGD("location_wps_class_init");
+       LOC_FUNC_LOG
        GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
        gobject_class->set_property = location_wps_set_property;
index eff9ca5..b5ee57c 100755 (executable)
@@ -79,24 +79,23 @@ static char *__convert_setting_key(LocationMethod method)
 static LocationMethod __convert_method_from_key(const char *key)
 {
        LocationMethod _method = LOCATION_METHOD_NONE;
-       if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+       if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0)
                _method = LOCATION_METHOD_HYBRID;
-       } else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0) {
+       else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0)
                _method = LOCATION_METHOD_GPS;
-       } else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+       else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0)
                _method = LOCATION_METHOD_WPS;
-       } else if (g_strcmp0(key, VCONFKEY_LOCATION_MOCK_ENABLED) == 0) {
+       else if (g_strcmp0(key, VCONFKEY_LOCATION_MOCK_ENABLED) == 0)
                _method = LOCATION_METHOD_MOCK;
-       }
 
        return _method;
 }
 
 static void __location_setting_cb(keynode_t *key, gpointer data)
 {
-       if (key == NULL || data == NULL) {
+       if (key == NULL || data == NULL)
                return;
-       }
+
        LocationSetting *_setting = (LocationSetting *)data;
        LocationMethod _method = LOCATION_METHOD_NONE;
 
@@ -144,7 +143,7 @@ location_new(LocationMethod method)
                break;
        }
 
-       if (!self) LOCATION_LOGE("Fail to create location object. Method [%d]", method);
+       LOC_COND_LOG(!self, _E, "Fail to create location object. [method=%d]", method);
        return self;
 }
 
@@ -163,7 +162,7 @@ location_request_single_location(LocationObject *obj, int timeout)
 
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_request_single_location(LOCATION_IELEMENT(obj), timeout);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to request single location. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to request single location [%s]", err_msg(ret));
 
        return ret;
 }
@@ -176,14 +175,11 @@ location_start(LocationObject *obj)
        int ret = LOCATION_ERROR_NONE;
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_start(LOCATION_IELEMENT(obj));
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to start. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to start [%s]", err_msg(ret));
 
        return ret;
 }
@@ -192,10 +188,10 @@ EXPORT_API int
 location_stop(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
-       int ret = LOCATION_ERROR_NONE;
 
+       int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_stop(LOCATION_IELEMENT(obj));
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to stop. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to stop [%s]", err_msg(ret));
 
        return ret;
 }
@@ -208,14 +204,11 @@ location_start_batch(LocationObject *obj)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_start_batch(LOCATION_IELEMENT(obj));
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch start. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to start_batch [%s]", err_msg(ret));
 
        return ret;
 }
@@ -226,7 +219,7 @@ location_stop_batch(LocationObject *obj)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_stop_batch(LOCATION_IELEMENT(obj));
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch stop. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to stop_batch [%d]", err_msg(ret));
 
        return ret;
 }
@@ -265,14 +258,11 @@ location_is_enabled_method(LocationMethod method, int *is_enabled)
        int vconf_ret = VCONF_ERROR;
 
        char *_key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
 
        vconf_ret = vconf_get_int(_key, &vconf_val);
        if (vconf_ret != VCONF_OK) {
-               LOCATION_SECLOG("failed [%s], error [%d]", _key, vconf_ret);
+               LOCATION_SECLOG("vconf_get failed [%s], error [%d]", _key, vconf_ret);
                g_free(_key);
                return LOCATION_ERROR_NOT_AVAILABLE;
        } else {
@@ -293,18 +283,13 @@ location_enable_method(const LocationMethod method, const int enable)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_ENABLE_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        /* for itself */
        _key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
+
        ret = vconf_set_int(_key, enable);
        if (ret != VCONF_OK) {
                LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
@@ -315,10 +300,7 @@ location_enable_method(const LocationMethod method, const int enable)
 
        /* for hybrid */
        _key = __convert_setting_key(LOCATION_METHOD_HYBRID);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", LOCATION_METHOD_HYBRID);
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", LOCATION_METHOD_HYBRID, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
 
        if (enable) {
                ret = vconf_set_int(_key, enable);
@@ -358,10 +340,7 @@ location_add_setting_notify(LocationMethod method, LocationSettingCb callback, v
 {
        int ret = LOCATION_ERROR_NONE;
        char *_key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_PARAMETER;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_PARAMETER, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_PARAMETER));
 
        g_location_setting.callback = callback;
        g_location_setting.user_data = user_data;
@@ -377,10 +356,7 @@ location_ignore_setting_notify(LocationMethod method, LocationSettingCb callback
 {
        int ret = LOCATION_ERROR_NONE;
        char *_key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_PARAMETER;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_PARAMETER, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_PARAMETER));
 
        g_location_setting.callback = NULL;
        g_location_setting.user_data = NULL;
@@ -403,14 +379,11 @@ location_get_position(LocationObject *obj, LocationPosition **position, Location
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_position(LOCATION_IELEMENT(obj), position, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
+       LOC_COND_RET(ret != LOCATION_ERROR_NONE, ret, _E, "Fail to get_position [%s]", err_msg(ret));
 
        return ret;
 }
@@ -427,14 +400,11 @@ location_get_position_ext(LocationObject *obj, LocationPosition **position, Loca
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position_ext. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_position_ext [%s]", err_msg(ret));
 
        return ret;
 }
@@ -450,14 +420,11 @@ location_get_last_position(LocationObject *obj, LocationPosition **position, Loc
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_last_position(LOCATION_IELEMENT(obj), position, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_last_position [%s]", err_msg(ret));
 
        return ret;
 }
@@ -474,14 +441,11 @@ location_get_last_position_ext(LocationObject *obj, LocationPosition **position,
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_last_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position_ext. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_last_position_ext [%s]", err_msg(ret));
 
        return ret;
 }
@@ -494,9 +458,7 @@ location_get_nmea(LocationObject *obj, char **nmea)
 
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to get_nmea [%s]", err_msg(ret));
 
        return ret;
 }
@@ -512,16 +474,11 @@ location_get_satellite(LocationObject *obj, LocationSatellite **satellite)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_satellite(LOCATION_IELEMENT(obj), satellite);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
-       }
+       LOC_IF_FAIL(ret, _E, "Fail to get_satellite [%s]", err_msg(ret));
 
        return ret;
 }
@@ -536,14 +493,11 @@ location_get_batch(LocationObject *obj, LocationBatch **batch)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_batch(LOCATION_IELEMENT(obj), batch);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_batch. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_batch [%s]", err_msg(ret));
 
        return ret;
 }
@@ -558,14 +512,11 @@ location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_last_satellite(LOCATION_IELEMENT(obj), satellite);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_satellite. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_last_satellite [%s]", err_msg(ret));
 
        return ret;
 }
@@ -581,14 +532,11 @@ location_get_velocity(LocationObject *obj, LocationVelocity **velocity, Location
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_velocity [%s]", err_msg(ret));
 
        return ret;
 }
@@ -604,14 +552,11 @@ location_get_last_velocity(LocationObject *obj, LocationVelocity **velocity, Loc
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_get_last_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_velocity. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_last_velocity [%s]", err_msg(ret));
 
        return ret;
 }
@@ -676,15 +621,11 @@ location_set_option(LocationObject *obj, const char *option)
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
        ret = location_ielement_set_option(LOCATION_IELEMENT(obj), option);
-       if (ret != LOCATION_ERROR_NONE)
-               LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_velocity [%s]", err_msg(ret));
        return ret;
 }
 
@@ -701,7 +642,7 @@ location_get_service_state(LocationObject *obj, int *state)
 
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_get_status(LOCATION_IELEMENT(obj), state);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to get_position [%s]", err_msg(ret));
 
        return ret;
 }
@@ -713,33 +654,23 @@ location_enable_mock(const LocationMethod method, const int enable)
        int ret = 0;
        char *_key = NULL;
 
-       if (method != LOCATION_METHOD_MOCK) {
-               return LOCATION_ERROR_PARAMETER;
-       }
+       LOC_COND_RET(method != LOCATION_METHOD_MOCK, LOCATION_ERROR_PARAMETER, _E, "Method is not mock [%s]", err_msg(LOCATION_ERROR_PARAMETER));
 
 #ifndef TIZEN_PROFILE_TV
        ret = location_check_cynara(LOCATION_PRIVILEGE);
-       if (ret != LOCATION_ERROR_NONE) {
-               LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_IF_FAIL(ret, _E, "Privilege not allowed [%s]", err_msg(ret));
 #endif
 
 #if 0 /* Tizen platform didn't turn developer option on */
        gboolean developer_option = FALSE;
 
        ret = vconf_get_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, &developer_option);
-       if (!developer_option) {
-               LOCATION_LOGE("Cannot enable mock location because developer option is not turned on", ret);
-               return LOCATION_ERROR_NOT_ALLOWED;
-       }
+       LOC_COND_RET(!developer_option, LOCATION_ERROR_NOT_ALLOWED, _E, "Cannot enable mock location because developer option is not turned on", ret);
 #endif
 
        _key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
+
        ret = vconf_set_int(_key, enable);
        if (ret != VCONF_OK) {
                LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
@@ -777,10 +708,7 @@ location_set_mock_method_enabled(const LocationMethod method, const int enable)
        int vconf_val = 0;
 
        _key = __convert_setting_key(method);
-       if (!_key) {
-               LOCATION_LOGE("Invalid method[%d]", method);
-               return LOCATION_ERROR_NOT_SUPPORTED;
-       }
+       LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method = %d [%s]", method, err_msg(LOCATION_ERROR_NOT_SUPPORTED));
 
        ret = vconf_get_int(_key, &vconf_val);
        if (ret != VCONF_OK) {
@@ -791,10 +719,7 @@ location_set_mock_method_enabled(const LocationMethod method, const int enable)
 
        if (vconf_val) {
                _key = __convert_mock_setting_key(method);
-               if (!_key) {
-                       LOCATION_LOGE("Invalid method[%d]", method);
-                       return LOCATION_ERROR_NOT_SUPPORTED;
-               }
+               LOC_COND_RET(!_key, LOCATION_ERROR_NOT_SUPPORTED, _E, "Invalid method[%d]", method);
                ret = vconf_set_int(_key, enable);
                if (ret != VCONF_OK) {
                        LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
@@ -819,7 +744,7 @@ location_set_mock_location(LocationObject *obj, const LocationPosition *position
 
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_set_mock_location(LOCATION_IELEMENT(obj), position, velocity, accuracy);
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to set_mock_location [%s]", err_msg(ret));
 
        return ret;
 }
@@ -831,7 +756,7 @@ location_clear_mock_location(LocationObject *obj)
 
        int ret = LOCATION_ERROR_NONE;
        ret = location_ielement_clear_mock_location(LOCATION_IELEMENT(obj));
-       if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to location_ielement_set_mock_location. Error [%d]", ret);
+       LOC_IF_FAIL(ret, _E, "Fail to clear_mock_location [%s]", err_msg(ret));
 
        return ret;
-}
\ No newline at end of file
+}
index ad5a0c5..5e70447 100755 (executable)
@@ -173,9 +173,9 @@ static void mod_free(gpointer mod, const char *module_name)
 
        if (0 == g_strcmp0(module_name, "gps")) {
                LocationGpsMod *_mod = (LocationGpsMod *) mod;
-               if (_mod->shutdown && _mod->handler) {
+               if (_mod->shutdown && _mod->handler)
                        _mod->shutdown(_mod->handler);
-               }
+
                _mod->handler = NULL;
                _mod->init = NULL;
                _mod->shutdown = NULL;
@@ -183,9 +183,9 @@ static void mod_free(gpointer mod, const char *module_name)
                _mod->gmod = NULL;
        } else if (0 == g_strcmp0(module_name, "wps")) {
                LocationWpsMod *_mod = (LocationWpsMod *) mod;
-               if (_mod->shutdown && _mod->handler) {
+               if (_mod->shutdown && _mod->handler)
                        _mod->shutdown(_mod->handler);
-               }
+
                _mod->handler = NULL;
                _mod->init = NULL;
                _mod->shutdown = NULL;
@@ -193,9 +193,9 @@ static void mod_free(gpointer mod, const char *module_name)
                _mod->gmod = NULL;
        } else if (0 == g_strcmp0(module_name, "mock")) {
                LocationMockMod *_mod = (LocationMockMod *) mod;
-               if (_mod->shutdown && _mod->handler) {
+               if (_mod->shutdown && _mod->handler)
                        _mod->shutdown(_mod->handler);
-               }
+
                _mod->handler = NULL;
                _mod->init = NULL;
                _mod->shutdown = NULL;
@@ -212,9 +212,9 @@ static gboolean mod_is_supported(const char *module_name)
 {
        GMod *gmod = NULL;
        gmod = gmod_new(module_name, FALSE);
-       if (!gmod) {
+       if (!gmod)
                return FALSE;
-       }
+
        gmod_free(gmod);
 
        return TRUE;
@@ -290,11 +290,10 @@ gboolean module_is_supported(const char *module_name)
        char name[256] = { 0, };
 
        for (index = -1; index < MAX_MODULE_INDEX; index++) {
-               if (index >= 0) {
+               if (index >= 0)
                        g_snprintf(name, 256, "%s%d", module_name, index);
-               } else {
+               else
                        g_snprintf(name, 256, "%s", module_name);
-               }
 
                ret = mod_is_supported(name);
                if (ret == TRUE) {
index f569d94..ba3b2ed 100644 (file)
@@ -1,3 +1,10 @@
+[Version]      libslp-location_1.2.1
+[Date]         9 May 2016
+[Changes]      Change tag style for error log
+[Developer]    Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
+
 [Version]      libslp-location_1.2.0
 [Date]         15 Apr 2016
 [Changes]      Support HW batch mode when sensor API is available
index 08f1467..a17aee4 100755 (executable)
@@ -1,6 +1,6 @@
 Name: liblbs-location
 Summary: Location Based Service Library
-Version: 1.2.0
+Version: 1.2.1
 Release: 1
 Group: Location/Libraries
 License: Apache-2.0