diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_container_lib.h | 9 | ||||
-rw-r--r-- | src/util/container_meta_data.c | 23 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 1ac6cd4ed..e35ad1b74 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -295,6 +295,15 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, | |||
295 | 295 | ||
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Remove all items in the container. | ||
299 | * | ||
300 | * @param md metadata to manipulate | ||
301 | */ | ||
302 | void | ||
303 | GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); | ||
304 | |||
305 | |||
306 | /** | ||
298 | * Add the current time as the publication date | 307 | * Add the current time as the publication date |
299 | * to the meta-data. | 308 | * to the meta-data. |
300 | * | 309 | * |
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index f39b15930..dd7165ba9 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c | |||
@@ -170,6 +170,29 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md) | |||
170 | 170 | ||
171 | 171 | ||
172 | /** | 172 | /** |
173 | * Remove all items in the container. | ||
174 | * | ||
175 | * @param md metadata to manipulate | ||
176 | */ | ||
177 | void | ||
178 | GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md) | ||
179 | { | ||
180 | struct MetaItem *item; | ||
181 | |||
182 | if (md == NULL) | ||
183 | return; | ||
184 | while (NULL != (item = md->items)) | ||
185 | { | ||
186 | md->items = item->next; | ||
187 | meta_item_free (item); | ||
188 | } | ||
189 | GNUNET_free_non_null (md->sbuf); | ||
190 | memset (md, 0, sizeof (struct GNUNET_CONTAINER_MetaData)); | ||
191 | } | ||
192 | |||
193 | |||
194 | |||
195 | /** | ||
173 | * Test if two MDs are equal. We consider them equal if | 196 | * Test if two MDs are equal. We consider them equal if |
174 | * the meta types, formats and content match (we do not | 197 | * the meta types, formats and content match (we do not |
175 | * include the mime types and plugins names in this | 198 | * include the mime types and plugins names in this |