]> git.saurik.com Git - cycript.git/blobdiff - Pooling.hpp
Instance's toPointer() should return as CFTypeRef.
[cycript.git] / Pooling.hpp
index b67f2622209d1cc0d059ad205e5b6cbe35ebd16f..1c155fee5318a7f3a0f4082dcee16aeb1ec29399 100644 (file)
@@ -115,6 +115,13 @@ class CYPool {
         return reinterpret_cast<Type_ *>(data);
     }
 
+    template <typename Type_>
+    Type_ *calloc(size_t count, size_t size, size_t alignment = CYAlignment) {
+        Type_ *data(malloc<Type_>(count * size, alignment));
+        memset(data, 0, count * size);
+        return data;
+    }
+
     char *strdup(const char *data) {
         if (data == NULL)
             return NULL;
@@ -228,6 +235,7 @@ struct CYData {
     CYData() :
         count_(1)
     {
+        _assert(pool_ != NULL);
     }
 
     CYData(CYPool &pool) :