lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [1/8] lucy git commit: Adjust for Str_Swap_Chars removal
Date Fri, 30 Oct 2015 14:52:00 GMT
Repository: lucy
Updated Branches:
  refs/heads/master 61d45291a -> 25759e097


Adjust for Str_Swap_Chars removal


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

Branch: refs/heads/master
Commit: aa350716b27d37b1aff166f11006465dd3a93d39
Parents: 8be7674
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Thu Oct 22 16:40:07 2015 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Thu Oct 22 16:47:06 2015 +0200

----------------------------------------------------------------------
 core/Lucy/Store/FSFolder.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/aa350716/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index 40c17b8..1570bca 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -39,6 +39,7 @@
   #include <direct.h>
 #endif
 
+#include "Clownfish/CharBuf.h"
 #include "Lucy/Store/FSFolder.h"
 #include "Lucy/Store/CompoundFileReader.h"
 #include "Lucy/Store/CompoundFileWriter.h"
@@ -276,7 +277,19 @@ S_fullpath(FSFolder *self, String *path) {
     String *fullpath = Str_newf("%o%s%o", ivars->path, CHY_DIR_SEP, path);
     String *retval;
     if (CHY_DIR_SEP[0] != '/') {
-        retval = Str_Swap_Chars(fullpath, '/', CHY_DIR_SEP[0]);
+        // Replace '/' with CHY_DIR_SEP.
+        StringIterator *iter = Str_Top(fullpath);
+        CharBuf *buf = CB_new(Str_Get_Size(fullpath));
+        int32_t cp;
+
+        while (STRITER_DONE != (cp = StrIter_Next(iter))) {
+            if (cp == '/') { cp = CHY_DIR_SEP[0]; }
+            CB_Cat_Char(buf, cp);
+        }
+
+        retval = CB_Yield_String(buf);
+        DECREF(buf);
+        DECREF(iter);
         DECREF(fullpath);
     }
     else {


Mime
View raw message