[evolution] M!29 - evolution-csv-importer.c:parseLine: skip calls to strlen+g_strdup



commit e4325936d3bfa8f6e7cab3f1a8f3a846bc77fc5f
Author: Дилян Палаузов <git-dpa aegee org>
Date:   Tue Jul 9 07:19:05 2019 +0000

    M!29 - evolution-csv-importer.c:parseLine: skip calls to strlen+g_strdup
    
    Closes https://gitlab.gnome.org/GNOME/evolution/merge_requests/29

 src/addressbook/importers/evolution-csv-importer.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/src/addressbook/importers/evolution-csv-importer.c 
b/src/addressbook/importers/evolution-csv-importer.c
index dd982ff200..11427a515d 100644
--- a/src/addressbook/importers/evolution-csv-importer.c
+++ b/src/addressbook/importers/evolution-csv-importer.c
@@ -657,15 +657,9 @@ parseLine (CSVImporter *gci,
                ii++;
                g_string_free (value, TRUE);
        }
-       if (strlen (home_street->str) != 0)
-               home_address->street = g_strdup (home_street->str);
-       if (strlen (work_street->str) != 0)
-               work_address->street = g_strdup (work_street->str);
-       if (strlen (other_street->str) != 0)
-               other_address->street = g_strdup (other_street->str);
-       g_string_free (home_street, TRUE);
-       g_string_free (work_street, TRUE);
-       g_string_free (other_street, TRUE);
+       home_address->street = g_string_free (home_street, !home_street->len);
+       work_address->street = g_string_free (work_street, !work_street->len);
+       other_address->street = g_string_free (other_street, !other_street->len);
 
        if (home_address->locality || home_address->country ||
           home_address->code || home_address->region || home_address->street)


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