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:11 UTC

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

Eliminate CB_setf in SortWriter


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

Branch: refs/heads/cfish-string-prep1
Commit: 07f5886e2d67be80491b0e948491e5b49982d6b9
Parents: 9a266bd
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Aug 25 22:12:11 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Aug 26 00:54:48 2013 +0200

----------------------------------------------------------------------
 core/Lucy/Index/SortWriter.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/07f5886e/core/Lucy/Index/SortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c
index 6f375fd..02fc258 100644
--- a/core/Lucy/Index/SortWriter.c
+++ b/core/Lucy/Index/SortWriter.c
@@ -100,25 +100,24 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) {
         if (!ivars->temp_ord_out) {
             Folder  *folder   = ivars->folder;
             CharBuf *seg_name = Seg_Get_Name(ivars->segment);
-            CharBuf *path     = CB_newf("%o/sort_ord_temp", seg_name);
-            ivars->temp_ord_out = Folder_Open_Out(folder, path);
+            CharBuf *ord_path = CB_newf("%o/sort_ord_temp", seg_name);
+            ivars->temp_ord_out = Folder_Open_Out(folder, ord_path);
+            DECREF(ord_path);
             if (!ivars->temp_ord_out) {
-                DECREF(path);
                 RETHROW(INCREF(Err_get_error()));
             }
-            CB_setf(path, "%o/sort_ix_temp", seg_name);
-            ivars->temp_ix_out = Folder_Open_Out(folder, path);
+            CharBuf *ix_path = CB_newf("%o/sort_ix_temp", seg_name);
+            ivars->temp_ix_out = Folder_Open_Out(folder, ix_path);
+            DECREF(ix_path);
             if (!ivars->temp_ix_out) {
-                DECREF(path);
                 RETHROW(INCREF(Err_get_error()));
             }
-            CB_setf(path, "%o/sort_dat_temp", seg_name);
-            ivars->temp_dat_out = Folder_Open_Out(folder, path);
+            CharBuf *dat_path = CB_newf("%o/sort_dat_temp", seg_name);
+            ivars->temp_dat_out = Folder_Open_Out(folder, dat_path);
+            DECREF(dat_path);
             if (!ivars->temp_dat_out) {
-                DECREF(path);
                 RETHROW(INCREF(Err_get_error()));
             }
-            DECREF(path);
         }
 
         CharBuf *field = Seg_Field_Name(ivars->segment, field_num);
@@ -243,13 +242,15 @@ SortWriter_Finish_IMP(SortWriter *self) {
     // Clean up.
     Folder  *folder   = ivars->folder;
     CharBuf *seg_name = Seg_Get_Name(ivars->segment);
-    CharBuf *path     = CB_newf("%o/sort_ord_temp", seg_name);
-    Folder_Delete(folder, path);
-    CB_setf(path, "%o/sort_ix_temp", seg_name);
-    Folder_Delete(folder, path);
-    CB_setf(path, "%o/sort_dat_temp", seg_name);
-    Folder_Delete(folder, path);
-    DECREF(path);
+    CharBuf *ord_path = CB_newf("%o/sort_ord_temp", seg_name);
+    Folder_Delete(folder, ord_path);
+    DECREF(ord_path);
+    CharBuf *ix_path = CB_newf("%o/sort_ix_temp", seg_name);
+    Folder_Delete(folder, ix_path);
+    DECREF(ix_path);
+    CharBuf *dat_path = CB_newf("%o/sort_dat_temp", seg_name);
+    Folder_Delete(folder, dat_path);
+    DECREF(dat_path);
 }
 
 Hash*