[evolution-activesync: 4/5] Use g_strfreev instead of manually g_free
- From: dwmw2 <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-activesync: 4/5] Use g_strfreev instead of manually g_free
- Date: Mon, 13 Apr 2015 13:32:40 +0000 (UTC)
commit c27d036be01151ceb050f557b3bab54ca0dc123e
Author: Oliver Luo <lyc pku eecs gmail com>
Date: Mon Apr 13 19:35:37 2015 +0800
Use g_strfreev instead of manually g_free
eas-daemon/libeas/eas-update-email-req.c | 2 +-
eas-daemon/libeas/eas-utils.c | 14 --------------
eas-daemon/libeas/eas-utils.h | 7 -------
libeasclient/libeasmail.c | 29 ++++++-----------------------
libeasclient/libeassync.c | 25 +++++++------------------
5 files changed, 14 insertions(+), 63 deletions(-)
---
diff --git a/eas-daemon/libeas/eas-update-email-req.c b/eas-daemon/libeas/eas-update-email-req.c
index 9a6f265..d4fdfb0 100644
--- a/eas-daemon/libeas/eas-update-email-req.c
+++ b/eas-daemon/libeas/eas-update-email-req.c
@@ -121,7 +121,7 @@ eas_update_email_req_finalize (GObject *object)
g_free (priv->account_id);
g_free (priv->sync_key);
g_free (priv->folder_id);
- free_string_array (priv->serialised_email_array);
+ g_strfreev (priv->serialised_email_array);
G_OBJECT_CLASS (eas_update_email_req_parent_class)->finalize (object);
diff --git a/eas-daemon/libeas/eas-utils.c b/eas-daemon/libeas/eas-utils.c
index cc80a3d..4068500 100644
--- a/eas-daemon/libeas/eas-utils.c
+++ b/eas-daemon/libeas/eas-utils.c
@@ -52,20 +52,6 @@
#include "eas-utils.h"
-// takes a null terminated array of strings. frees the strings pointed to and the array itself
-void free_string_array (gchar **string_array)
-{
- guint i = 0;
- if (!string_array)
- return;
-
- while (string_array[i]) {
- g_free (string_array[i]);
- i++;
- }
- g_free (string_array);
-}
-
// gets the number of items in a null terminated array (of strings)
guint array_length (const gchar **array)
{
diff --git a/eas-daemon/libeas/eas-utils.h b/eas-daemon/libeas/eas-utils.h
index 9e83565..2c8ddbf 100644
--- a/eas-daemon/libeas/eas-utils.h
+++ b/eas-daemon/libeas/eas-utils.h
@@ -63,11 +63,4 @@
*/
guint array_length (const gchar **array);
-/* Free a null terminated array of strings (including the strings pointed to)
- *
- * @param[in] array
- * A null-terminated array of strings
- */
-void free_string_array (gchar **string_array);
-
#endif // _EAS_UTILS_H_
diff --git a/libeasclient/libeasmail.c b/libeasclient/libeasmail.c
index e6d3f6d..f9219b4 100644
--- a/libeasclient/libeasmail.c
+++ b/libeasclient/libeasmail.c
@@ -346,23 +346,6 @@ cleanup:
return ret;
}
-// TODO remove and use..._strfreev?
-static void
-free_string_array (gchar **array)
-{
- guint i = 0;
-
- if (array == NULL)
- return;
-
- while (array[i]) {
- g_free (array[i]);
- i++;
- }
- g_free (array);
-
-}
-
gboolean eas_mail_handler_get_item_estimate (EasEmailHandler* self,
const gchar *sync_key,
const gchar *folder_id, // folder to sync
@@ -587,9 +570,9 @@ eas_mail_handler_sync_folder_email_info (EasEmailHandler* self,
if (updatedSyncKey) {
g_free (updatedSyncKey);
}
- free_string_array (created_emailinfo_array);
- free_string_array (updated_emailinfo_array);
- free_string_array (deleted_emailinfo_array);
+ g_strfreev (created_emailinfo_array);
+ g_strfreev (updated_emailinfo_array);
+ g_strfreev (deleted_emailinfo_array);
if (!ret) { // failed - cleanup lists
g_assert (error == NULL || *error != NULL);
@@ -1289,9 +1272,9 @@ eas_mail_handler_sync_folder_email (EasEmailHandler* self,
}
}
- free_string_array (created_emailinfo_array);
- free_string_array (changed_emailinfo_array);
- free_string_array (deleted_emailinfo_array);
+ g_strfreev (created_emailinfo_array);
+ g_strfreev (changed_emailinfo_array);
+ g_strfreev (deleted_emailinfo_array);
// free the delete_emails array
for (loop = 0; loop < delete_list_length; ++loop) {
diff --git a/libeasclient/libeassync.c b/libeasclient/libeassync.c
index 6d96b9d..eee547b 100644
--- a/libeasclient/libeassync.c
+++ b/libeasclient/libeassync.c
@@ -181,17 +181,6 @@ eas_sync_handler_get_folder_list (EasSyncHandler *self,
return ret;
}
-static void
-free_string_array (gchar **array)
-{
- guint i = 0;
- while (array && array[i]) {
- g_free (array[i]);
- i++;
- }
- g_free (array);
-
-}
#define eas_gdbus_sync_call(self, ...) eas_gdbus_call(&(self)->priv->eas_client,
EAS_SERVICE_SYNC_OBJECT_PATH, EAS_SERVICE_SYNC_INTERFACE, __VA_ARGS__)
gboolean eas_sync_handler_get_items (EasSyncHandler* self,
@@ -285,9 +274,9 @@ gboolean eas_sync_handler_get_items (EasSyncHandler* self,
}
- free_string_array (created_item_array);
- free_string_array (updated_item_array);
- free_string_array (deleted_item_array);
+ g_strfreev (created_item_array);
+ g_strfreev (updated_item_array);
+ g_strfreev (deleted_item_array);
if (!ret) { // failed - cleanup lists
if (*items_created) {
@@ -376,7 +365,7 @@ eas_sync_handler_delete_items (EasSyncHandler* self,
g_debug ("delete_items called successfully");
}
- free_string_array (deleted_items_array);
+ g_strfreev (deleted_items_array);
g_debug ("eas_sync_handler_delete_items--");
return ret;
}
@@ -429,7 +418,7 @@ eas_sync_handler_update_items (EasSyncHandler* self,
g_debug ("update_calendar_items called successfully");
}
- free_string_array (updated_item_array);
+ g_strfreev (updated_item_array);
g_debug ("eas_sync_handler_update_items--");
return ret;
}
@@ -538,8 +527,8 @@ eas_sync_handler_add_items (EasSyncHandler* self,
}
}
- free_string_array (added_item_array);
- free_string_array (created_item_array);
+ g_strfreev (added_item_array);
+ g_strfreev (created_item_array);
g_debug ("eas_sync_handler_add_items--");
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]