[network-manager-openvpn/th/cleanup-bgo790612: 4/11] properties: don't use strlen() for checking for non-empty strings



commit 2a2f1fc1805050740f0dcd5d16439a5478c7d8dd
Author: Thomas Haller <thaller redhat com>
Date:   Fri Nov 17 11:58:59 2017 +0100

    properties: don't use strlen() for checking for non-empty strings

 properties/auth-helpers.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 21c965c..e31e08c 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -415,7 +415,7 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
 
                widget = GTK_WIDGET (gtk_builder_get_object (builder, "pw_tls_username_entry"));
                str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !strlen (str)) {
+               if (!str || !*str) {
                        g_set_error (error,
                                     NMV_EDITOR_PLUGIN_ERROR,
                                     NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
@@ -433,7 +433,7 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
                }
                widget = GTK_WIDGET (gtk_builder_get_object (builder, "pw_username_entry"));
                str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !strlen (str)) {
+               if (!str || !*str) {
                        g_set_error (error,
                                     NMV_EDITOR_PLUGIN_ERROR,
                                     NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
@@ -455,7 +455,7 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
 
                widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_local_address_entry"));
                str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !strlen (str)) {
+               if (!str || !*str) {
                        g_set_error (error,
                                     NMV_EDITOR_PLUGIN_ERROR,
                                     NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,
@@ -465,7 +465,7 @@ auth_widget_check_validity (GtkBuilder *builder, const char *contype, GError **e
 
                widget = GTK_WIDGET (gtk_builder_get_object (builder, "sk_remote_address_entry"));
                str = gtk_entry_get_text (GTK_ENTRY (widget));
-               if (!str || !strlen (str)) {
+               if (!str || !*str) {
                        g_set_error (error,
                                     NMV_EDITOR_PLUGIN_ERROR,
                                     NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY,


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