lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [2/4] git commit: refs/heads/sortex_ptr_only - Modify SortEx_Feed() argument type.
Date Tue, 08 Jan 2013 23:55: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/c22026c5
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c22026c5
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c22026c5

Branch: refs/heads/sortex_ptr_only
Commit: c22026c5f57b857fc662f6d3f3e98fc23c85997c
Parents: c2d48b3
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Fri Jan 4 15:17:17 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Fri Jan 4 15:17:17 2013 -0800

----------------------------------------------------------------------
 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/Test/Util/BBSortEx.c           |    8 +++++---
 core/Lucy/Test/Util/BBSortEx.cfh         |    2 +-
 core/Lucy/Util/SortExternal.c            |    6 +++---
 core/Lucy/Util/SortExternal.cfh          |    7 ++-----
 perl/buildlib/Lucy/Build/Binding/Misc.pm |    9 ---------
 9 files changed, 15 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/c22026c5/core/Lucy/Index/Posting/MatchPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/MatchPosting.c b/core/Lucy/Index/Posting/MatchPosting.c
index 3ff887f..3c4ec4f 100644
--- a/core/Lucy/Index/Posting/MatchPosting.c
+++ b/core/Lucy/Index/Posting/MatchPosting.c
@@ -130,7 +130,7 @@ MatchPost_add_inversion_to_pool(MatchPosting *self, PostingPool *post_pool,
         RawPosting *raw_posting
             = RawPost_new(MemPool_Grab(mem_pool, raw_post_bytes), doc_id,
                           freq, token->text, token->len);
-        PostPool_Feed(post_pool, &raw_posting);
+        PostPool_Feed(post_pool, (Obj*)raw_posting);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/c22026c5/core/Lucy/Index/Posting/RichPosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/RichPosting.c b/core/Lucy/Index/Posting/RichPosting.c
index 30b4f39..eee0b5c 100644
--- a/core/Lucy/Index/Posting/RichPosting.c
+++ b/core/Lucy/Index/Posting/RichPosting.c
@@ -140,7 +140,7 @@ RichPost_add_inversion_to_pool(RichPosting *self, PostingPool *post_pool,
         raw_posting->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/c22026c5/core/Lucy/Index/Posting/ScorePosting.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Posting/ScorePosting.c b/core/Lucy/Index/Posting/ScorePosting.c
index 08dee59..15fff8b 100644
--- a/core/Lucy/Index/Posting/ScorePosting.c
+++ b/core/Lucy/Index/Posting/ScorePosting.c
@@ -110,7 +110,7 @@ ScorePost_add_inversion_to_pool(ScorePosting *self, PostingPool *post_pool,
         raw_posting->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/c22026c5/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index b4d38bf..999562b 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -188,7 +188,7 @@ SortFieldWriter_add(SortFieldWriter *self, int32_t doc_id, Obj *value)
{
     // Uniq-ify the value, and record it for this document.
     Obj *copy = S_find_unique_value(self->uniq_vals, value);
     SFWriterElem *elem = S_SFWriterElem_create(self->mem_pool, copy, doc_id);
-    SortFieldWriter_Feed(self, &elem);
+    SortFieldWriter_Feed(self, (Obj*)elem);
     self->count++;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/c22026c5/core/Lucy/Test/Util/BBSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/BBSortEx.c b/core/Lucy/Test/Util/BBSortEx.c
index c47411d..f586733 100644
--- a/core/Lucy/Test/Util/BBSortEx.c
+++ b/core/Lucy/Test/Util/BBSortEx.c
@@ -59,11 +59,13 @@ BBSortEx_clear_cache(BBSortEx *self) {
 }
 
 void
-BBSortEx_feed(BBSortEx *self, void *data) {
-    SortEx_feed((SortExternal*)self, data);
+BBSortEx_feed(BBSortEx *self, Obj *item) {
+    BBSortEx_Feed_t super_feed
+        = SUPER_METHOD_PTR(BBSORTEX, Lucy_BBSortEx_Feed);
+    super_feed(self, item);
 
     // Flush() if necessary.
-    ByteBuf *bytebuf = (ByteBuf*)CERTIFY(*(ByteBuf**)data, BYTEBUF);
+    ByteBuf *bytebuf = (ByteBuf*)CERTIFY(item, BYTEBUF);
     self->mem_consumed += BB_Get_Size(bytebuf);
     if (self->mem_consumed >= self->mem_thresh) {
         BBSortEx_Flush(self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/c22026c5/core/Lucy/Test/Util/BBSortEx.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/BBSortEx.cfh b/core/Lucy/Test/Util/BBSortEx.cfh
index f82954f..be097e6 100644
--- a/core/Lucy/Test/Util/BBSortEx.cfh
+++ b/core/Lucy/Test/Util/BBSortEx.cfh
@@ -34,7 +34,7 @@ class Lucy::Test::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/c22026c5/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index d297d29..8fab003 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -77,13 +77,13 @@ SortEx_clear_cache(SortExternal *self) {
 }
 
 void
-SortEx_feed(SortExternal *self, void *data) {
+SortEx_feed(SortExternal *self, Obj *item) {
     if (self->cache_max == self->cache_cap) {
         size_t amount = Memory_oversize(self->cache_max + 1, sizeof(Obj*));
         SortEx_Grow_Cache(self, amount);
     }
-    uint8_t *target = self->cache + self->cache_max * sizeof(Obj*);
-    memcpy(target, data, sizeof(Obj*));
+    Obj **elems = (Obj**)self->cache;
+    elems[self->cache_max] = item;
     self->cache_max++;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/c22026c5/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index 0ea2b05..ee1b230 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -79,13 +79,10 @@ abstract class Lucy::Util::SortExternal cnick 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/c22026c5/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 6c9d8de..e59f760 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -372,7 +372,6 @@ sub bind_bbsortex {
     my @hand_rolled = qw(
         Fetch
         Peek
-        Feed
     );
     my $xs_code = <<'END_XS_CODE';
 MODULE = Lucy    PACKAGE = Lucy::Test::Util::BBSortEx
@@ -408,14 +407,6 @@ CODE:
 }
 OUTPUT: RETVAL
 
-void
-feed(self, bb)
-    lucy_BBSortEx *self;
-    lucy_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