annotate dowa/d_memory.c @ 14:0570ada19343

misc file removal.
author June Park <parkjune1995@gmail.com>
date Thu, 02 Oct 2025 14:41:06 -0700
parents 1e61008b9980
children fa2b8af609d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
1 #include "dowa.h"
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
2
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
3 // --- Arena --- //
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
4 Dowa_PArena Dowa_Arena_Create(size_t capacity)
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
5 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
6 Dowa_PArena p_arena = malloc(sizeof(Dowa_Arena));
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
7 if (p_arena == NULL)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
8 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
9 perror("malloc");
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
10 return NULL;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
11 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
12 p_arena->buffer = malloc(capacity);
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
13 p_arena->offset = 0;
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
14 p_arena->capacity = capacity;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
15 return p_arena;
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
16 }
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
17
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
18 void *Dowa_Arena_Allocate(Dowa_PArena p_arena, size_t size)
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
19 {
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
20 if (p_arena->offset + size > p_arena->capacity)
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
21 {
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
22 return NULL;
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
23 }
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
24 void *currnet_ptr = p_arena->buffer + p_arena->offset;
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
25 p_arena->offset += size;
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
26 return currnet_ptr;
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
27 }
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
28
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
29 void Dowa_Arena_Free(Dowa_PArena p_arena)
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
30 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
31 if (p_arena)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
32 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
33 if (p_arena->buffer)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
34 free(p_arena->buffer);
1
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
35 free(p_arena);
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
36 }
adcfad6e86fb Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff changeset
37 }
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
38
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
39 // --- HashMap --- //
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
40 Dowa_PHashMap Dowa_HashMap_Create(size_t capacity)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
41 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
42 Dowa_PHashMap p_hash_map;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
43 p_hash_map = malloc(sizeof(Dowa_HashMap));
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
44 if (p_hash_map == NULL)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
45 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
46 return NULL;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
47 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
48 p_hash_map->entries = calloc(capacity, sizeof(*p_hash_map->entries));
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
49 if (p_hash_map->entries == NULL)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
50 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
51 free(p_hash_map);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
52 return NULL;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
53 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
54 p_hash_map->capacity = capacity;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
55 p_hash_map->current_capacity = 0;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
56 return p_hash_map;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
57 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
58
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
59 void Dowa_HashMap_Free(Dowa_PHashMap p_hash_map)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
60 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
61 if (p_hash_map)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
62 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
63 Dowa_PHashEntry entry;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
64 if (p_hash_map->entries)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
65 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
66 for (int idx=0; idx<p_hash_map->capacity; idx++)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
67 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
68 entry = p_hash_map->entries[idx];
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
69 if (entry)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
70 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
71 free(entry->key);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
72 free(entry->buffer);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
73 free(entry);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
74 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
75 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
76 free(p_hash_map->entries);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
77 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
78 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
79 free(p_hash_map);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
80 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
81
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
82 int32 Dowa_HashMap_GetPosition(Dowa_PHashMap p_hash_map, char *key)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
83 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
84 int32 hash_val = HASH_KEY_NUMBER;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
85 int32 c;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
86 while ((c = *key++))
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
87 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
88 hash_val = (hash_val << 5) + hash_val + c;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
89 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
90 return hash_val % p_hash_map->capacity;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
91 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
92
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
93 void *Dowa_HashMap_Get(Dowa_PHashMap p_hash_map, char *key)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
94 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
95 int idx_foo = Dowa_HashMap_GetPosition(p_hash_map, key);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
96 void *value = p_hash_map->entries[idx_foo];
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
97 if (strcmp(((Dowa_PHashEntry) value)->key, key) != 0)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
98 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
99 return NULL;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
100 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
101 return ((Dowa_PHashEntry) value)->buffer;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
102 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
103
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
104 int32 Dowa_HashMap_PushValueWithTypeNoCopy(Dowa_PHashMap p_hash_map, char *key, void *value, size_t value_size, Dowa_HashMap_ValueType type)
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
105 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
106 int idx = Dowa_HashMap_GetPosition(p_hash_map, key);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
107 Dowa_PHashEntry entry = p_hash_map->entries[idx];
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
108 if (entry)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
109 free(entry->buffer);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
110 else
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
111 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
112 entry = malloc(sizeof(Dowa_HashEntry));
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
113 if (entry == NULL) { perror("malloc"); return -1; }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
114
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
115 p_hash_map->entries[idx] = entry;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
116 p_hash_map->current_capacity++;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
117 entry->key = strdup(key);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
118 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
119 entry->buffer = value;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
120 entry->capacity = value_size;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
121 entry->type = type;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
122 return 0;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
123 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
124
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
125 int32 Dowa_HashMap_PushValueWithType(Dowa_PHashMap p_hash_map, char *key, void *value, size_t value_size, Dowa_HashMap_ValueType type)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
126 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
127 int idx = Dowa_HashMap_GetPosition(p_hash_map, key);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
128 Dowa_PHashEntry entry = p_hash_map->entries[idx];
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
129 if (entry)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
130 free(entry->buffer);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
131 else
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
132 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
133 entry = malloc(sizeof(Dowa_HashEntry));
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
134 if (entry == NULL) { perror("malloc"); return -1; }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
135
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
136 p_hash_map->entries[idx] = entry;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
137 p_hash_map->current_capacity++;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
138 entry->key = strdup(key);
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
139 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
140 entry->buffer = malloc(value_size);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
141 if (entry->buffer == NULL) { perror("malloc"); return -1; }
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
142 entry->capacity = value_size;
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
143 entry->type = type;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
144 memcpy(entry->buffer, value, value_size);
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
145 return 0;
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
146 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
147
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
148 void Dowa_HashMap_PushValue(Dowa_PHashMap p_hash_map, char *key, void *value, size_t value_size)
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
149 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
150 Dowa_HashMap_PushValueWithType(p_hash_map, key, value, value_size, DOWA_HASH_MAP_TYPE_BUFFER);
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
151 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
152
2
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
153 void Dowa_HashMap_PopKey(Dowa_PHashMap p_hash_map, char *key)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
154 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
155 int idx = Dowa_HashMap_GetPosition(p_hash_map, key);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
156 Dowa_PHashEntry entry = p_hash_map->entries[idx];
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
157 if (entry)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
158 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
159 free(entry->key);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
160 free(entry->buffer);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
161 free(entry);
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
162 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
163 p_hash_map->entries[idx] = NULL;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
164 if (p_hash_map->current_capacity > 0)
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
165 {
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
166 p_hash_map->current_capacity--;
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
167 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
168 }
8a43dedbe530 [Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents: 1
diff changeset
169
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
170 void Dowa_HashMap_Print(Dowa_PHashMap map)
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
171 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
172 printf("\n-----------\n\n");
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
173 for (size_t i = 0; i < map->capacity; ++i)
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
174 {
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
175 Dowa_PHashEntry e = map->entries[i];
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
176 if (!e) continue;
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
177 printf("%s: ", e->key);
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
178 switch (e->type)
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
179 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
180 case DOWA_HASH_MAP_TYPE_BUFFER:
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
181 {
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
182 unsigned char *p = e->buffer;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
183 for (size_t j = 0; j < e->capacity; ++j)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
184 {
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
185 printf("%02x", p[j]);
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
186 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
187 printf("\n");
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
188 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
189 break;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
190 case DOWA_HASH_MAP_TYPE_STRING:
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
191 {
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
192 printf("%s\n", (char*)e->buffer);
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
193 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
194 break;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
195 case DOWA_HASH_MAP_TYPE_HASHMAP:
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
196 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
197 printf("This is a hashmap with size of %zu, and pointer %p\n", (Dowa_PHashMap)e->capacity, (void *)e);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
198 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
199 break;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
200 case DOWA_HASH_MAP_TYPE_INT:
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
201 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
202 printf("%d\n", *(int32*)e->buffer);
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
203 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
204 break;
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
205 default:
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
206 {
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
207 printf("<unknown type>\n");
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
208 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
209 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
210 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
211 printf("-----------\n");
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
212 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
213
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
214 int Dowa_HashMap_Cache_Folder(Dowa_PHashMap map, const char *folder_path)
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
215 {
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
216 DIR *dir = opendir(folder_path);
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
217 if (!dir) { perror("opendir"); return -1; }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
218
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
219 struct dirent *entry;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
220 while ((entry = readdir(dir)))
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
221 {
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
222 // skip "." and ".."
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
223 if (entry->d_name[0] == '.' &&
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
224 (entry->d_name[1] == '\0' ||
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
225 (entry->d_name[1] == '.' && entry->d_name[2] == '\0')))
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
226 continue;
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
227
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
228 char fullpath[PATH_MAX];
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
229 snprintf(fullpath, sizeof fullpath, "%s/%s", folder_path, entry->d_name);
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
230
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
231 struct stat st;
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
232 if (stat(fullpath, &st) < 0) { perror("stat"); continue; }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
233
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
234 if (S_ISREG(st.st_mode))
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
235 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
236 size_t size = (size_t)st.st_size;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
237 FILE *f = fopen(fullpath, "rb");
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
238 if (!f) { perror("fopen"); continue; }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
239
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
240 void *buf = malloc(size);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
241 if (!buf) { perror("malloc"); fclose(f); closedir(dir); return -1; }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
242
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
243 if (fread(buf, 1, size, f) != size)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
244 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
245 perror("fread");
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
246 free(buf);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
247 fclose(f);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
248 continue;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
249 }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
250 fclose(f);
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
251
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
252 Dowa_HashMap_PushValueWithType(map, entry->d_name, buf, size, DOWA_HASH_MAP_TYPE_STRING);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
253 free(buf); // Dowa_HashMap_PushValue made its own copy
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
254 }
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
255 else if (S_ISDIR(st.st_mode))
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
256 {
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
257 Dowa_PHashMap p_child_map = Dowa_HashMap_Create(100);
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
258 if (!p_child_map)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
259 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
260 perror("Dowa_HashMap_Create");
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
261 return -1;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
262 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
263 if (Dowa_HashMap_Cache_Folder(p_child_map, fullpath) == -1)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
264 {
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
265 perror("Dowa_HashMap_Cache_Folder");
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
266 return -1;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
267 }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
268
6
1e61008b9980 [Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
269 // Should not copy as we malloced already.
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
270 if (Dowa_HashMap_PushValueWithTypeNoCopy(map, entry->d_name, p_child_map,
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
271 sizeof(p_child_map), DOWA_HASH_MAP_TYPE_HASHMAP) == -1)
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
272 {
6
1e61008b9980 [Seobeo] Updated seobeo so that API is more opinionated. Added my webpage./build.sh
June Park <parkjune1995@gmail.com>
parents: 5
diff changeset
273 Dowa_HashMap_Free(p_child_map);
5
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
274 return -1;
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
275 }
3e12bf044589 Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents: 3
diff changeset
276 }
3
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
277 }
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
278 closedir(dir);
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
279 return 0;
2758f5527d2b [Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents: 2
diff changeset
280 }