Skip to contentSkip to conversation

Add generic iterators and a linked-list data structure to libsepol

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add generic iterators and a linked-list data structure to libsepol

Add a generic iterator data structure and a linked-list implementation based that uses the iterators to libsepol. Includes test cases for the linked-list implementation.

libsepol/include/sepol/errcodes.h +3 -0
diff -r c0ca24c3e136 libsepol/include/sepol/errcodes.h
@@ -22,4 +22,7 @@
 #define SEPOL_EEXIST         -EEXIST
 #define SEPOL_ENOENT         -ENOENT
 
+/* Custom error codes */
+#define SEPOL_ITERSTOP       -500
+
 #endif
libsepol/include/sepol/iter.h new file +239 -0

239 lines not on this page · raw message

libsepol/include/sepol/list.h new file +234 -0

234 lines not on this page · raw message

libsepol/src/iter.c new file +186 -0

186 lines not on this page · raw message

libsepol/src/list.c new file +422 -0

422 lines not on this page · raw message

libsepol/tests/libsepol-tests.c +2 -0
diff -r c0ca24c3e136 libsepol/tests/libsepol-tests.c
@@ -22,6 +22,7 @@
 #include "test-linker.h"
 #include "test-expander.h"
 #include "test-deps.h"
+#include "test-list.h"
 
 #include <CUnit/Basic.h>
 #include <CUnit/Console.h>
@@ -61,6 +62,7 @@ static int do_tests(int interactive, int
 	DECLARE_SUITE(linker);
 	DECLARE_SUITE(expander);
 	DECLARE_SUITE(deps);
+	DECLARE_SUITE(list);
 
 	if (verbose)
 		CU_basic_set_mode(CU_BRM_VERBOSE);
libsepol/tests/test-list.c new file +373 -0

373 lines not on this page · raw message

libsepol/tests/test-list.h new file +12 -0
diff -r c0ca24c3e136 libsepol/tests/test-list.h
@@ -0,0 +1,12 @@
+/* Author : Karl MacMillan <[email protected]> */
+
+#ifndef __test_list_h__
+#define __test_list_h__
+
+#include <CUnit/Basic.h>
+
+int list_test_init(void);
+int list_test_cleanup(void);
+int list_add_tests(CU_pSuite suite);
+
+#endif

--
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.