From baea637579c120f1ee2be6d2b4404e21fa734d74 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 13 Oct 2014 04:16:16 -0700 Subject: [PATCH] Directly use primitives to construct class types. --- Internal.hpp | 9 +++++++++ ObjectiveC/Library.mm | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Internal.hpp b/Internal.hpp index e0f732a..72b2986 100644 --- a/Internal.hpp +++ b/Internal.hpp @@ -60,6 +60,15 @@ struct Type_privateData : type_ = signature.elements[0].type; } + Type_privateData(sig::Primitive primitive) : + ffi_(NULL) + { + sig::Type type; + memset(&type, 0, sizeof(type)); + type.primitive = primitive; + Set(&type); + } + Type_privateData(sig::Type *type) : ffi_(NULL) { diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 32426a5..cb95509 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2840,8 +2840,8 @@ void CYObjectiveC_Initialize() { /*XXX*/ JSContextRef context(NULL); CYPoolTry { CYPool &pool(CYGetGlobalPool()); - Object_type = new(pool) Type_privateData("@"); - Selector_type = new(pool) Type_privateData(":"); + Object_type = new(pool) Type_privateData(sig::object_P); + Selector_type = new(pool) Type_privateData(sig::selector_P); NSArray_ = objc_getClass("NSArray"); NSBlock_ = objc_getClass("NSBlock"); -- 2.47.2