From f774ea81e5d3e2607da601eeaf1b875dbe5b259a Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Tue, 18 Sep 2001 05:11:31 +0000 Subject: use g_strfreev. (match_name): s/g_free/g_strfreev. (match_file_as): 2001-09-17 Larry Ewing * gui/component/select-names/e-select-names-completion.c (name_style_query): use g_strfreev. (match_name): s/g_free/g_strfreev. (match_file_as): s/g_free/g_strfreev. * backend/ebook/e-book-util.c (e_book_name_and_email_query): fix the memory handling here. All there members of the vector need to be freed all the time. * backend/ebook/load-pine-addressbook.c (parse_line): free the string outside of the test that makes sure there are three entries. svn path=/trunk/; revision=12936 --- addressbook/ChangeLog | 13 +++++++++++++ addressbook/backend/ebook/e-book-util.c | 10 +++++----- addressbook/backend/ebook/load-pine-addressbook.c | 2 +- .../gui/component/select-names/e-select-names-completion.c | 9 +++------ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 91bbee8eed..b6e248d7f7 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,18 @@ 2001-09-17 Larry Ewing + * gui/component/select-names/e-select-names-completion.c + (name_style_query): use g_strfreev. + (match_name): s/g_free/g_strfreev. + (match_file_as): s/g_free/g_strfreev. + + * backend/ebook/e-book-util.c (e_book_name_and_email_query): fix + the memory handling here. All there members of the vector need to + be freed all the time. + + * backend/ebook/load-pine-addressbook.c (parse_line): free the + string outside of the test that makes sure there are three + entries. + * gui/component/select-names/e-select-names-completion.c (match_nickname): don't malloc a match we will never use. diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c index 3943117ce0..5e291eb73c 100644 --- a/addressbook/backend/ebook/e-book-util.c +++ b/addressbook/backend/ebook/e-book-util.c @@ -417,8 +417,12 @@ e_book_name_and_email_query (EBook *book, namev = g_strsplit (" ", name_cpy, 0); for (i=0; namev[i]; ++i) { if (*namev[i]) { + char *str = name[i]; + namev[i] = g_strdup_printf ("(contains \"file_as\" \"%s\")", namev[i]); ++count; + + g_free (str); } } @@ -430,12 +434,8 @@ e_book_name_and_email_query (EBook *book, qjoined = NULL; } - g_free (name_cpy); - for (i=0; namev[i]; ++i) - if (*namev[i]) - g_free (namev[i]); - g_free (namev); + g_strfreev (namev); g_free (qjoined); } diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c index 6963a7ed46..c1d58a88bf 100644 --- a/addressbook/backend/ebook/load-pine-addressbook.c +++ b/addressbook/backend/ebook/load-pine-addressbook.c @@ -53,9 +53,9 @@ parse_line (EBook *book, char *line) "email", &list, NULL); e_list_append(list, strings[2]); - g_strfreev(strings); e_book_add_card(book, card, add_card_cb, card); } + g_strfreev(strings); } static void diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index 8472ffc4d6..0a34361c62 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -231,11 +231,8 @@ name_style_query (ESelectNamesCompletion *comp, const gchar *field) g_free (joined); } - for (i=0; strv[i]; ++i) - g_free (strv[i]); g_free (cpy); - g_free (strv); - + g_strfreev (strv); return query; } @@ -344,7 +341,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) } g_free (cpy); - g_free (strv); + g_strfreev (strv); score = match_len * 3; /* three points per match character */ @@ -454,7 +451,7 @@ match_file_as (ESelectNamesCompletion *comp, EDestination *dest) } g_free (cpy); - g_free (strv); + g_strfreev (strv); if (!matched) return NULL; -- cgit