Add key/value functions & data types

This commit is contained in:
Julien BLACHE
2010-09-18 17:15:41 +02:00
parent aa57931879
commit 33d51f0652
2 changed files with 165 additions and 0 deletions

View File

@@ -4,6 +4,20 @@
#include <stdint.h>
struct onekeyval {
char *name;
char *value;
struct onekeyval *next;
};
struct keyval {
struct onekeyval *head;
struct onekeyval *tail;
};
int
safe_atoi32(const char *str, int32_t *val);
@@ -22,6 +36,24 @@ safe_atou64(const char *str, uint64_t *val);
int
safe_hextou64(const char *str, uint64_t *val);
/* Key/value functions */
int
keyval_add(struct keyval *kv, const char *name, const char *value);
int
keyval_add_size(struct keyval *kv, const char *name, const char *value, size_t size);
void
keyval_remove(struct keyval *kv, const char *name);
const char *
keyval_get(struct keyval *kv, const char *name);
void
keyval_clear(struct keyval *kv);
char *
m_realpath(const char *pathname);