You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/08/26 00:57:10 UTC

[lucy-commits] [08/14] git commit: refs/heads/cfish-string-prep1 - Eliminate CB_setf in SortReader

Eliminate CB_setf in SortReader


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

Branch: refs/heads/cfish-string-prep1
Commit: 9a266bd2577ca0db06a2ad661e0b7ded00d4aee0
Parents: 68d5598
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Aug 25 22:08:43 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Aug 26 00:54:48 2013 +0200

----------------------------------------------------------------------
 core/Lucy/Index/SortReader.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/9a266bd2/core/Lucy/Index/SortReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortReader.c b/core/Lucy/Index/SortReader.c
index 24c5b01..ed682c2 100644
--- a/core/Lucy/Index/SortReader.c
+++ b/core/Lucy/Index/SortReader.c
@@ -175,37 +175,35 @@ S_lazy_init_sort_cache(DefaultSortReader *self, const CharBuf *field) {
     Folder    *folder    = DefSortReader_Get_Folder(self);
     Segment   *segment   = DefSortReader_Get_Segment(self);
     CharBuf   *seg_name  = Seg_Get_Name(segment);
-    CharBuf   *path      = CB_new(40);
     int32_t    field_num = Seg_Field_Num(segment, field);
     int8_t     prim_id   = FType_Primitive_ID(type);
     bool       var_width = (prim_id == FType_TEXT || prim_id == FType_BLOB)
                            ? true
                            : false;
-    CB_setf(path, "%o/sort-%i32.ord", seg_name, field_num);
-    InStream *ord_in = Folder_Open_In(folder, path);
+    CharBuf *ord_path = CB_newf("%o/sort-%i32.ord", seg_name, field_num);
+    InStream *ord_in = Folder_Open_In(folder, ord_path);
+    DECREF(ord_path);
     if (!ord_in) {
-        DECREF(path);
         THROW(ERR, "Error building sort cache for '%o': %o",
               field, Err_get_error());
     }
     InStream *ix_in = NULL;
     if (var_width) {
-        CB_setf(path, "%o/sort-%i32.ix", seg_name, field_num);
-        ix_in = Folder_Open_In(folder, path);
+        CharBuf *ix_path = CB_newf("%o/sort-%i32.ix", seg_name, field_num);
+        ix_in = Folder_Open_In(folder, ix_path);
+        DECREF(ix_path);
         if (!ix_in) {
-            DECREF(path);
             THROW(ERR, "Error building sort cache for '%o': %o",
                   field, Err_get_error());
         }
     }
-    CB_setf(path, "%o/sort-%i32.dat", seg_name, field_num);
-    InStream *dat_in = Folder_Open_In(folder, path);
+    CharBuf *dat_path = CB_newf("%o/sort-%i32.dat", seg_name, field_num);
+    InStream *dat_in = Folder_Open_In(folder, dat_path);
+    DECREF(dat_path);
     if (!dat_in) {
-        DECREF(path);
         THROW(ERR, "Error building sort cache for '%o': %o",
               field, Err_get_error());
     }
-    DECREF(path);
 
     Obj     *null_ord_obj = Hash_Fetch(ivars->null_ords, (Obj*)field);
     int32_t  null_ord = null_ord_obj ? (int32_t)Obj_To_I64(null_ord_obj) : -1;