diff mbox series

[17/47] libsemanage: drop casts to same type

Message ID 20241111141706.38039-17-cgoettsche@seltendoof.de (mailing list archive)
State New
Delegated to: Petr Lautrbach
Headers show
Series [01/47] libsemanage: white space cleanup | expand

Commit Message

Christian Göttsche Nov. 11, 2024, 2:16 p.m. UTC
From: Christian Göttsche <cgzones@googlemail.com>

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libsemanage/src/genhomedircon.c  | 10 +++++-----
 libsemanage/src/semanage_store.c |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index 31c9a5bf..29ff4259 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -472,10 +472,10 @@  static int HOME_DIR_PRED(const char *string)
 /* new names */
 static int USERNAME_CONTEXT_PRED(const char *string)
 {
-	return (int)(
-		(strstr(string, TEMPLATE_USERNAME) != NULL) ||
-		(strstr(string, TEMPLATE_USERID) != NULL)
-	);
+	return
+		strstr(string, TEMPLATE_USERNAME) != NULL ||
+		strstr(string, TEMPLATE_USERID) != NULL
+	;
 }
 
 /* This will never match USER if USERNAME or USERID are found. */
@@ -484,7 +484,7 @@  static int USER_CONTEXT_PRED(const char *string)
 	if (USERNAME_CONTEXT_PRED(string))
 		return 0;
 
-	return (int)(strstr(string, TEMPLATE_USER) != NULL);
+	return strstr(string, TEMPLATE_USER) != NULL;
 }
 
 static int STR_COMPARATOR(const void *a, const void *b)
diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c
index f5c19e00..fb3f3cc9 100644
--- a/libsemanage/src/semanage_store.c
+++ b/libsemanage/src/semanage_store.c
@@ -2656,7 +2656,7 @@  int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 			continue;
 		}
 
-		temp->path = (char *)strndup(&line_buf[start], regex_len);
+		temp->path = strndup(&line_buf[start], regex_len);
 		if (!temp->path) {
 			ERR(sh, "Failure allocating memory.");
 			semanage_fc_node_destroy(temp);
@@ -2691,7 +2691,7 @@  int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 
 			/* Record the inode type. */
 			temp->file_type =
-			    (char *)strndup(&line_buf[i], type_len);
+			    strndup(&line_buf[i], type_len);
 			if (!temp->file_type) {
 				ERR(sh, "Failure allocating memory.");
 				semanage_fc_node_destroy(temp);
@@ -2724,7 +2724,7 @@  int semanage_fc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 		finish = i;
 		context_len = finish - start;
 
-		temp->context = (char *)strndup(&line_buf[start], context_len);
+		temp->context = strndup(&line_buf[start], context_len);
 		if (!temp->context) {
 			ERR(sh, "Failure allocating memory.");
 			semanage_fc_node_destroy(temp);
@@ -2963,7 +2963,7 @@  int semanage_nc_sort(semanage_handle_t * sh, const char *buf, size_t buf_len,
 		}
 
 		node->rule =
-		    (char *)strndup(line_buf + offset, line_len - offset);
+		    strndup(line_buf + offset, line_len - offset);
 		node->rule_len = line_len - offset;
 		node->next = NULL;