[libnma/lr/gtk-4.0: 4/33] utils: drop utils_char_is_ascii_print()




commit ce99f1adde34f2b71d8d65345fc5f5de71c1331a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Wed Oct 13 16:41:31 2021 +0200

    utils: drop utils_char_is_ascii_print()
    
    Using a procedure that wraps a macro is generally inferior to using the
    macro directly. A real procedure is used only in one spot -- no need to
    have it in the common utils package.

 src/nma-ws/nma-ws-wep-key.c | 12 +++++++++---
 src/utils/utils.c           |  6 ------
 src/utils/utils.h           |  1 -
 3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/nma-ws/nma-ws-wep-key.c b/src/nma-ws/nma-ws-wep-key.c
index 992aabf7..911dcd2b 100644
--- a/src/nma-ws/nma-ws-wep-key.c
+++ b/src/nma-ws/nma-ws-wep-key.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2007 - 2019 Red Hat, Inc.
+ * Copyright (C) 2007 - 2021 Red Hat, Inc.
  */
 
 #include "nm-default.h"
@@ -120,7 +120,7 @@ validate (NMAWs *ws, GError **error)
                        }
                } else if ((strlen (key) == 5) || (strlen (key) == 13)) {
                        for (i = 0; i < strlen (key); i++) {
-                               if (!utils_char_is_ascii_print (key[i])) {
+                               if (!g_ascii_isprint (key[i])) {
                                        widget_set_error (self->wep_key_entry);
                                        g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: 
key with a length of %zu must contain only ascii characters"), strlen (key));
                                        return FALSE;
@@ -198,6 +198,12 @@ fill_connection (NMAWs *ws, NMConnection *connection)
        }
 }
 
+static gboolean
+_ascii_isprint (char character)
+{
+       return g_ascii_isprint (character);
+}
+
 static void
 wep_entry_filter_cb (GtkEditable *editable,
                      char *text,
@@ -210,7 +216,7 @@ wep_entry_filter_cb (GtkEditable *editable,
        if (self->key_type == NM_WEP_KEY_TYPE_KEY) {
                utils_filter_editable_on_insert_text (editable,
                                                      text, length, position, data,
-                                                     utils_char_is_ascii_print,
+                                                     _ascii_isprint,
                                                      wep_entry_filter_cb);
        }
 }
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 21d1cfc3..8c5c2735 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -161,12 +161,6 @@ utils_create_mobile_connection_id (const char *provider, const char *plan_name)
        return g_strdup_printf (_("%s connection"), provider);
 }
 
-gboolean
-utils_char_is_ascii_print (char character)
-{
-       return g_ascii_isprint (character);
-}
-
 gboolean
 utils_char_is_ascii_ip4_address (char character)
 {
diff --git a/src/utils/utils.h b/src/utils/utils.h
index b950aba8..a3ec9832 100644
--- a/src/utils/utils.h
+++ b/src/utils/utils.h
@@ -31,7 +31,6 @@ typedef enum  {
 } NMAError;
 
 
-gboolean utils_char_is_ascii_print (char character);
 gboolean utils_char_is_ascii_ip4_address (char character);
 gboolean utils_char_is_ascii_ip6_address (char character);
 gboolean utils_char_is_ascii_apn (char character);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]