Convert sepol_list_del to void return
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
@@ -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
@@ -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
@@ -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
@@ -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.
Quoted 4 lines · Karl MacMillan
Convert
sepol_list_delto void return. There is no possibility of error after converting the free functions to always return void.Signed-off-by User "Karl MacMillan <[email protected]>"
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-r63fcfe6bf3fflibsepol/include/sepol/list.hlibsepol/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-r63fcfe6bf3fflibsepol/src/list.clibsepol/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-r63fcfe6bf3fflibsepol/src/objset.clibsepol/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-r63fcfe6bf3fflibsepol/tests/test-list.clibsepol/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.
Karl MacMillan
AppliedQuoted 10 lines · Stephen Smalley
Quoted 4 lines · Karl MacMillan
Convert
sepol_list_delto void return. There is no possibility of error after converting the free functions to always return void.Signed-off-by User "Karl MacMillan <[email protected]>"Acked-by Stephen Smalley <[email protected]>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.