add __call__ support

This commit is contained in:
William Bell
2025-08-06 03:03:06 +01:00
parent 8ba755aeac
commit c567b59459
3 changed files with 27 additions and 0 deletions

View File

@@ -24,4 +24,9 @@ void add_field(ArgonObject *target, char *name, ArgonObject *object) {
hashmap_insert_GC(target->dict,
siphash64_bytes(name, strlen(name), siphash_key), name,
object, 0);
}
ArgonObject *get_field(ArgonObject *target, char *name) {
uint64_t hash = siphash64_bytes(name, strlen(name), siphash_key);
return hashmap_lookup_GC(target->dict, hash);
}

View File

@@ -16,4 +16,7 @@ typedef struct ArgonObject ArgonObject;
ArgonObject *new_object();
void add_field(ArgonObject *target, char *name, ArgonObject *object);
ArgonObject *get_field(ArgonObject *target, char *name);
#endif // OBJECT_H