[balsa] address: Use g_strv_length()



commit 2bbe5bdb783c1c3f572f1b8525a481f896fdad88
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Mar 4 14:12:51 2018 -0500

    address: Use g_strv_length()
    
    …rather than reinventing it.

 libbalsa/address.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/libbalsa/address.c b/libbalsa/address.c
index e5eb99e22..84d278481 100644
--- a/libbalsa/address.c
+++ b/libbalsa/address.c
@@ -126,15 +126,13 @@ libbalsa_address_extract_name(const gchar * string, gchar ** last_name,
                               gchar ** first_name)
 {
     enum GCardFieldOrder { LAST = 0, FIRST, MIDDLE, PREFIX, SUFFIX };
-    gint cpt, j;
+    guint cpt, j;
     gchar **fld, **name_arr;
     gchar *res = NULL;
 
     fld = vcard_strsplit(string);
 
-    cpt = 0;
-    while (fld[cpt] != NULL)
-       cpt++;
+    cpt = g_strv_length(fld);
 
     if (cpt == 0) {
         /* insane empty name */


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