Simple example showing the sg_strmap
feature.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int map_sort(__SG_UNUSED
void *cls,
struct sg_strmap *pair_a,
}
static int map_iter(__SG_UNUSED
void *cls,
struct sg_strmap *pair) {
printf("\t%c: %s\n", *name, name);
return 0;
}
static void chat(
struct sg_strmap **map,
const char *name,
const char *msg) {
}
int main(void) {
chat(&map, "Clecio", "Hello!");
chat(&map, "Paim", "Hello. How are you?");
chat(&map, "Clecio", "I'm fine. And you?");
chat(&map, "Paim", "Me too.");
printf("\nChatters:\n");
return EXIT_SUCCESS;
}
int sg_strmap_iter(struct sg_strmap *map, sg_strmap_iter_cb cb, void *cls)
int sg_strmap_set(struct sg_strmap **map, const char *name, const char *val)
const char * sg_strmap_val(struct sg_strmap *pair)
const char * sg_strmap_name(struct sg_strmap *pair)
int sg_strmap_sort(struct sg_strmap **map, sg_strmap_sort_cb cb, void *cls)
int sg_strmap_find(struct sg_strmap *map, const char *name, struct sg_strmap **pair)
void sg_strmap_cleanup(struct sg_strmap **map)