lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [43/54] [abbrv] git commit: refs/heads/sortex_ptr_only - Modify SortEx_Feed() argument type.
Date Sat, 26 Apr 2014 23:12:13 GMT
Modify SortEx_Feed() argument type.

Have Feed() take an Obj* rather than void*.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/d4771158
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/d4771158
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/d4771158

Branch: refs/heads/sortex_ptr_only
Commit: d477115848375c74b9266f49144bfc2a817895e0
Parents: bb2a97d
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Fri Jan 4 15:17:17 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Apr 26 11:36:01 2014 -0700

----------------------------------------------------------------------
 core/Lucy/Index/Posting/MatchPosting.c   | 2 +-
 core/Lucy/Index/Posting/RichPosting.c    | 2 +-
 core/Lucy/Index/Posting/ScorePosting.c   | 2 +-
 core/Lucy/Index/SortFieldWriter.c        | 2 +-
 core/Lucy/Util/BBSortEx.c                | 6 +++---
 core/Lucy/Util/BBSortEx.cfh              | 2 +-
 core/Lucy/Util/SortExternal.c            | 6 +++---
 core/Lucy/Util/SortExternal.cfh          | 7 ++-----
 perl/buildlib/Lucy/Build/Binding/Util.pm | 9 ---------
 9 files changed, 13 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Index/Posting/MatchPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/MatchPosting.c b/core/Lucy/Index/Posting/MatchPosting.c
index 55c9734..800d684 100644
--- a/core/Lucy/Index/Posting/MatchPosting.c
+++ b/core/Lucy/Index/Posting/MatchPosting.c
@@ -138,7 +138,7 @@ MatchPost_Add_Inversion_To_Pool_IMP(MatchPosting *self,
         RawPosting *raw_posting
             = RawPost_new(MemPool_Grab(mem_pool, raw_post_bytes), doc_id,
                           freq, token_ivars->text, token_ivars->len);
-        PostPool_Feed(post_pool, &raw_posting);
+        PostPool_Feed(post_pool, (Obj*)raw_posting);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Index/Posting/RichPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RichPosting.c b/core/Lucy/Index/Posting/RichPosting.c
index f5af4ce..8bcc423 100644
--- a/core/Lucy/Index/Posting/RichPosting.c
+++ b/core/Lucy/Index/Posting/RichPosting.c
@@ -147,7 +147,7 @@ RichPost_Add_Inversion_To_Pool_IMP(RichPosting *self, PostingPool *post_pool,
         raw_post_ivars->aux_len = dest - start;
         raw_post_bytes = dest - (char*)raw_posting;
         MemPool_Resize(mem_pool, raw_posting, raw_post_bytes);
-        PostPool_Feed(post_pool, &raw_posting);
+        PostPool_Feed(post_pool, (Obj*)raw_posting);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Index/Posting/ScorePosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/ScorePosting.c b/core/Lucy/Index/Posting/ScorePosting.c
index b2d3265..f5aa961 100644
--- a/core/Lucy/Index/Posting/ScorePosting.c
+++ b/core/Lucy/Index/Posting/ScorePosting.c
@@ -117,7 +117,7 @@ ScorePost_Add_Inversion_To_Pool_IMP(ScorePosting *self,
         raw_post_ivars->aux_len = dest - start;
         raw_post_bytes = dest - (char*)raw_posting;
         MemPool_Resize(mem_pool, raw_posting, raw_post_bytes);
-        PostPool_Feed(post_pool, &raw_posting);
+        PostPool_Feed(post_pool, (Obj*)raw_posting);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 7c0e770..34aa84d 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -199,7 +199,7 @@ SortFieldWriter_Add_IMP(SortFieldWriter *self, int32_t doc_id, Obj *value)
{
     // Uniq-ify the value, and record it for this document.
     Obj *copy = S_find_unique_value(ivars->uniq_vals, value);
     SFWriterElem *elem = S_SFWriterElem_create(ivars->mem_pool, copy, doc_id);
-    SortFieldWriter_Feed(self, &elem);
+    SortFieldWriter_Feed(self, (Obj*)elem);
     ivars->count++;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Util/BBSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BBSortEx.c b/core/Lucy/Util/BBSortEx.c
index a0a0c7e..fb50522 100644
--- a/core/Lucy/Util/BBSortEx.c
+++ b/core/Lucy/Util/BBSortEx.c
@@ -63,14 +63,14 @@ BBSortEx_Clear_Cache_IMP(BBSortEx *self) {
 }
 
 void
-BBSortEx_Feed_IMP(BBSortEx *self, void *data) {
+BBSortEx_Feed_IMP(BBSortEx *self, Obj *item) {
     BBSortExIVARS *const ivars = BBSortEx_IVARS(self);
     BBSortEx_Feed_t super_feed
         = SUPER_METHOD_PTR(BBSORTEX, LUCY_BBSortEx_Feed);
-    super_feed(self, data);
+    super_feed(self, item);
 
     // Flush() if necessary.
-    ByteBuf *bytebuf = (ByteBuf*)CERTIFY(*(ByteBuf**)data, BYTEBUF);
+    ByteBuf *bytebuf = (ByteBuf*)CERTIFY(item, BYTEBUF);
     ivars->mem_consumed += BB_Get_Size(bytebuf);
     if (ivars->mem_consumed >= ivars->mem_thresh) {
         BBSortEx_Flush(self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Util/BBSortEx.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BBSortEx.cfh b/core/Lucy/Util/BBSortEx.cfh
index 41f72ea..3ba7531 100644
--- a/core/Lucy/Util/BBSortEx.cfh
+++ b/core/Lucy/Util/BBSortEx.cfh
@@ -34,7 +34,7 @@ class Lucy::Util::BBSortEx
         VArray *external = NULL);
 
     void
-    Feed(BBSortEx *self, void *data);
+    Feed(BBSortEx *self, decremented Obj *item);
 
     void
     Flush(BBSortEx *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index b948131..98158b9 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -83,14 +83,14 @@ SortEx_Clear_Cache_IMP(SortExternal *self) {
 }
 
 void
-SortEx_Feed_IMP(SortExternal *self, void *data) {
+SortEx_Feed_IMP(SortExternal *self, Obj *item) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
     if (ivars->cache_max == ivars->cache_cap) {
         size_t amount = Memory_oversize(ivars->cache_max + 1, sizeof(Obj*));
         SortEx_Grow_Cache(self, amount);
     }
-    uint8_t *target = ivars->cache + ivars->cache_max * sizeof(Obj*);
-    memcpy(target, data, sizeof(Obj*));
+    Obj **elems = (Obj**)ivars->cache;
+    elems[ivars->cache_max] = item;
     ivars->cache_max++;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index 8362c4f..a6a7313 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -79,13 +79,10 @@ abstract class Lucy::Util::SortExternal nickname SortEx
     abstract void
     Flush(SortExternal *self);
 
-    /** Add data to the sort pool.
-     *
-     * @param data Pointer to the data being added, which must be exactly
-     * <code>width</code> bytes in size.
+    /** Add an item to the sort pool.
      */
     void
-    Feed(SortExternal *self, void *data);
+    Feed(SortExternal *self, decremented Obj *item);
 
     /** Flip the sortex from write mode to read mode.
      */

http://git-wip-us.apache.org/repos/asf/lucy/blob/d4771158/perl/buildlib/Lucy/Build/Binding/Util.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm
index 1561b48..a0de3ed 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -32,7 +32,6 @@ sub bind_bbsortex {
     my @hand_rolled = qw(
         Fetch
         Peek
-        Feed
     );
     my $xs_code = <<'END_XS_CODE';
 MODULE = Lucy    PACKAGE = Lucy::Util::BBSortEx
@@ -68,14 +67,6 @@ CODE:
 }
 OUTPUT: RETVAL
 
-void
-feed(self, bb)
-    lucy_BBSortEx *self;
-    cfish_ByteBuf *bb;
-CODE:
-    CFISH_INCREF(bb);
-    LUCY_BBSortEx_Feed(self, &bb);
-
 END_XS_CODE
 
     my $binding = Clownfish::CFC::Binding::Perl::Class->new(


Mime
View raw message