Skip to contentSkip to conversation

Convert sepol_list_del to void return

PATCH In review Karl MacMillan 2 participants 3 messages May 9, 2007 – May 11, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Convert sepol_list_del to void return

Convert sepol_list_del to void return. There is no possibility of error after converting the free functions to always return void.

---

4 files changed, 5 insertions(+), 8 deletions(-)
libsepol/include/sepol/list.h |    3 +--
libsepol/src/list.c           |    4 +---
libsepol/src/objset.c         |    3 ++-
libsepol/tests/test-list.c    |    3 +--
libsepol/include/sepol/list.h +1 -2
diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/include/sepol/list.h
@@ -199,8 +199,7 @@ extern int sepol_list_pop_back(struct se
  *
  * \retval SEPOL_OK success
  */
-extern int sepol_list_del(struct sepol_handle *h, struct sepol_list *list,
-			  struct sepol_iter *iter);
+extern void sepol_list_del(struct sepol_list *list, struct sepol_iter *iter);
 
 /**
  * \ingroup libsepol_list
libsepol/src/list.c +1 -3
diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/src/list.c
@@ -278,8 +278,7 @@ int sepol_list_pop_back(struct sepol_han
 }
 
 
-int sepol_list_del(struct sepol_handle *h, struct sepol_list *list,
-		   struct sepol_iter *iter)
+void sepol_list_del(struct sepol_list *list, struct sepol_iter *iter)
 {
 	struct sepol_list_item *cur;
 
@@ -306,7 +305,6 @@ out:
 	free(cur);
 	list->len--;
 	sepol_iter_set_state(iter, NULL);
-	return SEPOL_OK;
 }
 
 static int sepol_list_next(struct sepol_handle *h, struct sepol_iter *iter)
libsepol/src/objset.c +2 -1
diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/src/objset.c
@@ -127,8 +127,9 @@ int sepol_objset_del(struct sepol_handle
 	ret = sepol_objset_seek(h, s, &iter, obj);
 	switch (ret) {
 	case SEPOL_EEXIST:
-		ret = sepol_list_del(h, s->objs, iter);
+		sepol_list_del(s->objs, iter);
 		sepol_iter_free(iter);
+		ret = SEPOL_OK;
 		break;
 	case SEPOL_ENOENT:
 		sepol_iter_free(iter);
libsepol/tests/test-list.c +1 -2
diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/tests/test-list.c
@@ -143,8 +143,7 @@ static void test_list(void)
 			CU_ASSERT(ret == SEPOL_OK);
 			ret = sepol_iter_next(h, iter);
 			CU_ASSERT(ret == SEPOL_OK);
-			ret = sepol_list_del(h, list, iter2);
-			CU_ASSERT(ret == SEPOL_OK);
+			sepol_list_del(list, iter2);
 			i++;
 			continue;
 		}

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

Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Karl MacMillan

Convert sepol_list_del to void return. There is no possibility of error after converting the free functions to always return void.

Merge at will.

Quoted 75 lines

---

4 files changed, 5 insertions(+), 8 deletions(-)
libsepol/include/sepol/list.h |    3 +--
libsepol/src/list.c           |    4 +---
libsepol/src/objset.c         |    3 ++-
libsepol/tests/test-list.c    |    3 +--

diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/include/sepol/list.h

libsepol/include/sepol/list.h +1 -2
@@ -199,8 +199,7 @@ extern int sepol_list_pop_back(struct se
  *
  * \retval SEPOL_OK success
  */
-extern int sepol_list_del(struct sepol_handle *h, struct sepol_list *list,
-			  struct sepol_iter *iter);
+extern void sepol_list_del(struct sepol_list *list, struct sepol_iter *iter);
 
 /**
  * \ingroup libsepol_list

diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/src/list.c

libsepol/src/list.c +1 -3
@@ -278,8 +278,7 @@ int sepol_list_pop_back(struct sepol_han
 }
 
 
-int sepol_list_del(struct sepol_handle *h, struct sepol_list *list,
-		   struct sepol_iter *iter)
+void sepol_list_del(struct sepol_list *list, struct sepol_iter *iter)
 {
 	struct sepol_list_item *cur;
 
@@ -306,7 +305,6 @@ out:
 	free(cur);
 	list->len--;
 	sepol_iter_set_state(iter, NULL);
-	return SEPOL_OK;
 }
 
 static int sepol_list_next(struct sepol_handle *h, struct sepol_iter *iter)

diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/src/objset.c

libsepol/src/objset.c +2 -1
@@ -127,8 +127,9 @@ int sepol_objset_del(struct sepol_handle
 	ret = sepol_objset_seek(h, s, &iter, obj);
 	switch (ret) {
 	case SEPOL_EEXIST:
-		ret = sepol_list_del(h, s->objs, iter);
+		sepol_list_del(s->objs, iter);
 		sepol_iter_free(iter);
+		ret = SEPOL_OK;
 		break;
 	case SEPOL_ENOENT:
 		sepol_iter_free(iter);

diff -r c41d53f65490 -r 63fcfe6bf3ff libsepol/tests/test-list.c

libsepol/tests/test-list.c +1 -3
@@ -143,8 +143,7 @@ static void test_list(void)
 			CU_ASSERT(ret == SEPOL_OK);
 			ret = sepol_iter_next(h, iter);
 			CU_ASSERT(ret == SEPOL_OK);
-			ret = sepol_list_del(h, list, iter2);
-			CU_ASSERT(ret == SEPOL_OK);
+			sepol_list_del(list, iter2);
 			i++;
 			continue;
 		}
 
--

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.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
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.
author Applied
#2 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 4 lines · Karl MacMillan

Convert sepol_list_del to void return. There is no possibility of error after converting the free functions to always return void.

Merge at will.

Merged into policyrep.

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