katze_array_peek_items (KatzeArray* array);
extern GList* kalistglobal;
+/* KATZE_ARRAY_FOREACH_ITEM:
+ * @item: a #KatzeItem variable
+ * @array: a #KatzeArray to loop through
+ *
+ * Loops through all items of the array. The macro can
+ * be used like a for() loop.
+ * If the array is modified during the loop, you must
+ * use KATZE_ARRAY_FOREACH_ITEM_L instead.
+ * */
#define KATZE_ARRAY_FOREACH_ITEM(kaitem, kaarray) \
for (kalistglobal = katze_array_peek_items (kaarray), \
kaitem = kalistglobal ? kalistglobal->data : NULL; \
kalistglobal = g_list_next (kalistglobal), \
kaitem = kalistglobal ? kalistglobal->data : NULL)
+/* KATZE_ARRAY_FOREACH_ITEM_L:
+ * @item: a #KatzeItem variable
+ * @array: a #KatzeArray to loop through
+ * @list: a #GList variable
+ *
+ * Loops through all items of the array. The list must be freed.
+ *
+ * Since: 0.3.0
+ * */
+#define KATZE_ARRAY_FOREACH_ITEM_L(kaitem, kaarray, kalist) \
+ for (kalist = katze_array_get_items (kaarray), \
+ kaitem = kalist ? kalist->data : NULL; \
+ kalist != NULL; \
+ kalist = g_list_next (kalist), \
+ kaitem = kalist ? kalist->data : NULL)
+
void
katze_array_clear (KatzeArray* array);
KatzeArray* array,
const gchar* folder)
{
+ GList* list;
KatzeItem* item;
- KATZE_ARRAY_FOREACH_ITEM (item, array)
+ KATZE_ARRAY_FOREACH_ITEM_L (item, array, list)
{
if (KATZE_IS_ARRAY (item))
midori_bookmarks_import_array_db (db, KATZE_ARRAY (item), folder);
katze_item_set_meta_string (item, "folder", folder);
katze_array_add_item (array, item);
}
+ g_list_free (list);
}
static KatzeArray*