From: Jay Freeman (saurik) Date: Mon, 13 Oct 2014 11:16:16 +0000 (-0700) Subject: Directly use primitives to construct class types. X-Git-Tag: v0.9.503~12 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/baea637579c120f1ee2be6d2b4404e21fa734d74 Directly use primitives to construct class types. --- 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");