Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 07/17] common: Drop GLib use from gprs_auth_proto_to_string
Date: Tue, 30 Jan 2024 15:21:12 -0600	[thread overview]
Message-ID: <20240130212137.814082-7-denkenz@gmail.com> (raw)
In-Reply-To: <20240130212137.814082-1-denkenz@gmail.com>

Refactor this function to use bool from stdbool.h as well as drop usage
of GLib in favor of ell.
---
 src/common.c | 15 ++++++++-------
 src/common.h |  3 ++-
 src/gprs.c   |  4 ++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/common.c b/src/common.c
index 9a55990b6435..79094ee4906c 100644
--- a/src/common.c
+++ b/src/common.c
@@ -28,6 +28,7 @@
 #include <errno.h>
 
 #include <glib.h>
+#include <ell/ell.h>
 
 #include <ofono/types.h>
 #include <ofono/gprs-context.h>
@@ -747,20 +748,20 @@ const char *gprs_proto_to_string(enum ofono_gprs_proto proto)
 	return NULL;
 }
 
-gboolean gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto)
+bool gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto)
 {
-	if (g_str_equal(str, "ip")) {
+	if (l_streq0(str, "ip")) {
 		*proto = OFONO_GPRS_PROTO_IP;
-		return TRUE;
-	} else if (g_str_equal(str, "ipv6")) {
+		return true;
+	} else if (l_streq0(str, "ipv6")) {
 		*proto = OFONO_GPRS_PROTO_IPV6;
-		return TRUE;
+		return true;
 	} else if (g_str_equal(str, "dual")) {
 		*proto = OFONO_GPRS_PROTO_IPV4V6;
-		return TRUE;
+		return true;
 	}
 
-	return FALSE;
+	return false;
 }
 
 const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth)
diff --git a/src/common.h b/src/common.h
index 3d30e2497ebb..779de7278446 100644
--- a/src/common.h
+++ b/src/common.h
@@ -19,6 +19,7 @@
  *
  */
 
+#include <stdbool.h>
 #include <glib.h>
 
 #include <ofono/types.h>
@@ -185,7 +186,7 @@ gboolean is_valid_apn(const char *apn);
 const char *call_status_to_string(enum call_status status);
 
 const char *gprs_proto_to_string(enum ofono_gprs_proto proto);
-gboolean gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto);
+bool gprs_proto_from_string(const char *str, enum ofono_gprs_proto *proto);
 
 const char *gprs_auth_method_to_string(enum ofono_gprs_auth_method auth);
 gboolean gprs_auth_method_from_string(const char *str,
diff --git a/src/gprs.c b/src/gprs.c
index 7b681d850c21..3eb7df83ac54 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1087,7 +1087,7 @@ static DBusMessage *pri_set_proto(struct pri_context *ctx,
 	GKeyFile *settings = ctx->gprs->settings;
 	enum ofono_gprs_proto proto;
 
-	if (gprs_proto_from_string(str, &proto) == FALSE)
+	if (!gprs_proto_from_string(str, &proto))
 		return __ofono_error_invalid_format(msg);
 
 	if (ctx->context.proto == proto)
@@ -3162,7 +3162,7 @@ static gboolean load_context(struct ofono_gprs *gprs, const char *group)
 	if (protostr == NULL)
 		protostr = g_strdup("ip");
 
-	if (gprs_proto_from_string(protostr, &proto) == FALSE)
+	if (!gprs_proto_from_string(protostr, &proto))
 		goto error;
 
 	username = g_key_file_get_string(gprs->settings, group,
-- 
2.43.0


  parent reply	other threads:[~2024-01-30 21:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 21:21 [PATCH 01/17] umlrunner: Also mount /var/lib as tmpfs Denis Kenzior
2024-01-30 21:21 ` [PATCH 02/17] build: Only enable backtrace(3) in maintainer mode Denis Kenzior
2024-01-30 21:21 ` [PATCH 03/17] build: Bring in more ell classes Denis Kenzior
2024-01-30 21:21 ` [PATCH 04/17] provisiondb: Remove some duplicate MCCMNC entries Denis Kenzior
2024-01-30 21:21 ` [PATCH 05/17] storage: Introduce storage_get_file_path() Denis Kenzior
2024-01-30 21:21 ` [PATCH 06/17] storage: Convert g_strdup_* use to l_strdup_* Denis Kenzior
2024-01-30 21:21 ` Denis Kenzior [this message]
2024-01-30 21:21 ` [PATCH 08/17] common: Drop GLib use from gprs_proto_to_string Denis Kenzior
2024-01-30 21:21 ` [PATCH 09/17] storage: Remove mode parameter Denis Kenzior
2024-01-30 21:21 ` [PATCH 10/17] storage: Use l_malloc Denis Kenzior
2024-01-30 21:21 ` [PATCH 11/17] storage: Remove mode argument Denis Kenzior
2024-01-30 21:21 ` [PATCH 12/17] storage: Use void * instead of unsigned char * Denis Kenzior
2024-01-30 21:21 ` [PATCH 13/17] storage: use l_file_set_contents Denis Kenzior
2024-01-30 21:21 ` [PATCH 14/17] lte: Refactor lte settings management Denis Kenzior
2024-01-30 21:21 ` [PATCH 15/17] lte: Add provisioning support Denis Kenzior
2024-01-30 21:21 ` [PATCH 16/17] phonesim: Add lte atom Denis Kenzior
2024-01-30 21:21 ` [PATCH 17/17] lte: Write provisioned info to disk Denis Kenzior
2024-02-02 23:30 ` [PATCH 01/17] umlrunner: Also mount /var/lib as tmpfs patchwork-bot+ofono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240130212137.814082-7-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox