Make functions static if they can be
[nci.git] / util.h
blobe14728371996cb4a3d47b79bbcced3ce8bd2d8d4
1 #define BUCKET_NUM 32
3 typedef struct {
4 /* */
5 uint_fast8_t skipped_chars;
6 yajl_handle yh;
7 } curl_to_yajl_ctx;
9 /*
10 * Note that the map structure doesn't dup anything, yet does free
11 * everything. Once something is added as a key or value to the map,
12 * consider it freed. This is true even if the add was for a redundant
13 * key.
15 typedef struct {
16 /* */
17 char *k;
18 char **vs;
19 } entry;
20 typedef struct {
21 /* */
22 size_t es[BUCKET_NUM];
23 entry *e[BUCKET_NUM];
24 size_t num_values_per_entry;
25 } map;
26 typedef struct {
27 /* */
28 int idx_of_next_entry;
29 const char **field_names;
30 char *field0;
31 char **otherfields;
32 map *m;
33 unsigned int depth;
34 uint_fast8_t saw_message_key;
35 char *error_message;
36 } kve_y_ctx;
38 char *
39 get_auth_token(void);
40 char *
41 get_url_base(void);
43 int
44 key_value_extract(const char *path, const char *cookiejar_path, const
45 char **field_names, map *m);
47 int
48 map_add(map *m, char *k, char **vs);
50 void
51 map_clean(map *m);
53 char **
54 map_get(map *m, char *k);
56 void
57 map_get_keys(map *m, char ***out_k, size_t *out_num);
59 void
60 print_esc_0x22(const char *s);