From: kramm Date: Tue, 30 Dec 2008 23:06:25 +0000 (+0000) Subject: added ptr_type X-Git-Tag: release-0-9-0~507 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=b78c0fcd093d913860d445b1f8b28451711f7fa1 added ptr_type --- diff --git a/lib/q.c b/lib/q.c index 221ea5a..f7f7980 100644 --- a/lib/q.c +++ b/lib/q.c @@ -523,6 +523,23 @@ void stringarray_destroy(stringarray_t*sa) // ------------------------------- type_t ------------------------------- +char ptr_equals(const void*o1, const void*o2) +{ + return o1==o2; +} +unsigned int ptr_hash(const void*o) +{ + return string_hash3(o, sizeof(o)); +} +void* ptr_dup(const void*o) +{ + return (void*)o; +} +void ptr_free(void*o) +{ + return; +} + char charptr_equals(const void*o1, const void*o2) { if(!o1 || !o2) @@ -547,6 +564,7 @@ void charptr_free(void*o) rfx_free(o); } } + char stringstruct_equals(const void*o1, const void*o2) { string_t*s1 = (string_t*)o1; @@ -574,6 +592,12 @@ void stringstruct_free(void*o) rfx_free((void*)o); } +type_t ptr_type = { + equals: ptr_equals, + hash: ptr_hash, + dup: ptr_dup, + free: ptr_free, +}; type_t charptr_type = { equals: charptr_equals, diff --git a/lib/q.h b/lib/q.h index 0a3d323..6cf8bbf 100644 --- a/lib/q.h +++ b/lib/q.h @@ -70,6 +70,7 @@ typedef struct _type_t { extern type_t charptr_type; extern type_t stringstruct_type; +extern type_t ptr_type; typedef struct _dictentry { void*key;