fix hashmap to list missing items when they are in the same position in the list

This commit is contained in:
William Bell
2025-11-04 18:10:19 +00:00
parent 51c6bdcea9
commit 3e3df5595e
4 changed files with 20 additions and 73 deletions

View File

@@ -16,12 +16,15 @@ class ArgonConan(ConanFile):
# Remove tool_requires, no flex from Conan
requires = [
"gmp/6.3.0",
"bdwgc/8.2.8"
"bdwgc/8.2.6"
]
default_options = {
"gmp/*:shared": False,
"bdwgc/*:shared": False
"bdwgc/*:shared": False,
"bdwgc/*:parallel_mark": False,
"bdwgc/*:threads": True,
"bdwgc/*:disable_debug": True,
}
def layout(self):

View File

@@ -27,13 +27,15 @@ struct hashmap_GC *createHashmap_GC() {
}
static int compare_node_asc(const void *a, const void *b) {
const struct node_GC *na = (const struct node_GC *)a;
const struct node_GC *nb = (const struct node_GC *)b;
const struct node_GC *na = (const struct node_GC *)a;
const struct node_GC *nb = (const struct node_GC *)b;
// Ascending order (smallest order first)
if (na->order < nb->order) return -1;
if (na->order > nb->order) return 1;
return 0;
// Ascending order (smallest order first)
if (na->order < nb->order)
return -1;
if (na->order > nb->order)
return 1;
return 0;
}
void hashmap_GC_to_array(struct hashmap_GC *t, struct node_GC **array,
@@ -51,13 +53,16 @@ void hashmap_GC_to_array(struct hashmap_GC *t, struct node_GC **array,
}
for (size_t i = 0; i < t->size; i++) {
if (!t->list[i])
continue;
if (*array_length >= array_size) {
array_size *= 2;
*array = ar_realloc(*array, array_size * sizeof(struct node_GC));
}
(*array)[(*array_length)++] = *t->list[i];
struct node_GC *list = t->list[i];
struct node_GC *temp = list;
while (temp) {
(*array)[(*array_length)++] = *t->list[i];
temp = temp->next;
}
}
qsort(*array, *array_length, sizeof(struct node_GC), compare_node_asc);

View File

@@ -1,64 +1,3 @@
let knownContentTypes = {}
knownContentTypes["html"] = "text/html"
knownContentTypes["css"] = "text/css"
knownContentTypes["js"] = "application/javascript"
knownContentTypes["json"] = "application/json"
knownContentTypes["png"] = "image/png"
knownContentTypes["jpg"] = "image/jpeg"
knownContentTypes["jpeg"] = "image/jpeg"
knownContentTypes["gif"] = "image/gif"
knownContentTypes["svg"] = "image/svg+xml"
knownContentTypes["ico"] = "image/x-icon"
knownContentTypes["txt"] = "text/plain"
knownContentTypes["md"] = "text/markdown"
knownContentTypes["xml"] = "application/xml"
knownContentTypes["pdf"] = "application/pdf"
knownContentTypes["zip"] = "application/zip"
knownContentTypes["gz"] = "application/gzip"
knownContentTypes["tar"] = "application/x-tar"
knownContentTypes["ogg"] = "audio/ogg"
knownContentTypes["mp3"] = "audio/mpeg"
knownContentTypes["mp4"] = "video/mp4"
knownContentTypes["webm"] = "video/webm"
knownContentTypes["webp"] = "image/webp"
knownContentTypes["woff"] = "font/woff"
knownContentTypes["woff2"] = "font/woff2"
knownContentTypes["ttf"] = "font/ttf"
knownContentTypes["otf"] = "font/otf"
knownContentTypes["eot"] = "application/vnd.ms-fontobject"
knownContentTypes["sfnt"] = "application/font-sfnt"
knownContentTypes["wasm"] = "application/wasm"
knownContentTypes["csv"] = "text/csv"
knownContentTypes["tsv"] = "text/tab-separated-values"
knownContentTypes["rtf"] = "application/rtf"
knownContentTypes["7z"] = "application/x-7z-compressed"
knownContentTypes["rar"] = "application/x-rar-compressed"
knownContentTypes["bz"] = "application/x-bzip"
knownContentTypes["bz2"] = "application/x-bzip2"
knownContentTypes["xz"] = "application/x-xz"
knownContentTypes["exe"] = "application/x-msdownload"
knownContentTypes["swf"] = "application/x-shockwave-flash"
knownContentTypes["flv"] = "video/x-flv"
knownContentTypes["wmv"] = "video/x-ms-wmv"
knownContentTypes["avi"] = "video/x-msvideo"
knownContentTypes["mpg"] = "video/mpeg"
knownContentTypes["mpeg"] = "video/mpeg"
knownContentTypes["mov"] = "video/quicktime"
knownContentTypes["weba"] = "audio/webm"
knownContentTypes["wav"] = "audio/wav"
knownContentTypes["flac"] = "audio/flac"
knownContentTypes["midi"] = "audio/midi"
knownContentTypes["mid"] = "audio/midi"
knownContentTypes["m4a"] = "audio/m4a"
knownContentTypes["m4v"] = "video/m4v"
knownContentTypes["3gp"] = "video/3gpp"
knownContentTypes["3g2"] = "video/3gpp2"
knownContentTypes["ogv"] = "video/ogg"
knownContentTypes["m3u8"] = "application/vnd.apple.mpegurl"
knownContentTypes["ts"] = "video/mp2t"
knownContentTypes["flv"] = "video/x-flv"
knownContentTypes["wmv"] = "video/x-ms-wmv"
term.log(()=10)
term.log((x)=10)
term.log((x,y)=10)

View File

@@ -1,4 +1,4 @@
x = {}
let x = {'p':1}
x.z = 1
x.b = 2
x.c = 3