Skip to contentSkip to conversation

treewide: Comply with doc/coding-style.txt M13

PATCH Applied Denis Kenzior 1 participant 2 messages Oct 14, 2024 – Oct 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 treewide: Comply with doc/coding-style.txt M13

---
 src/backtrace.c  | 4 ++--
 src/eap.c        | 4 ++--
 src/frame-xchg.c | 3 +--
 src/netconfig.c  | 2 +-
 src/storage.c    | 4 ++--
 src/udev.c       | 3 +--
 src/wscutil.c    | 2 +-
 unit/test-dpp.c  | 4 ++--
 unit/test-ie.c   | 4 ++--
 unit/test-json.c | 2 +-
 10 files changed, 15 insertions(+), 17 deletions(-)
src/backtrace.c +2 -2
index 607097212ade..9f130523d5bc 100644
@@ -54,7 +54,7 @@ void __iwd_backtrace_print(unsigned int offset)
 	int pathlen;
 	pid_t pid;
 
-	if (program_exec == NULL)
+	if (!program_exec)
 		return;
 
 	pathlen = strlen(program_path);
@@ -186,7 +186,7 @@ void __iwd_backtrace_init(void)
 		}
 	}
 
-	if (program_exec == NULL)
+	if (!program_exec)
 		return;
 
 	program_path = getcwd(cwd, sizeof(cwd));
src/eap.c +2 -2
index 4d08f072c32d..9e924577637d 100644
@@ -974,7 +974,7 @@ static void __eap_method_enable(struct eap_method_desc *start,
 
 	l_debug("");
 
-	if (start == NULL || stop == NULL)
+	if (!start || !stop)
 		return;
 
 	for (desc = start; desc < stop; desc++) {
@@ -992,7 +992,7 @@ static void __eap_method_disable(struct eap_method_desc *start,
 
 	l_debug("");
 
-	if (start == NULL || stop == NULL)
+	if (!start || !stop)
 		return;
 
 	for (desc = start; desc < stop; desc++) {
src/frame-xchg.c +1 -2
index 158befd0ba83..e9729927d6ab 100644
@@ -342,8 +342,7 @@ static bool frame_watch_group_io_read(struct l_io *io, void *user_data)
 
 	nlmsg_len = bytes_read;
 
-	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
-					cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 		struct nl_pktinfo pktinfo;
 
 		if (cmsg->cmsg_level != SOL_NETLINK)
src/netconfig.c +1 -1
index b31209cf820b..4e8fa0d8cf9f 100644
@@ -710,7 +710,7 @@ struct netconfig *netconfig_new(uint32_t ifindex)
 	netconfig_commit_init(netconfig);
 
 	debug_level = getenv("IWD_DHCP_DEBUG");
-	if (debug_level != NULL) {
+	if (debug_level) {
 		if (!strcmp("debug", debug_level))
 			dhcp_priority = L_LOG_DEBUG;
 		else if (!strcmp("info", debug_level))
src/storage.c +2 -2
index b756b1726618..c70554df53f2 100644
@@ -596,7 +596,7 @@ struct l_settings *storage_network_open(enum security type, const char *ssid)
 	struct l_settings *settings;
 	_auto_(l_free) char *path = NULL;
 
-	if (ssid == NULL)
+	if (!ssid)
 		return NULL;
 
 	path = storage_get_network_file_path(type, ssid);
@@ -623,7 +623,7 @@ int storage_network_touch(enum security type, const char *ssid)
 	char *path;
 	int ret;
 
-	if (ssid == NULL)
+	if (!ssid)
 		return -EINVAL;
 
 	path = storage_get_network_file_path(type, ssid);
src/udev.c +1 -2
index 8baf47246be7..859f00bdcdbb 100644
@@ -234,8 +234,7 @@ static bool can_read_data(struct l_io *io, void *user_data)
 	if (len < 0)
 		return false;
 
-	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
-					cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
 		struct nl_pktinfo *pktinfo;
 
 		if (cmsg->cmsg_level != SOL_NETLINK)
src/wscutil.c +1 -1
index 934deeda49b6..570c4d66ea2e 100644
@@ -722,7 +722,7 @@ int wsc_parse_attrs(const unsigned char *pdu, unsigned int len,
 			}
 		}
 
-		if (e2 == NULL) {
+		if (!e2) {
 			if (!ext_iter)
 				break;
 
unit/test-dpp.c +2 -2
index 0a4fd01f8e42..70e79814c111 100644
@@ -124,7 +124,7 @@ static bool verify_info(const struct dpp_uri_info *parsed,
 
 	assert(!memcmp(parsed->mac, expected->mac, 6));
 	assert(parsed->version == expected->version);
-	assert(parsed->boot_public != NULL);
+	assert(parsed->boot_public);
 
 	for (i = 0; result->expected_freqs[i]; i++)
 		assert(scan_freq_set_contains(parsed->freqs,
@@ -140,7 +140,7 @@ static void test_uri_parse(const void *data)
 
 	info = dpp_parse_uri(test_info->uri);
 	if (test_info->expect_fail) {
-		assert(info == NULL);
+		assert(!info);
 		return;
 	}
 
unit/test-ie.c +2 -2
index 7ea84c387121..a28cef85de25 100644
@@ -660,7 +660,7 @@ static void ie_test_concat_wsc(const void *data)
 	if (len > 0)
 		assert(!memcmp(res, test->expected_data, len));
 	else
-		assert(res == NULL);
+		assert(!res);
 
 	l_free(res);
 }
@@ -681,7 +681,7 @@ static void ie_test_encapsulate_wsc(const void *data)
 	if (extracted_len > 0)
 		assert(!memcmp(extracted, test->expected_data, extracted_len));
 	else
-		assert(extracted == NULL);
+		assert(!extracted);
 
 	packed = ie_tlv_encapsulate_wsc_payload(extracted, extracted_len,
 								&packed_len);
unit/test-json.c +1 -1
index 0d48b3d16d64..73e6f8c1b834 100644
@@ -106,7 +106,7 @@ static void test_json(const void *data)
 			JSON_OPTIONAL("objnotfound", JSON_OBJECT, &objnotfound),
 			JSON_UNDEFINED));
 
-	assert(opt_not_found == NULL);
+	assert(!opt_not_found);
 	assert(!json_iter_is_valid(&objnotfound));
 
 	assert(!strcmp(tech, "infra"));
Signature · 1 line
2.45.2
author Applied
#1 lore raw
Quoted 4 lines · Denis Kenzior
---
  src/backtrace.c  | 4 ++--
  src/eap.c        | 4 ++--
  src/frame-xchg.c | 3 +--
Quoted 9 lines
  src/netconfig.c  | 2 +-
  src/storage.c    | 4 ++--
  src/udev.c       | 3 +--
  src/wscutil.c    | 2 +-
  unit/test-dpp.c  | 4 ++--
  unit/test-ie.c   | 4 ++--
  unit/test-json.c | 2 +-
  10 files changed, 15 insertions(+), 17 deletions(-)

Applied