Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/01_dynamic_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#define EXTLIB_IMPL
#include "../extlib.h"

// Could also create this typedef with `Array` utility macro:
// typedef Array(StringSlice) Lines;
typedef struct {
StringSlice *items;
size_t size, capacity;
Expand All @@ -22,6 +24,8 @@ static int qsort_cmp(const void *a, const void *b) {
}

int main(void) {
// Could also define this dynamic array inline with:
// Array(StringSlice) lines = {0};
Lines lines = {0};
StringBuffer file = {0};

Expand Down
3 changes: 1 addition & 2 deletions examples/02_hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ int main(int argc, char **argv) {
StringSlice word = ss_split_once_ws(&file_slice);
if(word.size == 0) continue;

WordFreq *e;
hmap_get_default_ss(&words_freq, word, 0, &e);
WordFreq *e = hmap_get_default_ss(&words_freq, word, 0);
ASSERT(e != NULL, "default entry shouldn't be NULL");

e->value++;
Expand Down
Loading
Loading