[couchdb-glib] Added some _free methods
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Subject: [couchdb-glib] Added some _free methods
- Date: Thu, 11 Jun 2009 11:25:08 -0400 (EDT)
commit 5f821e9bca4ddd345d0ba4fc32503000583ca539
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Thu Jun 11 17:24:55 2009 +0200
Added some _free methods
couchdb-glib/couchdb-glib.h | 7 ++++---
couchdb-glib/couchdb.c | 18 ++++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/couchdb-glib/couchdb-glib.h b/couchdb-glib/couchdb-glib.h
index eaf693a..bb5f8d4 100644
--- a/couchdb-glib/couchdb-glib.h
+++ b/couchdb-glib/couchdb-glib.h
@@ -43,7 +43,8 @@ CouchDB *couchdb_new (const char *hostname);
* Databases API
*/
-GSList *couchdb_list_databases (CouchDB *couchdb, GError **error);
+GSList *couchdb_list_databases (CouchDB *couchdb, GError **error);
+void couchdb_free_database_list (GSList *dblist);
typedef struct {
char *dbname;
@@ -60,8 +61,6 @@ void couchdb_free_database_info (CouchDBDatabaseInfo *dbinfo);
gboolean couchdb_create_database (CouchDB *couchdb, const char *dbname, GError **error);
gboolean couchdb_delete_database (CouchDB *couchdb, const char *dbname, GError **error);
-void couchdb_free_database_list (GSList *dblist);
-
/*
* Documents API
*/
@@ -83,6 +82,8 @@ typedef struct {
} CouchDBDocumentClass;
GSList *couchdb_list_documents (CouchDB *couchdb, const char *dbname, GError **error);
+void couchdb_free_document_list (GSList *doclist);
+void couchdb_free_document_info (CouchDBDocumentInfo *docinfo);
CouchDBDocument *couchdb_document_new (CouchDB *couchdb);
CouchDBDocument *couchdb_document_get (CouchDB *couchdb,
diff --git a/couchdb-glib/couchdb.c b/couchdb-glib/couchdb.c
index 01bfa13..f5d4c3d 100644
--- a/couchdb-glib/couchdb.c
+++ b/couchdb-glib/couchdb.c
@@ -260,3 +260,21 @@ couchdb_list_documents (CouchDB *couchdb, const char *dbname, GError **error)
return doclist;
}
+
+void
+couchdb_free_document_list (GSList *doclist)
+{
+ g_return_if_fail (doclist != NULL);
+
+ g_slist_foreach (doclist, (GFunc) couchdb_free_document_info, NULL);
+ g_slist_free (doclist);
+}
+
+void
+couchdb_free_document_info (CouchDBDocumentInfo *docinfo)
+{
+ g_return_if_fail (docinfo != NULL);
+
+ g_free (docinfo->docid);
+ g_free (docinfo->current_revision);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]