}
+/**
+ * Remove all items in the container.
+ *
+ * @param md metadata to manipulate
+ */
+void
+GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
+{
+ struct MetaItem *item;
+
+ if (md == NULL)
+ return;
+ while (NULL != (item = md->items))
+ {
+ md->items = item->next;
+ meta_item_free (item);
+ }
+ GNUNET_free_non_null (md->sbuf);
+ memset (md, 0, sizeof (struct GNUNET_CONTAINER_MetaData));
+}
+
+
+
/**
* Test if two MDs are equal. We consider them equal if
* the meta types, formats and content match (we do not
{
struct MetaItem *pos;
+ if (md == NULL)
+ return 0;
if (iter == NULL)
return md->item_count;
pos = md->items;
{
struct MetaItem *pos;
+ if (md == NULL)
+ return NULL;
pos = md->items;
while (NULL != pos)
{
va_list args;
enum EXTRACTOR_MetaType type;
+ if (md == NULL)
+ return NULL;
ret = NULL;
va_start (args, md);
while (1)
struct MetaItem *pos;
struct MetaItem *match;
+ if (md == NULL)
+ return 0;
match = NULL;
pos = md->items;
while (NULL != pos)
- {
- if ( (0 == strncasecmp ("image/", pos->mime_type,
+ {
+ if ( (NULL != pos->mime_type) &&
+ (0 == strncasecmp ("image/", pos->mime_type,
strlen("image/"))) &&
(pos->format == EXTRACTOR_METAFORMAT_BINARY) )
{