Skip to contentSkip to conversation

Export symtab hash functions

PATCH New Karl MacMillan 1 participant 1 message Apr 18, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Export symtab hash functions

Export the symtab symbol hash and compare functions for use in other parts of libsepol.

libsepol/include/sepol/policydb/symtab.h +6 -0
diff -r 1280147740b5 libsepol/include/sepol/policydb/symtab.h
@@ -31,6 +31,12 @@ typedef struct {
 	uint32_t nprim;		/* number of primary names in table */
 } symtab_t;
 
+extern unsigned int sepol_symhash(hashtab_t h,
+				  hashtab_key_t key);
+
+extern int sepol_symcmp(hashtab_t h, hashtab_key_t key1,
+			hashtab_key_t key2);
+
 extern int symtab_init(symtab_t *, unsigned int size);
 
 #endif				/* _SYMTAB_H_ */
libsepol/src/symtab.c +3 -3
diff -r 1280147740b5 libsepol/src/symtab.c
@@ -11,7 +11,7 @@
 #include <sepol/policydb/hashtab.h>
 #include <sepol/policydb/symtab.h>
 
-static unsigned int symhash(hashtab_t h, hashtab_key_t key)
+unsigned int sepol_symhash(hashtab_t h, hashtab_key_t key)
 {
 	char *p, *keyp;
 	size_t size;
@@ -26,7 +26,7 @@ static unsigned int symhash(hashtab_t h,
 	return val & (h->size - 1);
 }
 
-static int symcmp(hashtab_t h
+int sepol_symcmp(hashtab_t h
 		  __attribute__ ((unused)), hashtab_key_t key1,
 		  hashtab_key_t key2)
 {
@@ -39,7 +39,7 @@ static int symcmp(hashtab_t h
 
 int symtab_init(symtab_t * s, unsigned int size)
 {
-	s->table = hashtab_create(symhash, symcmp, size);
+	s->table = hashtab_create(sepol_symhash, sepol_symcmp, size);
 	if (!s->table)
 		return -1;
 	s->nprim = 0;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.