diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2010-12-12 14:34:59 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2010-12-12 14:34:59 +0100 |
| commit | 1089f1fcf55591dd4b5d47ee963bfe0e24cf9ad5 (patch) | |
| tree | 73d80ec6674e9a625fe5c7f1fcbb30fdcf15d644 /src/items.c | |
| parent | 3e213519e67c3f9665a4eb1635f5ef37d7171809 (diff) | |
| download | cataract-1089f1fcf55591dd4b5d47ee963bfe0e24cf9ad5.tar.xz | |
items: Cleanup
Diffstat (limited to 'src/items.c')
| -rw-r--r-- | src/items.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/items.c b/src/items.c index ea0e4e9..b31e9cd 100644 --- a/src/items.c +++ b/src/items.c @@ -72,8 +72,8 @@ free_album_item (TIndexItem *item) /* * parse_album_xml: XML parser for gallery index.xml files */ -gboolean -parse_album_xml (const gchar *filename, TAlbum *index) +TAlbum * +parse_album_xml (const gchar *filename) { TXMLFile *xml; gchar *gallery_type; @@ -83,11 +83,13 @@ parse_album_xml (const gchar *filename, TAlbum *index) gchar *node_name; TIndexItem *item; TAtomFeedItem *feed_item; + TAlbum *index; xml = xml_parser_load (filename); if (xml == NULL) - return FALSE; + return NULL; + index = g_malloc0 (sizeof (TAlbum)); index->base_dir = g_path_get_dirname (filename); /* Retrieve gallery type */ @@ -100,8 +102,8 @@ parse_album_xml (const gchar *filename, TAlbum *index) else { log_error ("Invalid gallery type (%s)\n", gallery_type); g_free (gallery_type); - g_free (index); - return FALSE; + free_album_data (index); + return NULL; } g_free (gallery_type); @@ -175,8 +177,7 @@ parse_album_xml (const gchar *filename, TAlbum *index) if (! node_name) continue; - item = malloc (sizeof (TIndexItem)); - memset (item, 0, sizeof (TIndexItem)); + item = g_malloc0 (sizeof (TIndexItem)); if (strcmp (node_name, "item") == 0) { item->type = INDEX_ITEM_TYPE_PICTURE; @@ -279,7 +280,7 @@ parse_album_xml (const gchar *filename, TAlbum *index) } xml_parser_close (xml); - return TRUE; + return index; } |
