lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r930345 - in /lucene/lucy/trunk/core/Lucy/Object: VTable.bp VTable.c
Date Fri, 02 Apr 2010 18:22:20 GMT
Author: marvin
Date: Fri Apr  2 18:22:19 2010
New Revision: 930345

URL: http://svn.apache.org/viewvc?rev=930345&view=rev
Log:
Add a method to VTable for turning a raw memory allocation into an object.

Modified:
    lucene/lucy/trunk/core/Lucy/Object/VTable.bp
    lucene/lucy/trunk/core/Lucy/Object/VTable.c

Modified: lucene/lucy/trunk/core/Lucy/Object/VTable.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VTable.bp?rev=930345&r1=930344&r2=930345&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VTable.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VTable.bp Fri Apr  2 18:22:19 2010
@@ -80,6 +80,12 @@ class Lucy::Object::VTable extends Lucy:
     Obj*
     Make_Obj(VTable *self);
 
+    /** Take a raw memory allocation which is presumed to be of adequate size,
+     * assign its vtable and give it an initial refcount of 1.
+     */
+    Obj*
+    Init_Obj(VTable *self, void *allocation);
+
     /** Create a new object using the supplied dump, assuming that Load() has
      * been defined for the class.
      */

Modified: lucene/lucy/trunk/core/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VTable.c?rev=930345&r1=930344&r2=930345&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VTable.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VTable.c Fri Apr  2 18:22:19 2010
@@ -190,6 +190,15 @@ VTable_make_obj(VTable *self)
 }
 
 Obj*
+VTable_init_obj(VTable *self, void *allocation)
+{
+    Obj *obj = (Obj*)allocation;
+    obj->vtable = self;
+    obj->ref.count = 1;
+    return obj;
+}
+
+Obj*
 VTable_load_obj(VTable *self, Obj *dump)
 {
     Obj_load_t load = (Obj_load_t)METHOD(self, Obj, Load);



Mime
View raw message