Code cleanup
authorPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Tue, 21 Jan 2014 14:56:57 +0000 (15:56 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 5 Feb 2014 10:12:44 +0000 (11:12 +0100)
[Issue#]        N/A
[Bug/Feature]   Unused variables, minor warnings
[Cause]         N/A
[Solution]      N/A
[Verification]  N/A

Change-Id: I5530e2459b402ef0625afe13a2e693cd3f415842

include/common.h
include/privilege-control.h
src/common.c
src/privilege-control.c

index 54719ec..1ac074d 100644 (file)
 void freep(void *p);
 void closep(int *fd);
 void fclosep(FILE **f);
-void smack_freep(struct smack_accesses **smack);
 void fts_closep(FTS **f);
 #define AUTO_FREE       __attribute__ ((cleanup(freep)))       = NULL
 #define AUTO_CLOSE      __attribute__ ((cleanup(closep)))      = -1
 #define AUTO_FCLOSE     __attribute__ ((cleanup(fclosep)))     = NULL
-#define AUTO_SMACK_FREE __attribute__ ((cleanup(smack_freep))) = NULL
 #define AUTO_FTS_CLOSE  __attribute__ ((cleanup(fts_closep)))   = NULL
 
 #define SMACK_RULES_DIR          "/opt/etc/smack-app/accesses.d/"
@@ -109,7 +107,7 @@ int load_smack_from_file_early(const char* app_id, struct smack_accesses** smack
 int smack_mark_file_name(const char *app_id, char **path);
 bool file_exists(const char* path);
 int smack_file_name(const char* app_id, char** path);
-inline int have_smack(void);
+int have_smack(void);
 int base_name_from_perm(const char *perm, char **name);
 
 
index d3dbce6..ed74d23 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 #define API __attribute__((visibility("default")))
 #endif // API
 
-#define DEPRECATED __attribute__((deprecated));
+#define DEPRECATED __attribute__((deprecated))
 #define UNUSED __attribute__((unused))
 
 /* error codes */
index af07e63..6f37395 100644 (file)
@@ -246,11 +246,6 @@ void fclosep(FILE **f)
                fclose(*f);
 }
 
-void smack_freep(struct smack_accesses **smack)
-{
-       smack_accesses_free(*smack);
-}
-
 void fts_closep(FTS **f)
 {
        if(*f)
@@ -369,7 +364,7 @@ int smack_file_name(const char *app_id, char **path)
        return PC_OPERATION_SUCCESS;
 }
 
-inline int have_smack(void)
+int have_smack(void)
 {
        SECURE_C_LOGD("Entering function: %s.", __func__);
 
index cb373b8..0000625 100644 (file)
@@ -1243,7 +1243,6 @@ static int perm_app_setup_path_internal(const char* pkg_id, const char* path, ap
 
        case APP_PATH_PUBLIC: {
                C_LOGD("app_path_type is APP_PATH_PUBLIC.");
-               char **app_ids AUTO_FREE;
                const char *label;
                int ret;
 
@@ -1275,7 +1274,6 @@ static int perm_app_setup_path_internal(const char* pkg_id, const char* path, ap
 
        case APP_PATH_SETTINGS: {
                C_LOGD("app_path_type is APP_PATH_SETTINGS.");
-               char **app_ids AUTO_FREE;
                const char *label;
                int ret;
 
@@ -1448,9 +1446,6 @@ API int perm_app_install(const char* pkg_id)
        SECURE_C_LOGD("Entering function: %s. Params: pkg_id=%s",
                                __func__, pkg_id);
        int ret;
-       int fd AUTO_CLOSE;
-       char* smack_path AUTO_FREE;
-       struct smack_accesses *smack AUTO_SMACK_FREE;
 
        if (!smack_label_is_valid(pkg_id)) {
                C_LOGE("Invalid param pkg_id.");
@@ -1478,7 +1473,6 @@ API int app_uninstall(const char* pkg_id)//deprecated
 API int perm_app_uninstall(const char* pkg_id)
 {
        SECURE_C_LOGD("Entering function: %s. Params: pkg_id=%s", __func__, pkg_id);
-       char* smack_path AUTO_FREE;
        int ret;
 
        if (!smack_label_is_valid(pkg_id)) {
@@ -1545,7 +1539,6 @@ API int perm_add_api_feature(app_type_t app_type,
                                __func__, app_type, api_feature_name);
 
        int ret = PC_OPERATION_SUCCESS;
-       char* smack_file AUTO_FREE;
        char* dac_file AUTO_FREE;
        char * base_api_feature_name AUTO_FREE;
        FILE* file = NULL;