#include <stdbool.h>
Go to the source code of this file.
Functions | |
struct metadata * | metadata_new () |
Create a new empty metadata structure. | |
void | metadata_delete (struct metadata *s) |
Deleta a metadata structure. | |
const char * | metadata_lookup (struct metadata *s, const char *key) |
Look up a key in the metadata. | |
void | metadata_update (struct metadata *s, const char *key, const char *value) |
Update a key value pair in the metadata. | |
void | metadata_remove (struct metadata *s, const char *key) |
Remove a key from the metadata. | |
int | metadata_strlen (const struct metadata *s, const char *prefix) |
Find the length of the metadata concatenated to a string. | |
bool | metadata_string (const struct metadata *s, const char *prefix, char *string, int length) |
Concatenate the metadata to a string. |
void metadata_delete | ( | struct metadata * | s | ) |
Deleta a metadata structure.
s | The metadata structure. |
Definition at line 31 of file metadata.c.
References metadata::head, metadata_node::key, metadata_node::next, metadata_node::prev, and metadata_node::value.
Referenced by collect_metadata_to_string().
const char* metadata_lookup | ( | struct metadata * | s, |
const char * | key | ||
) |
Look up a key in the metadata.
If the key
is found, return the value
, otherwise 0
.
s | The metadata structure. |
key | The key. |
Definition at line 55 of file metadata.c.
References metadata_find(), and metadata_node::value.
|
read |
Create a new empty metadata structure.
Definition at line 24 of file metadata.c.
References metadata::head, metadata_node::next, metadata_node::prev, and metadata::tail.
Referenced by collect_metadata_to_string().
void metadata_remove | ( | struct metadata * | s, |
const char * | key | ||
) |
Remove a key from the metadata.
If the key
is found, remove it and its value
.
s | The metadata structure. |
key | The key. |
Definition at line 79 of file metadata.c.
References metadata_node::key, metadata_find(), metadata_node::next, metadata_node::prev, and metadata_node::value.
bool metadata_string | ( | const struct metadata * | s, |
const char * | prefix, | ||
char * | string, | ||
int | length | ||
) |
Concatenate the metadata to a string.
s | The metadata structure. |
prefix | A prefix to prepend to each line. |
string | A buffer to write into. |
length | The length of the buffer. |
true
if there was enough space, false
otherwise. Definition at line 101 of file metadata.c.
References metadata::head, metadata_node::key, metadata_node::next, and metadata_node::value.
Referenced by collect_metadata_to_string().
int metadata_strlen | ( | const struct metadata * | s, |
const char * | prefix | ||
) |
Find the length of the metadata concatenated to a string.
s | The metadata structure. |
prefix | A prefix to prepend to each line. |
Definition at line 91 of file metadata.c.
References metadata::head, metadata_node::key, metadata_node::next, and metadata_node::value.
Referenced by collect_metadata_to_string().
void metadata_update | ( | struct metadata * | s, |
const char * | key, | ||
const char * | value | ||
) |
Update a key value pair in the metadata.
If the key
is found, replace the value
. Otherwise append the key value pair.
s | The metadata structure. |
key | The key. Must not contain white space. |
value | The value. Must not contain newlines. |
Definition at line 63 of file metadata.c.
References metadata_node::key, metadata_find(), metadata_node::next, metadata_node::prev, metadata::tail, and metadata_node::value.
Referenced by collect_metadata_to_string().