From 839e39339135dd25598d0478ad9b18da131769e2 Mon Sep 17 00:00:00 2001 From: Jarkko Sakkinen Date: Thu, 2 Dec 2010 22:57:38 -0800 Subject: [PATCH] Cleaned up labels implementation. --- src/Makefile.am | 2 +- src/smack_internal.c | 18 ------------------ src/smack_internal.h | 2 -- src/smack_labels.c | 12 ------------ 4 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 src/smack_internal.c diff --git a/src/Makefile.am b/src/Makefile.am index c33ce19..d67ce24 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,6 +4,6 @@ lib_LTLIBRARIES = libsmack.la AM_CFLAGS = -I../3rdparty/uthash-1.9.3/src libsmack_la_LDFLAGS = -version-info 1:0 -libsmack_la_SOURCES = smack_internal.c smack_rules.c smack_xattr.c smack_labels.c smack_misc.c +libsmack_la_SOURCES = smack_rules.c smack_xattr.c smack_labels.c smack_misc.c EXTRA_DIST=smack_internal.h diff --git a/src/smack_internal.c b/src/smack_internal.c deleted file mode 100644 index 2296352..0000000 --- a/src/smack_internal.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include "smack_internal.h" - -#define KNOWN_LABELS_COUNT 4 - -static const char *known_labels[] = { "_", "^", "*", "@" }; - -const char *get_known_label(const char *label) -{ - int i; - - for (i = 0; i < KNOWN_LABELS_COUNT; i++) - if (strcmp(label, known_labels[i]) == 0) - return known_labels[i]; - - return NULL; -} - diff --git a/src/smack_internal.h b/src/smack_internal.h index 1367364..9c0d405 100644 --- a/src/smack_internal.h +++ b/src/smack_internal.h @@ -34,6 +34,4 @@ #define ACC_A 16 #define ACC_LEN 4 -const char *get_known_label(const char *label); - #endif // SMACK_INTERNAL_H diff --git a/src/smack_labels.c b/src/smack_labels.c index 07f9920..fd7607b 100644 --- a/src/smack_labels.c +++ b/src/smack_labels.c @@ -129,10 +129,6 @@ const char *smack_label_set_add(SmackLabelSet handle, const char *long_name) int pos, len ,ret; struct smack_label *l; - if (strlen(long_name) == 0 || - get_known_label(long_name) != NULL) - return NULL; - len = strlen(long_name); pos = (len > SMACK64_LEN) ? len - SMACK64_LEN : 0; @@ -166,10 +162,6 @@ const char *smack_label_set_to_short_name(SmackLabelSet handle, struct smack_label *l; const char *res; - res = get_known_label(long_name); - if (res != NULL) - return res; - HASH_FIND(long_name_hh, handle->label_by_long_name, long_name, strlen(long_name), l); if (l == NULL) @@ -184,10 +176,6 @@ const char *smack_label_set_to_long_name(SmackLabelSet handle, struct smack_label *l; const char *res; - res = get_known_label(short_name); - if (res != NULL) - return res; - HASH_FIND(short_name_hh, handle->label_by_short_name, short_name, strlen(short_name), l); if (l == NULL) -- 2.7.4