SELinux Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Trivial style improvements
@ 2019-05-10 21:56 Jokke Hämäläinen
  0 siblings, 0 replies; only message in thread
From: Jokke Hämäläinen @ 2019-05-10 21:56 UTC (permalink / raw)
  To: selinux


Yet another trivial style patch while spending the night reading
C code.

---
 policycoreutils/setsebool/setsebool.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/policycoreutils/setsebool/setsebool.c b/policycoreutils/setsebool/setsebool.c
index a5157efc..9d8abfac 100644
--- a/policycoreutils/setsebool/setsebool.c
+++ b/policycoreutils/setsebool/setsebool.c
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
 		/* Add 1 for the '=' */
 		len = strlen(argv[optind]) + strlen(argv[optind + 1]) + 2;
 		bool_list[0] = (char *)malloc(len);
-		if (bool_list[0] == 0) {
+		if (bool_list[0] == NULL) {
 			fputs("Out of memory - aborting\n", stderr);
 			return 1;
 		}
@@ -133,8 +133,8 @@ static int semanage_set_boolean_list(size_t boolcnt,
 		goto err;
 	}
 
-	if (! verbose) {
-		semanage_msg_set_callback(handle,NULL, NULL);
+	if (!verbose) {
+		semanage_msg_set_callback(handle, NULL, NULL);
 	}
 
 	managed = semanage_is_managed(handle);
@@ -175,9 +175,9 @@ static int semanage_set_boolean_list(size_t boolcnt,
 			goto err;
 
 		semanage_bool_exists(handle, bool_key, &result);
-		if ( !result ) {
+		if (!result) {
 			semanage_bool_exists_local(handle, bool_key, &result);
-			if ( !result ) {
+			if (!result) {
 				fprintf(stderr, "Boolean %s is not defined\n", boollist[j].name);
 				goto err;
 			}
@@ -230,13 +230,13 @@ int setbool(char **list, size_t start, size_t end)
 	while (i < end) {
 		name = list[i];
 		value_ptr = strchr(list[i], '=');
-		if (value_ptr == 0) {
+		if (value_ptr == NULL) {
 			fprintf(stderr,
 				"setsebool: '=' not found in boolean expression %s\n",
 				list[i]);
 			goto err;
 		}
-		*value_ptr = 0;
+		*value_ptr = '\0';
 		value_ptr++;
 		if (strcmp(value_ptr, "1") == 0 ||
 		    strcasecmp(value_ptr, "true") == 0 ||
@@ -278,7 +278,7 @@ int setbool(char **list, size_t start, size_t end)
 	while (i < end) {
 		name = list[i];
 		value_ptr = strchr(name, '=');
-		*value_ptr = 0;
+		*value_ptr = '\0';
 		value_ptr++;
 		if (pwd && pwd->pw_name)
 			syslog(LOG_NOTICE,
-- 
2.21.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 21:56 [PATCH] Trivial style improvements Jokke Hämäläinen

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org selinux@archiver.kernel.org
	public-inbox-index selinux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox