Apply tizen coding rules
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 9 Dec 2015 05:41:43 +0000 (14:41 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 9 Dec 2015 07:13:38 +0000 (16:13 +0900)
Change-Id: I74f9810ca19cadb25122d8c12d1ea2715c5bdfcf
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
src/i18n.c
src/service.c

index a1ca9e3..babfa99 100644 (file)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
index 927b16c..e7b5b23 100644 (file)
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an AS IS BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 
@@ -75,8 +75,7 @@ static int service_create_reply(bundle *data, struct service_s **service);
 
 static const char* service_error_to_string(service_error_e error)
 {
-       switch (error)
-       {
+       switch (error) {
        case SERVICE_ERROR_NONE:
                return "NONE";
 
@@ -101,7 +100,7 @@ static const char* service_error_to_string(service_error_e error)
        case SERVICE_ERROR_LAUNCH_REJECTED:
                return "LAUNCH_REJECTED";
 
-       default :
+       default:
                return "UNKNOWN";
        }
 }
@@ -109,13 +108,9 @@ static const char* service_error_to_string(service_error_e error)
 int service_error(service_error_e error, const char* function, const char *description)
 {
        if (description)
-       {
-               LOGE("[%s] %s(0x%08x) : %s", function, service_error_to_string(error), error, description);     
-       }
+               LOGE("[%s] %s(0x%08x) : %s", function, service_error_to_string(error), error, description);
        else
-       {
-               LOGE("[%s] %s(0x%08x)", function, service_error_to_string(error), error);       
-       }
+               LOGE("[%s] %s(0x%08x)", function, service_error_to_string(error), error);
 
        return error;
 }
@@ -123,9 +118,7 @@ int service_error(service_error_e error, const char* function, const char *descr
 static int service_validate_extra_data(const char *data)
 {
        if (data == NULL || data[0] == '\0')
-       {
                return SERVICE_ERROR_INVALID_PARAMETER;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -133,9 +126,7 @@ static int service_validate_extra_data(const char *data)
 static int service_valiate_service(service_h service)
 {
        if (service == NULL || service->data == NULL)
-       {
                return SERVICE_ERROR_INVALID_PARAMETER;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -149,14 +140,10 @@ static int service_new_id()
 int service_validate_internal_key(const char *key)
 {
        if (strncmp(BUNDLE_KEY_PREFIX_AUL, key, strlen(BUNDLE_KEY_PREFIX_AUL)) == 0)
-       {
                return -1;
-       }
 
        if (strncmp(BUNDLE_KEY_PREFIX_SERVICE, key, strlen(BUNDLE_KEY_PREFIX_SERVICE)) == 0)
-       {
                return -1;
-       }
 
        return 0;
 }
@@ -168,25 +155,22 @@ static void service_request_result_broker(bundle *appsvc_bundle, int appsvc_requ
        service_h reply = NULL;
        service_result_e result;
        void *user_data;
-       service_reply_cb reply_cb;      
+       service_reply_cb reply_cb;
 
-       if (appsvc_data == NULL)
-       {
+       if (appsvc_data == NULL) {
                service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service reply");
                return;
        }
 
-       if (service_create_reply(appsvc_bundle, &reply) != 0)
-       {
+       if (service_create_reply(appsvc_bundle, &reply) != 0) {
                service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create service reply");
-               return;         
+               return;
        }
 
        request_context = appsvc_data;
        request = request_context->service;
 
-       switch (appsvc_result)
-       {
+       switch (appsvc_result) {
        case APPSVC_RES_OK:
                result = SERVICE_RESULT_SUCCEEDED;
                break;
@@ -208,20 +192,14 @@ static void service_request_result_broker(bundle *appsvc_bundle, int appsvc_requ
        reply_cb = request_context->reply_cb;
 
        if (reply_cb != NULL)
-       {
                reply_cb(request, reply, result, user_data);
-       }
        else
-       {
                service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
-       }
 
        service_destroy(reply);
 
        if (request_context->service != NULL)
-       {
                service_destroy(request_context->service);
-       }
 
        free(request_context);
 }
@@ -237,30 +215,21 @@ int service_create_request(bundle *data, service_h *service)
        struct service_s *service_request;
 
        if (service == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        service_request = malloc(sizeof(struct service_s));
 
        if (service_request == NULL)
-       {
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
-       }
 
        service_request->type = SERVICE_TYPE_REQUEST;
 
        if (data != NULL)
-       {
                service_request->data = bundle_dup(data);
-       }
        else
-       {
                service_request->data = bundle_create();
-       }
 
-       if (service_request->data == NULL)
-       {
+       if (service_request->data == NULL) {
                free(service_request);
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a bundle");
        }
@@ -280,16 +249,12 @@ int service_create_event(bundle *data, struct service_s **service)
        const char *operation;
 
        if (data == NULL || service == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        service_event = malloc(sizeof(struct service_s));
 
        if (service_event == NULL)
-       {
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
-       }       
 
        service_event->type = SERVICE_TYPE_EVENT;
        service_event->data = bundle_dup(data);
@@ -298,9 +263,7 @@ int service_create_event(bundle *data, struct service_s **service)
        operation = appsvc_get_operation(service_event->data);
 
        if (operation == NULL)
-       {
                appsvc_set_operation(service_event->data, SERVICE_OPERATION_DEFAULT);
-       }
 
        *service = service_event;
 
@@ -312,16 +275,12 @@ static int service_create_reply(bundle *data, struct service_s **service)
        struct service_s *service_reply;
 
        if (data == NULL || service == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        service_reply = malloc(sizeof(struct service_s));
 
        if (service_reply == NULL)
-       {
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
-       }       
 
        service_reply->type = SERVICE_TYPE_REPLY;
        service_reply->data = bundle_dup(data);
@@ -335,9 +294,7 @@ static int service_create_reply(bundle *data, struct service_s **service)
 int service_destroy(service_h service)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        bundle_free(service->data);
        service->data = NULL;
@@ -349,9 +306,7 @@ int service_destroy(service_h service)
 int service_to_bundle(service_h service, bundle **data)
 {
        if (service_valiate_service(service) || data == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        *data = service->data;
 
@@ -361,19 +316,12 @@ int service_to_bundle(service_h service, bundle **data)
 int service_set_operation(service_h service, const char *operation)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (operation != NULL)
-       {
+       if (operation != NULL) {
                if (appsvc_set_operation(service->data, operation) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid operation");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_OPERATION);
        }
 
@@ -385,20 +333,14 @@ int service_get_operation(service_h service, char **operation)
        const char *operation_value;
 
        if (service_valiate_service(service) || operation == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        operation_value = appsvc_get_operation(service->data);
 
        if (operation_value != NULL)
-       {
                *operation = strdup(operation_value);
-       }
        else
-       {
                *operation = NULL;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -407,22 +349,15 @@ int service_get_operation(service_h service, char **operation)
 int service_set_uri(service_h service, const char *uri)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (uri != NULL)
-       {
+       if (uri != NULL) {
                if (appsvc_set_uri(service->data, uri) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid URI");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_URI);
        }
-       
+
        return SERVICE_ERROR_NONE;
 }
 
@@ -432,20 +367,14 @@ int service_get_uri(service_h service, char **uri)
        const char *uri_value;
 
        if (service_valiate_service(service) || uri == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        uri_value = appsvc_get_uri(service->data);
 
        if (uri_value != NULL)
-       {
                *uri = strdup(uri_value);
-       }
        else
-       {
                *uri = NULL;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -454,19 +383,12 @@ int service_get_uri(service_h service, char **uri)
 int service_set_mime(service_h service, const char *mime)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (mime != NULL)
-       {
+       if (mime != NULL) {
                if (appsvc_set_mime(service->data, mime) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_MIME);
        }
 
@@ -479,20 +401,14 @@ int service_get_mime(service_h service, char **mime)
        const char *mime_value;
 
        if (service_valiate_service(service) || mime == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        mime_value = appsvc_get_mime(service->data);
 
        if (mime_value != NULL)
-       {
                *mime = strdup(mime_value);
-       }
        else
-       {
                *mime = NULL;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -501,19 +417,12 @@ int service_get_mime(service_h service, char **mime)
 int service_set_category(service_h service, const char *category)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (category != NULL)
-       {
+       if (category != NULL) {
                if (appsvc_set_category(service->data, category) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_MIME);
        }
 
@@ -526,20 +435,14 @@ int service_get_category(service_h service, char **category)
        const char *category_value;
 
        if (service_valiate_service(service) || category == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        category_value = appsvc_get_category(service->data);
 
        if (category_value != NULL)
-       {
                *category = strdup(category_value);
-       }
        else
-       {
                *category = NULL;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -547,13 +450,17 @@ int service_get_category(service_h service, char **category)
 
 int service_set_package(service_h service, const char *package)
 {
-       // TODO: this function must be deprecated
+       /*
+        * TODO: this function must be deprecated
+        */
        return service_set_app_id(service, package);
 }
 
 int service_get_package(service_h service, char **package)
 {
-       // TODO: this function must be deprecated
+       /*
+        * TODO: this function must be deprecated
+        */
        return service_get_app_id(service, package);
 }
 
@@ -561,19 +468,12 @@ int service_get_package(service_h service, char **package)
 int service_set_app_id(service_h service, const char *app_id)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (app_id != NULL)
-       {
+       if (app_id != NULL) {
                if (appsvc_set_appid(service->data, app_id) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid application ID");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_PACKAGE);
        }
 
@@ -586,20 +486,14 @@ int service_get_app_id(service_h service, char **app_id)
        const char *app_id_value;
 
        if (service_valiate_service(service) || app_id == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        app_id_value = appsvc_get_appid(service->data);
 
        if (app_id_value != NULL)
-       {
                *app_id = strdup(app_id_value);
-       }
        else
-       {
                *app_id = NULL;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -607,19 +501,12 @@ int service_get_app_id(service_h service, char **app_id)
 int service_set_window(service_h service, unsigned int id)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (id > 0)
-       {
+       if (id > 0) {
                if (appsvc_allow_transient_app(service->data, id) != 0)
-               {
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid id");
-               }
-       }
-       else
-       {
+       } else {
                bundle_del(service->data, BUNDLE_KEY_WINDOW);
        }
 
@@ -631,20 +518,14 @@ int service_get_window(service_h service, unsigned int *id)
        const char *window_id;
 
        if (service_valiate_service(service) || id == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        window_id = bundle_get_val(service->data, BUNDLE_KEY_WINDOW);
 
        if (window_id != NULL)
-       {
                *id = atoi(window_id);
-       }
        else
-       {
                *id = 0;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -654,16 +535,12 @@ int service_clone(service_h *clone, service_h service)
        service_h service_clone;
 
        if (service_valiate_service(service) || clone == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        service_clone = malloc(sizeof(struct service_s));
 
        if (service_clone == NULL)
-       {
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a service handle");
-       }
 
        service_clone->id = service_new_id();
        service_clone->type = service->type;
@@ -686,44 +563,33 @@ int service_send_launch_request(service_h service, service_reply_cb callback, vo
        service_request_context_h request_context = NULL;
 
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        operation = appsvc_get_operation(service->data);
 
-       if (operation == NULL)
-       {
+       if (operation == NULL) {
                implicit_default_operation = true;
                operation = SERVICE_OPERATION_DEFAULT;
        }
 
        appid = appsvc_get_appid(service->data);
 
-       // operation : default
-       if (!strcmp(operation, SERVICE_OPERATION_DEFAULT))
-       {
+       if (!strcmp(operation, SERVICE_OPERATION_DEFAULT)) {
                if (appid == NULL)
-               {
                        return service_error(SERVICE_ERROR_APP_NOT_FOUND, __FUNCTION__, "package must be specified if the operation is default value");
-               }
        }
 
-       if (callback != NULL)
-       {
+       if (callback != NULL) {
                service_h request_clone = NULL;
 
                request_context = calloc(1, sizeof(struct service_request_context_s));
 
                if (request_context == NULL)
-               {
                        return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-               }
 
                request_context->reply_cb = callback;
 
-               if (service_clone(&request_clone, service) != SERVICE_ERROR_NONE)
-               {
+               if (service_clone(&request_clone, service) != SERVICE_ERROR_NONE) {
                        free(request_context);
                        return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to clone the service request handle");
                }
@@ -733,27 +599,18 @@ int service_send_launch_request(service_h service, service_reply_cb callback, vo
        }
 
        if (implicit_default_operation == true)
-       {
                appsvc_set_operation(service->data, SERVICE_OPERATION_DEFAULT);
-       }
 
        launch_pid = appsvc_usr_run_service(service->data, service->id, callback ? service_request_result_broker : NULL, request_context, getuid());
 
        if (implicit_default_operation == true)
-       {
                bundle_del(service->data, BUNDLE_KEY_OPERATION);
-       }
 
-       if (launch_pid < 0)
-       {
+       if (launch_pid < 0) {
                if (launch_pid == APPSVC_RET_ENOMATCH)
-               {
                        return service_error(SERVICE_ERROR_APP_NOT_FOUND, __FUNCTION__, NULL);
-               }
                else
-               {
                        return service_error(SERVICE_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
-               }
        }
 
        service->launch_pid = launch_pid;
@@ -765,14 +622,10 @@ int service_send_launch_request(service_h service, service_reply_cb callback, vo
 int service_send_terminate_request(service_h service)
 {
        if (service_valiate_service(service))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if(service->type != SERVICE_TYPE_REQUEST || service->launch_pid < 0)
-       {
+       if (service->type != SERVICE_TYPE_REQUEST || service->launch_pid < 0)
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        appsvc_subapp_terminate_request_pid(service->launch_pid);
 
@@ -787,26 +640,19 @@ static bool service_copy_reply_data_cb(service_h service, const char *key, void
        int value_array_length = 0;
        int value_array_index = 0;
 
-       if (reply_data == NULL)
-       {
+       if (reply_data == NULL) {
                service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
                return false;
        }
 
-       if (appsvc_data_is_array(service->data, key))
-       {
+       if (appsvc_data_is_array(service->data, key)) {
                service_get_extra_data_array(service, key, &value_array, &value_array_length);
                appsvc_add_data_array(reply_data, key, (const char**)value_array, value_array_length);
 
-               for (value_array_index=0; value_array_index < value_array_length; value_array_index++)
-               {
+               for (value_array_index = 0; value_array_index < value_array_length; value_array_index++)
                        free(value_array[value_array_index]);
-               }
-
                free(value_array);
-       }
-       else
-       {
+       } else {
                service_get_extra_data(service, key, &value);
                appsvc_add_data(reply_data, key, value);
                free(value);
@@ -821,19 +667,14 @@ int service_reply_to_launch_request(service_h reply, service_h request, service_
        int appsvc_result;
 
        if (service_valiate_service(reply) || service_valiate_service(request))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (appsvc_create_result_bundle(request->data, &reply_data) != 0)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
-       }
 
        service_foreach_extra_data(reply, service_copy_reply_data_cb, reply_data);
 
-       switch (result)
-       {
+       switch (result) {
        case SERVICE_RESULT_SUCCEEDED:
                appsvc_result = APPSVC_RES_OK;
                break;
@@ -852,7 +693,7 @@ int service_reply_to_launch_request(service_h reply, service_h request, service_
        }
 
        appsvc_send_result(reply_data, appsvc_result);
-       
+
        return SERVICE_ERROR_NONE;
 }
 
@@ -860,25 +701,16 @@ int service_reply_to_launch_request(service_h reply, service_h request, service_
 int service_add_extra_data(service_h service, const char *key, const char *value)
 {
        if (service_valiate_service(service) || service_validate_extra_data(key) || service_validate_extra_data(value))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        if (appsvc_get_data(service->data, key) != NULL)
-       {
-               // overwrite any existing value
                bundle_del(service->data, key);
-       }
 
        if (appsvc_add_data(service->data, key, value) != 0)
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add data to the appsvc handle");
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -887,30 +719,19 @@ int service_add_extra_data(service_h service, const char *key, const char *value
 int service_add_extra_data_array(service_h service, const char *key, const char* value[], int length)
 {
        if (service_valiate_service(service) || service_validate_extra_data(key))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (value == NULL || length <= 0)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid array");
-       }       
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        if (appsvc_get_data_array(service->data, key, NULL) != NULL)
-       {
-               // overwrite any existing value
-               bundle_del(service->data,key);
-       }
+               bundle_del(service->data, key);
 
        if (appsvc_add_data_array(service->data, key, value, length) != 0)
-       {
-               return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");                
-       }
+               return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");
 
        return SERVICE_ERROR_NONE;
 }
@@ -919,19 +740,13 @@ int service_add_extra_data_array(service_h service, const char *key, const char*
 int service_remove_extra_data(service_h service, const char *key)
 {
        if (service_valiate_service(service) || service_validate_extra_data(key))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        if (bundle_del(service->data, key))
-       {
                return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -942,28 +757,19 @@ int service_get_extra_data(service_h service, const char *key, char **value)
        const char *data_value;
 
        if (service_valiate_service(service) || service_validate_extra_data(key) || value == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        data_value = appsvc_get_data(service->data, key);
 
-       if (data_value == NULL) 
-       {
+       if (data_value == NULL) {
                if (errno == ENOTSUP)
-               {
                        return service_error(SERVICE_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
-               }
                else
-               {
                        return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
-               }
        }
 
        *value = strdup(data_value);
@@ -980,47 +786,31 @@ int service_get_extra_data_array(service_h service, const char *key, char ***val
        int i;
 
        if (service_valiate_service(service) || service_validate_extra_data(key))
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (value == NULL || length == 0)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        array_data = appsvc_get_data_array(service->data, key, &array_data_length);
 
-       if (array_data == NULL)
-       {
+       if (array_data == NULL) {
                if (errno == ENOTSUP)
-               {
                        return service_error(SERVICE_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
-               }
                else
-               {
                        return service_error(SERVICE_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
-               }
        }
 
        array_data_clone = calloc(array_data_length, sizeof(char*));
 
        if (array_data_clone == NULL)
-       {
                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-       }
 
-       for (i=0; i<array_data_length; i++)
-       {
+       for (i = 0; i < array_data_length; i++) {
                if (array_data[i] != NULL)
-               {
                        array_data_clone[i] = strdup(array_data[i]);
-               }
        }
 
        *value = array_data_clone;
@@ -1033,23 +823,15 @@ int service_get_extra_data_array(service_h service, const char *key, char ***val
 int service_is_extra_data_array(service_h service, const char *key, bool *array)
 {
        if (service_valiate_service(service) || service_validate_extra_data(key) || array == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service_validate_internal_key(key))
-       {
                return service_error(SERVICE_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
-       }
 
        if (!appsvc_data_is_array(service->data, key))
-       {
                *array = false;
-       }
        else
-       {
                *array = true;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -1068,30 +850,21 @@ static void service_cb_broker_bundle_iterator(const char *key, const int type, c
        service_extra_data_cb extra_data_cb;
 
        if (key == NULL || !(type == BUNDLE_TYPE_STR || type == BUNDLE_TYPE_STR_ARRAY))
-       {
                return;
-       }
 
        foreach_context = (foreach_context_extra_data_t*)user_data;
 
        if (foreach_context->foreach_break == true)
-       {
                return;
-       }
 
        if (service_validate_internal_key(key))
-       {
                return;
-       }
-       
+
        extra_data_cb = foreach_context->callback;
 
-       if (extra_data_cb != NULL)
-       {
+       if (extra_data_cb != NULL) {
                bool stop_foreach = false;
-               
                stop_foreach = !extra_data_cb(foreach_context->service, key, foreach_context->user_data);
-       
                foreach_context->foreach_break = stop_foreach;
        }
 
@@ -1106,11 +879,9 @@ int service_foreach_extra_data(service_h service, service_extra_data_cb callback
                .user_data = user_data,
                .foreach_break = false
        };
-       
+
        if (service_valiate_service(service) || callback == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        bundle_foreach(service->data, service_cb_broker_bundle_iterator, &foreach_context);
 
@@ -1129,8 +900,7 @@ int service_cb_broker_foreach_app_matched(const char *package, void *data)
        foreach_context_launchable_app_t *foreach_context;
        service_app_matched_cb app_matched_cb;
 
-       if (package == NULL || data == NULL)
-       {
+       if (package == NULL || data == NULL) {
                service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
                return -1;
        }
@@ -1138,18 +908,13 @@ int service_cb_broker_foreach_app_matched(const char *package, void *data)
        foreach_context = (foreach_context_launchable_app_t*)data;
 
        if (foreach_context->foreach_break == true)
-       {
                return -1;
-       }
 
        app_matched_cb = foreach_context->callback;
 
-       if (app_matched_cb != NULL)
-       {
+       if (app_matched_cb != NULL) {
                bool stop_foreach = false;
-               
                stop_foreach = !app_matched_cb(foreach_context->service, package, foreach_context->user_data);
-       
                foreach_context->foreach_break = stop_foreach;
        }
 
@@ -1166,9 +931,7 @@ int service_foreach_app_matched(service_h service, service_app_matched_cb callba
        };
 
        if (service_valiate_service(service) || callback == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        appsvc_usr_get_list(service->data, service_cb_broker_foreach_app_matched, &foreach_context, getuid());
 
@@ -1182,29 +945,21 @@ int service_get_caller(service_h service, char **package)
        char *package_dup;
 
        if (service_valiate_service(service) || package == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service->type != SERVICE_TYPE_EVENT)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service handle type");
-       }
 
-        bundle_value = bundle_get_val(service->data, AUL_K_CALLER_APPID);
-        if (bundle_value == NULL)
-        {
-                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to retrieve the appid of the caller");
-        }
+       bundle_value = bundle_get_val(service->data, AUL_K_CALLER_APPID);
+       if (bundle_value == NULL)
+               return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to retrieve the appid of the caller");
 
-        package_dup = strdup(bundle_value);
+       package_dup = strdup(bundle_value);
 
-        if (package_dup == NULL)
-        {
-                return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-        }
+       if (package_dup == NULL)
+               return service_error(SERVICE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
 
-        *package = package_dup;
+       *package = package_dup;
 
        return SERVICE_ERROR_NONE;
 }
@@ -1213,27 +968,19 @@ int service_get_caller(service_h service, char **package)
 int service_is_reply_requested(service_h service, bool *requested)
 {
        const char *bundle_value;
-       
+
        if (service_valiate_service(service) || requested == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        if (service->type != SERVICE_TYPE_EVENT)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid service handle type");
-       }
 
        bundle_value = bundle_get_val(service->data, AUL_K_WAIT_RESULT);
 
        if (bundle_value != NULL)
-       {
                *requested = true;
-       }
        else
-       {
                *requested = false;
-       }
 
        return SERVICE_ERROR_NONE;
 }
@@ -1243,21 +990,15 @@ int service_import_from_bundle(service_h service, bundle *data)
        bundle *data_dup = NULL;
 
        if (service_valiate_service(service) || data == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        data_dup = bundle_dup(data);
 
        if (data_dup == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
-       }
 
        if (service->data != NULL)
-       {
                bundle_free(service->data);
-       }
 
        service->data = data_dup;
 
@@ -1269,16 +1010,12 @@ int service_export_as_bundle(service_h service, bundle **data)
        bundle *data_dup = NULL;
 
        if (service_valiate_service(service) || data == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        data_dup = bundle_dup(service->data);
 
        if (data_dup == NULL)
-       {
                return service_error(SERVICE_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to duplicate the bundle");
-       }
 
        *data = data_dup;