site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

strings.h (757B)


      1 #ifndef STRINGS_H
      2 #define STRINGS_H
      3 
      4 #include <stdbool.h>
      5 #include <stddef.h>
      6 
      7 typedef struct {
      8   size_t size;
      9   size_t count;
     10   char **strings;
     11 } StringList;
     12 
     13 typedef struct StringMapEntry {
     14   char *key;
     15   char *value;
     16   struct StringMapEntry *next;
     17 } StringMapEntry;
     18 
     19 typedef struct {
     20   StringMapEntry *head;
     21 } StringMap;
     22 
     23 StringList *init_string_list(size_t size);
     24 void string_list_append(StringList *string_list, char *string);
     25 char *str_replace(const char *str, const char *old_sub, const char *new_sub);
     26 char *trim_whitespace(const char *str);
     27 StringMap *string_map_create(void);
     28 void string_map_put(StringMap *map, char *key, char *value);
     29 char *string_map_get(StringMap *map, char *key);
     30 bool string_map_contains(StringMap *map, char *key);
     31 
     32 #endif