Mercurial
annotate dowa/d_memory.c @ 170:7fce234bfdca
Closing old fzf head
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 19 Jan 2026 17:35:39 -0800 |
| parents | 636eab07809d |
| children | a30944e5719e |
| 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); |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
13 if (p_arena->buffer == NULL) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
14 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
15 perror("malloc"); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
16 Dowa_Free(p_arena); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
17 return NULL; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
18 } |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
19 p_arena->offset = 0; |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
20 p_arena->capacity = capacity; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
21 return p_arena; |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
22 } |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
23 |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
24 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
|
25 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
26 if (!p_arena || !p_arena->buffer || size == 0) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
27 return NULL; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
28 |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
29 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
|
30 { |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
31 return NULL; |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
32 } |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
33 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
|
34 p_arena->offset += size; |
|
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
35 return currnet_ptr; |
|
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 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
38 void Dowa_Arena_Destroy(Dowa_PArena p_arena) |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
39 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
40 if (!p_arena) return; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
41 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
42 if (p_arena->buffer) |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
43 Dowa_Free(p_arena->buffer); |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
44 Dowa_Free(p_arena); |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
45 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
46 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
47 void *Dowa_Arena_Copy(Dowa_PArena p_arena, const void *src, size_t size) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
48 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
49 if (p_arena == NULL || src == NULL || size == 0) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
50 return NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
51 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
52 void *dest = Dowa_Arena_Allocate(p_arena, size); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
53 if (!dest) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
54 return NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
55 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
56 memcpy(dest, src, size); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
57 return dest; |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
58 } |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
59 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
60 void Dowa_Arena_Reset(Dowa_PArena p_arena) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
61 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
62 if (!p_arena) return; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
63 p_arena->offset = 0; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
64 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
65 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
66 size_t Dowa_Arena_Get_Used(Dowa_PArena p_arena) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
67 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
68 if (!p_arena) return 0; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
69 return p_arena->offset; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
70 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
71 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
72 size_t Dowa_Arena_Get_Remaining(Dowa_PArena p_arena) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
73 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
74 if (!p_arena) return 0; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
75 return p_arena->capacity - p_arena->offset; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
76 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
77 |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
78 // --- HashMap --- // |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
79 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
|
80 { |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
81 Dowa_PHashMap p_hash_map; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
82 p_hash_map = malloc(sizeof(Dowa_HashMap)); |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
83 if (p_hash_map == NULL) |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
84 { |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
85 return NULL; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
86 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
87 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
|
88 if (p_hash_map->entries == NULL) |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
89 { |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
90 Dowa_Free(p_hash_map); |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
91 return NULL; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
92 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
93 p_hash_map->capacity = capacity; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
94 p_hash_map->current_capacity = 0; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
95 p_hash_map->p_arena = NULL; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
96 return p_hash_map; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
97 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
98 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
99 Dowa_PHashMap Dowa_HashMap_Create_With_Arena(size_t capacity, Dowa_PArena p_arena) |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
100 { |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
101 if (p_arena == NULL) |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
102 { |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
103 printf("Arena is NULL\n"); |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
104 return Dowa_HashMap_Create(capacity); |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
105 } |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
106 |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
107 Dowa_PHashMap p_hash_map; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
108 p_hash_map = Dowa_Arena_Allocate(p_arena, sizeof(Dowa_HashMap)); |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
109 if (p_hash_map == NULL) |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
110 { |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
111 return NULL; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
112 } |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
113 p_hash_map->entries = Dowa_Arena_Allocate(p_arena, sizeof(*p_hash_map->entries) * capacity); |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
114 if (p_hash_map->entries == NULL) |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
115 { |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
116 return NULL; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
117 } |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
118 memset(p_hash_map->entries, 0, capacity * sizeof *p_hash_map->entries); |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
119 p_hash_map->capacity = capacity; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
120 p_hash_map->current_capacity = 0; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
121 p_hash_map->p_arena = p_arena; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
122 return p_hash_map; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
123 } |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
124 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
125 void Dowa_HashMap_Destroy(Dowa_PHashMap p_hash_map) |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
126 { |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
127 if (!p_hash_map) return; |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
128 |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
129 if (p_hash_map->p_arena) |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
130 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
131 // Free arena instead of the map... |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
132 // Dowa_Arena_Destroy(p_hash_map->p_arena); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
133 return; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
134 } |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
135 else |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
136 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
137 Dowa_PHashEntry entry; |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
138 Dowa_PHashEntry next; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
139 if (p_hash_map->entries) |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
140 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
141 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
|
142 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
143 entry = p_hash_map->entries[idx]; |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
144 while (entry) |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
145 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
146 next = entry->next; |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
147 Dowa_Free(entry->key); |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
148 Dowa_Free(entry->buffer); |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
149 Dowa_Free(entry); |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
150 entry = next; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
151 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
152 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
153 } |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
154 Dowa_Free(p_hash_map->entries); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
155 } |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
156 Dowa_Free(p_hash_map); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
157 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
158 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
159 int32 Dowa_HashMap_Get_Position(Dowa_PHashMap p_hash_map, const char *key) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
160 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
161 if (!p_hash_map || !key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
162 return -1; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
163 |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
164 int32 hash_val = HASH_KEY_NUMBER; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
165 int32 c; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
166 while ((c = *key++)) |
|
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 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
|
169 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
170 return hash_val % p_hash_map->capacity; |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
171 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
172 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
173 void *Dowa_HashMap_Get(Dowa_PHashMap p_hash_map, const char *key) |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
174 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
175 if (!p_hash_map || !key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
176 return NULL; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
177 |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
178 int idx = Dowa_HashMap_Get_Position(p_hash_map, key); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
179 Dowa_PHashEntry entry = p_hash_map->entries[idx]; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
180 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
181 while (entry) |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
182 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
183 if (strcmp(entry->key, key) == 0) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
184 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
185 return entry->buffer; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
186 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
187 entry = entry->next; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
188 } |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
189 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
190 return NULL; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
191 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
192 |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
193 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
194 int32 Dowa_HashMap_Push_Value_With_Type_NoCopy(Dowa_PHashMap p_hash_map, const char *key, |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
195 void *value, size_t value_size, |
|
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
196 Dowa_HashMap_ValueType type) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
197 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
198 if (!p_hash_map || !key || !value) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
199 return -1; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
200 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
201 int idx = Dowa_HashMap_Get_Position(p_hash_map, key); |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
202 Dowa_PHashEntry entry = p_hash_map->entries[idx]; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
203 Dowa_PHashEntry prev = NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
204 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
205 // Old key |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
206 while (entry) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
207 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
208 if (strcmp(entry->key, key) == 0) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
209 { |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
210 // Fails if it the key exists... |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
211 return -1; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
212 } |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
213 prev = entry; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
214 entry = entry->next; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
215 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
216 |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
217 // Overriding doesn't really make sense? when copying over |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
218 // as we need to free it. |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
219 // |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
220 //while (entry) |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
221 //{ |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
222 // if (strcmp(entry->key, key) == 0) |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
223 // { |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
224 // if (!p_hash_map->p_arena && entry->buffer) |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
225 // Dowa_Free(entry->buffer); |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
226 // entry->buffer = value; |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
227 // entry->capacity = value_size; |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
228 // entry->type = type; |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
229 // return 0; |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
230 // } |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
231 // prev = entry; |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
232 // entry = entry->next; |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
233 //} |
|
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
234 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
235 // New Key |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
236 entry = p_hash_map->p_arena ? |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
237 Dowa_Arena_Allocate(p_hash_map->p_arena, sizeof(Dowa_HashEntry)) : |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
238 malloc(sizeof(Dowa_HashEntry)); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
239 if (!entry) { perror("malloc or arena alloc"); return -1; } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
240 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
241 entry->key = p_hash_map->p_arena ? |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
242 Dowa_Arena_Copy(p_hash_map->p_arena, key, strlen(key) + 1 /* \0 */) : |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
243 strdup(key); |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
244 if (!entry->key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
245 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
246 perror("strdup or arena copy"); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
247 if (!p_hash_map->p_arena) Dowa_Free(entry); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
248 return -1; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
249 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
250 entry->buffer = value; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
251 entry->capacity = value_size; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
252 entry->type = type; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
253 entry->next = NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
254 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
255 if (prev) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
256 prev->next = entry; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
257 else |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
258 p_hash_map->entries[idx] = entry; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
259 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
260 p_hash_map->current_capacity++; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
261 return 0; |
|
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 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
264 int32 Dowa_HashMap_Push_Value_With_Type(Dowa_PHashMap p_hash_map, const char *key, |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
265 void *value, size_t value_size, |
|
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
266 Dowa_HashMap_ValueType type) |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
267 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
268 if (!p_hash_map || !key || !value) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
269 return -1; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
270 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
271 int idx = Dowa_HashMap_Get_Position(p_hash_map, key); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
272 Dowa_PHashEntry entry = p_hash_map->entries[idx]; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
273 Dowa_PHashEntry prev = NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
274 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
275 // Check for existing key |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
276 while (entry) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
277 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
278 if (strcmp(entry->key, key) == 0) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
279 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
280 if (!p_hash_map->p_arena && entry->buffer) |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
281 Dowa_Free(entry->buffer); |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
282 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
283 entry->buffer = p_hash_map->p_arena ? |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
284 Dowa_Arena_Allocate(p_hash_map->p_arena, value_size) : |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
285 malloc(value_size); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
286 if (!entry->buffer) { perror("malloc or arena alloc"); return -1; } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
287 |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
288 memcpy(entry->buffer, value, value_size); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
289 entry->capacity = value_size; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
290 entry->type = type; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
291 return 0; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
292 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
293 prev = entry; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
294 entry = entry->next; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
295 } |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
296 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
297 // New Key |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
298 entry = p_hash_map->p_arena ? |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
299 Dowa_Arena_Allocate(p_hash_map->p_arena, sizeof(Dowa_HashEntry)) : |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
300 malloc(sizeof(Dowa_HashEntry)); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
301 if (!entry) { perror("malloc or arena alloc"); return -1; } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
302 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
303 entry->key = p_hash_map->p_arena ? |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
304 Dowa_Arena_Copy(p_hash_map->p_arena, key, strlen(key) + 1 /* \0 */) : |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
305 strdup(key); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
306 if (!entry->key) { perror("strdup"); return -1; } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
307 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
308 entry->buffer = p_hash_map->p_arena ? |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
309 Dowa_Arena_Allocate(p_hash_map->p_arena, value_size) : |
|
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
310 malloc(value_size); |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
311 if (!entry->buffer) { perror("malloc or arena alloc"); return -1; } |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
312 |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
313 memcpy(entry->buffer, value, value_size); |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
314 entry->capacity = value_size; |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
315 entry->type = type; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
316 entry->next = NULL; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
317 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
318 if (prev) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
319 prev->next = entry; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
320 else |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
321 p_hash_map->entries[idx] = entry; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
322 |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
323 p_hash_map->current_capacity++; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
324 return 0; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
325 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
326 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
327 void Dowa_HashMap_Push_Value(Dowa_PHashMap p_hash_map, const char *key, void *value, size_t value_size) |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
328 { |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
329 Dowa_HashMap_Push_Value_With_Type(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
|
330 } |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
331 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
332 void Dowa_HashMap_Pop_Key(Dowa_PHashMap p_hash_map, const char *key) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
333 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
334 if (!p_hash_map || !key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
335 return; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
336 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
337 int idx = Dowa_HashMap_Get_Position(p_hash_map, key); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
338 Dowa_PHashEntry entry = p_hash_map->entries[idx]; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
339 Dowa_PHashEntry prev = NULL; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
340 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
341 while (entry) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
342 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
343 if (strcmp(entry->key, key) == 0) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
344 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
345 if (prev) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
346 prev->next = entry->next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
347 else |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
348 p_hash_map->entries[idx] = entry->next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
349 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
350 if (!(p_hash_map->p_arena)) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
351 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
352 Dowa_Free(entry->key); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
353 Dowa_Free(entry->buffer); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
354 Dowa_Free(entry); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
355 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
356 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
357 if (p_hash_map->current_capacity > 0) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
358 p_hash_map->current_capacity--; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
359 return; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
360 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
361 prev = entry; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
362 entry = entry->next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
363 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
364 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
365 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
366 boolean Dowa_HashMap_Has_Key(Dowa_PHashMap p_hash_map, const char *key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
367 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
368 if (!p_hash_map || !key) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
369 return FALSE; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
370 |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
371 int idx = Dowa_HashMap_Get_Position(p_hash_map, key); |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
372 Dowa_PHashEntry entry = p_hash_map->entries[idx]; |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
373 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
374 while (entry) |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
375 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
376 if (strcmp(entry->key, key) == 0) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
377 return TRUE; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
378 entry = entry->next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
379 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
380 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
381 return FALSE; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
382 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
383 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
384 void Dowa_HashMap_Clear(Dowa_PHashMap p_hash_map) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
385 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
386 if (!p_hash_map) return; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
387 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
388 if (p_hash_map->p_arena) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
389 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
390 for (int idx=0; idx<p_hash_map->capacity; idx++) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
391 p_hash_map->entries[idx] = NULL; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
392 } |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
393 else |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
394 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
395 Dowa_PHashEntry entry; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
396 Dowa_PHashEntry next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
397 if (p_hash_map->entries) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
398 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
399 for (int idx=0; idx<p_hash_map->capacity; idx++) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
400 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
401 entry = p_hash_map->entries[idx]; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
402 while (entry) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
403 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
404 next = entry->next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
405 Dowa_Free(entry->key); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
406 Dowa_Free(entry->buffer); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
407 Dowa_Free(entry); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
408 entry = next; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
409 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
410 p_hash_map->entries[idx] = NULL; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
411 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
412 } |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
413 } |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
414 p_hash_map->current_capacity = 0; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
415 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
416 |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
417 uint32 Dowa_HashMap_Get_Count(Dowa_PHashMap p_hash_map) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
418 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
419 if (!p_hash_map) return 0; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
420 return p_hash_map->current_capacity; |
|
2
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
421 } |
|
8a43dedbe530
[Dowa] Added HashMap and Updated Arena naming.
June Park <parkjune1995@gmail.com>
parents:
1
diff
changeset
|
422 |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
423 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
|
424 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
425 if (!map) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
426 { |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
427 printf("HashMap is NULL\n"); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
428 return; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
429 } |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
430 |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
431 printf("\n-----------\n\n"); |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
432 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
|
433 { |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
434 Dowa_PHashEntry e = map->entries[i]; |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
435 while (e) |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
436 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
437 if (!e) break; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
438 printf("%s: ", e->key); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
439 switch (e->type) |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
440 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
441 case DOWA_HASH_MAP_TYPE_BUFFER: |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
442 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
443 unsigned char *p = e->buffer; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
444 for (size_t j = 0; j < e->capacity; ++j) |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
445 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
446 printf("%02x", p[j]); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
447 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
448 printf("\n"); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
449 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
450 break; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
451 case DOWA_HASH_MAP_TYPE_STRING: |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
452 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
453 printf("%s\n", (char*)e->buffer); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
454 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
455 break; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
456 case DOWA_HASH_MAP_TYPE_HASHMAP: |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
457 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
458 printf("This is a hashmap with size of %zu, and pointer %p\n", e->capacity, (void *)e); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
459 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
460 break; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
461 case DOWA_HASH_MAP_TYPE_INT: |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
462 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
463 printf("%d\n", *(int32*)e->buffer); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
464 } |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
465 break; |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
466 default: |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
467 { |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
468 printf("<unknown type>\n"); |
|
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
469 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
470 } |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
471 e = e->next; |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
472 } |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
473 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
474 printf("-----------\n"); |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
475 } |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
476 |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
477 int Dowa_HashMap_Cache_Folder(Dowa_PHashMap p_hash_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
|
478 { |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
479 if (!p_hash_map || !folder_path) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
480 return -1; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
481 |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
482 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
|
483 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
|
484 |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
485 struct dirent *entry; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
486 while ((entry = readdir(dir))) |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
487 { |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
488 // skip "." and ".." |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
489 if (entry->d_name[0] == '.' && |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
490 (entry->d_name[1] == '\0' || |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
491 (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
|
492 continue; |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
493 |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
494 char fullpath[PATH_MAX]; |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
495 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
|
496 |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
497 struct stat st; |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
498 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
|
499 |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
500 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
|
501 { |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
502 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
|
503 FILE *f = fopen(fullpath, "rb"); |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
504 if (!f) { perror("fopen"); continue; } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
505 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
506 void *buf = p_hash_map->p_arena ? |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
507 Dowa_Arena_Allocate(p_hash_map->p_arena, size + 1) : |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
508 malloc(size + 1); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
509 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
|
510 |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
511 |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
512 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
|
513 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
514 perror("fread"); |
|
36
84672efec192
[Zenbu] WIP fixing issues regarding to using edge only. I think there is a problem where socket closes before sending back the info.
MrJuneJune <me@mrjunejune.com>
parents:
32
diff
changeset
|
515 if (!p_hash_map->p_arena) Dowa_Free(buf); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
516 fclose(f); |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
517 continue; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
518 } |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
519 fclose(f); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
520 |
|
52
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
521 ((char *)buf)[size] = '\0'; |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
522 Dowa_HashMap_Push_Value_With_Type(p_hash_map, entry->d_name, buf, size + 1, DOWA_HASH_MAP_TYPE_STRING); |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
523 if (!p_hash_map->p_arena) |
|
636eab07809d
Fixed dowa memory problems. Add few more utility functions.
June Park <parkjune1995@gmail.com>
parents:
36
diff
changeset
|
524 Dowa_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
|
525 } |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
526 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
|
527 { |
|
22
947b81010aba
[Dowa & Seobeo] Updated so that Dowa hashmaps can use arena and not be broken. Split up web so taht it can handle different paths. Also fixes issues with hash collisions which was pain in the ass.
June Park <parkjune1995@gmail.com>
parents:
21
diff
changeset
|
528 // TODO: Adjust the sizes of the recursive map? |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
529 Dowa_PHashMap p_child_map = Dowa_HashMap_Create_With_Arena(100, p_hash_map->p_arena); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
530 if (!p_child_map) |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
531 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
532 perror("Dowa_HashMap_Create"); |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
533 return -1; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
534 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
535 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
|
536 { |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
537 perror("Dowa_HashMap_Cache_Folder"); |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
538 return -1; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
539 } |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
540 |
|
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
|
541 // Should not copy as we malloced already. |
|
20
0a9e67c7039a
[Seobeo] Chaning Function naming to be easily readable.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
542 if (Dowa_HashMap_Push_Value_With_Type_NoCopy(p_hash_map, entry->d_name, p_child_map, |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
543 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
|
544 { |
|
21
09def63429b9
[Dowa] Updated the naming scheme and tests.
June Park <parkjune1995@gmail.com>
parents:
20
diff
changeset
|
545 Dowa_HashMap_Destroy(p_child_map); |
|
5
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
546 return -1; |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
547 } |
|
3e12bf044589
Fixed Dowa hashmap to recursively add files into memory.
June Park <parkjune1995@gmail.com>
parents:
3
diff
changeset
|
548 } |
|
3
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
549 } |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
550 closedir(dir); |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
551 return 0; |
|
2758f5527d2b
[Seobeo] Working on simple TCP server and client logic.
June Park <parkjune1995@gmail.com>
parents:
2
diff
changeset
|
552 } |