lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [09/15] lucy git commit: Small changes to Snapshot for Go.
Date Sat, 07 Nov 2015 02:48:58 GMT
Small changes to Snapshot for Go.

Treat empty String the same as NULL.

Don't document "an assignment idiom" when returning the object, because
the Go method binding returns a tuple of (Snapshot, error) and thus
doesn't allow an assignment idiom.


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

Branch: refs/heads/master
Commit: 8eefef8eeed524308fdef47c34642b954908d8ea
Parents: 115b04c
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Sat Oct 31 15:10:45 2015 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sun Nov 1 10:00:35 2015 -0800

----------------------------------------------------------------------
 core/Lucy/Index/Snapshot.c   | 6 ++++--
 core/Lucy/Index/Snapshot.cfh | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/8eefef8e/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index 6aad5cd..78dc063 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -109,7 +109,9 @@ Snapshot_Read_File_IMP(Snapshot *self, Folder *folder, String *path) {
 
     // Eliminate all prior data. Pick a snapshot file.
     S_zero_out(self);
-    ivars->path = path ? Str_Clone(path) : IxFileNames_latest_snapshot(folder);
+    ivars->path = (path != NULL && Str_Get_Size(path) > 0)
+                  ? Str_Clone(path)
+                  : IxFileNames_latest_snapshot(folder);
 
     if (ivars->path) {
         Hash *snap_data
@@ -178,7 +180,7 @@ Snapshot_Write_File_IMP(Snapshot *self, Folder *folder, String *path)
{
 
     // Update path.
     DECREF(ivars->path);
-    if (path) {
+    if (path != NULL && Str_Get_Size(path) != 0) {
         ivars->path = Str_Clone(path);
     }
     else {

http://git-wip-us.apache.org/repos/asf/lucy/blob/8eefef8e/core/Lucy/Index/Snapshot.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.cfh b/core/Lucy/Index/Snapshot.cfh
index 17de30f..e0af038 100644
--- a/core/Lucy/Index/Snapshot.cfh
+++ b/core/Lucy/Index/Snapshot.cfh
@@ -71,7 +71,7 @@ public class Lucy::Index::Snapshot inherits Clownfish::Obj {
      * @param folder A Folder.
      * @param path The location of the snapshot file.  If not supplied, the
      * most recent snapshot file in the base directory will be chosen.
-     * @return the object, allowing an assignment idiom.
+     * @return the Snapshot object itself
      */
     public Snapshot*
     Read_File(Snapshot *self, Folder *folder, String *path = NULL);


Mime
View raw message