diff mbox series

[01/22] gweb: Leverage 'GWEB_HTTP_STATUS_CODE_UNKNOWN' mnemonic.

Message ID 099f9cd55983495c71a47a68f402720c6b3c4cab.1741050622.git.gerickson@nuovations.com (mailing list archive)
State Superseded
Headers show
Series Close Two GWeb Request "Bookend" Failure "Holes" | expand

Commit Message

Grant Erickson March 4, 2025, 1:10 a.m. UTC
In the GWebResult structure, the 'status' data member is effectively
nullable with the GWEB_HTTP_STATUS_CODE_UNKNOWN mnemonic representing
the "null" value.

Consequently, use the GWEB_HTTP_STATUS_CODE_UNKNOWN mnemonic rather
than zero (0) to make that intent and pattern clear throughout the
code.
---
 gweb/gweb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gweb/gweb.c b/gweb/gweb.c
index ce49e8d3dfc1..8e0b79c52254 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -1189,7 +1189,7 @@  static gboolean received_data(GIOChannel *channel, GIOCondition cond,
 
 		str = session->current_header->str;
 
-		if (session->result.status == 0) {
+		if (session->result.status == GWEB_HTTP_STATUS_CODE_UNKNOWN) {
 			unsigned int code;
 
 			if (sscanf(str, "HTTP/%*s %u %*s", &code) == 1)
@@ -2429,7 +2429,7 @@  bool g_web_cancel_request(GWeb *web, guint id)
 guint16 g_web_result_get_status(GWebResult *result)
 {
 	if (!result)
-		return 0;
+		return GWEB_HTTP_STATUS_CODE_UNKNOWN;
 
 	return result->status;
 }