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 2014/12/24 16:07:36 UTC
[8/8] lucy git commit: Don't mention Err_error in docs
Don't mention Err_error in docs
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/516bea18
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/516bea18
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/516bea18
Branch: refs/heads/master
Commit: 516bea18e3d7c47b7a46d202812a64735ce20155
Parents: 500e7ae
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Dec 23 21:58:41 2014 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Dec 24 14:43:51 2014 +0100
----------------------------------------------------------------------
core/Lucy/Store/CompoundFileReader.cfh | 3 +-
core/Lucy/Store/DirHandle.cfh | 3 +-
core/Lucy/Store/FSFileHandle.c | 4 +-
core/Lucy/Store/FSFileHandle.cfh | 4 +-
core/Lucy/Store/FSFolder.c | 2 +-
core/Lucy/Store/FileHandle.cfh | 23 ++++++++----
core/Lucy/Store/Folder.cfh | 43 +++++++++++++---------
core/Lucy/Store/InStream.cfh | 3 +-
core/Lucy/Store/Lock.cfh | 6 ++-
core/Lucy/Store/OutStream.cfh | 3 +-
core/Lucy/Store/RAMFileHandle.cfh | 4 +-
core/Lucy/Test/Store/TestCompoundFileReader.c | 22 +++++------
core/Lucy/Test/Store/TestFSFileHandle.c | 2 +-
core/Lucy/Test/Store/TestFolder.c | 24 ++++++------
core/Lucy/Test/Store/TestFolderCommon.c | 20 +++++-----
core/Lucy/Test/Store/TestRAMFolder.c | 20 +++++-----
core/Lucy/Test/Util/TestJson.c | 16 ++++----
core/Lucy/Util/Json.c | 9 +++--
core/Lucy/Util/Json.cfh | 16 ++++----
19 files changed, 126 insertions(+), 101 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/CompoundFileReader.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.cfh b/core/Lucy/Store/CompoundFileReader.cfh
index 425dce0..d50bff7 100644
--- a/core/Lucy/Store/CompoundFileReader.cfh
+++ b/core/Lucy/Store/CompoundFileReader.cfh
@@ -41,7 +41,8 @@ class Lucy::Store::CompoundFileReader nickname CFReader
inert incremented nullable CompoundFileReader*
open(Folder *folder);
- /** Return a new CompoundFileReader or set Err_error and return NULL.
+ /** Return a new CompoundFileReader or set the global error object
+ * returned by [](cfish:cfish.Err.get_error) and return NULL.
*
* @param folder A folder containing compound files.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/DirHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/DirHandle.cfh b/core/Lucy/Store/DirHandle.cfh
index 581f5d9..b5cb985 100644
--- a/core/Lucy/Store/DirHandle.cfh
+++ b/core/Lucy/Store/DirHandle.cfh
@@ -39,7 +39,8 @@ abstract class Lucy::Store::DirHandle nickname DH
Next(DirHandle *self);
/** Attempt to close the DirHandle. Returns true on success, sets
- * Err_error and returns false on failure.
+ * the global error object returned by [](cfish:cfish.Err.get_error) and
+ * returns false on failure.
*/
abstract bool
Close(DirHandle *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index 17b6a07..c190639 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -60,7 +60,7 @@ SI_posix_flags(uint32_t fh_flags) {
// Memory map a region of the file with shared (read-only) permissions. If
// the requested length is 0, return NULL. If an error occurs, return NULL
-// and set Err_error.
+// and set the global error object.
static CFISH_INLINE void*
SI_map(FSFileHandle *self, FSFileHandleIVARS *ivars, int64_t offset,
int64_t len);
@@ -143,7 +143,7 @@ FSFH_do_open(FSFileHandle *self, String *path, uint32_t flags) {
ivars->buf = (char*)SI_map(self, ivars, 0, ivars->len);
if (!ivars->buf) {
// An error occurred during SI_map, which has set
- // Err_error for us already.
+ // the global error object for us already.
CFISH_DECREF(self);
return NULL;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/FSFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.cfh b/core/Lucy/Store/FSFileHandle.cfh
index 25a3a65..c36e5b5 100644
--- a/core/Lucy/Store/FSFileHandle.cfh
+++ b/core/Lucy/Store/FSFileHandle.cfh
@@ -28,8 +28,8 @@ class Lucy::Store::FSFileHandle nickname FSFH
int64_t page_size;
char *buf;
- /** Return a new FSFileHandle, or set Err_error and return NULL if
- * something goes wrong.
+ /** Return a new FSFileHandle, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL if something goes wrong.
*
* @param path Filepath.
* @param flags FileHandle constructor flags.
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index f8940ce..503a22f 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -60,7 +60,7 @@ S_fullpath_ptr(FSFolder *self, String *path);
static bool
S_dir_ok(String *path);
-// Create a directory, or set Err_error and return false.
+// Create a directory, or set the global error object and return false.
static bool
S_create_dir(String *path);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/FileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FileHandle.cfh b/core/Lucy/Store/FileHandle.cfh
index 33c788a..9e5e9f2 100644
--- a/core/Lucy/Store/FileHandle.cfh
+++ b/core/Lucy/Store/FileHandle.cfh
@@ -60,7 +60,8 @@ abstract class Lucy::Store::FileHandle nickname FH
* @param window A FileWindow.
* @param offset File position to begin at.
* @param len Number of bytes to expose via the window.
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Window(FileHandle *self, FileWindow *window, int64_t offset, int64_t len);
@@ -68,7 +69,8 @@ abstract class Lucy::Store::FileHandle nickname FH
/** Clean up the FileWindow, doing whatever is necessary to free its
* buffer and reset its internal variables.
*
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Release_Window(FileHandle *self, FileWindow *window);
@@ -78,7 +80,8 @@ abstract class Lucy::Store::FileHandle nickname FH
* @param dest Supplied memory.
* @param offset File position to begin at.
* @param len Number of bytes to copy.
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Read(FileHandle *self, char *dest, int64_t offset, size_t len);
@@ -87,13 +90,15 @@ abstract class Lucy::Store::FileHandle nickname FH
*
* @param data Content to write.
* @param len Number of bytes to write.
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Write(FileHandle *self, const void *data, size_t len);
- /** Return the current length of the file in bytes, or set Err_error and
- * return -1 on failure.
+ /** Return the current length of the file in bytes, or set the global
+ * error object returned by [](cfish:cfish.Err.get_error) and return -1 on
+ * failure.
*/
abstract int64_t
Length(FileHandle *self);
@@ -101,7 +106,8 @@ abstract class Lucy::Store::FileHandle nickname FH
/** Advisory call alerting the FileHandle that it should prepare to occupy
* `len` bytes. The default implementation is a no-op.
*
- * @return true on success, false on failure (sets Err_error).
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error)).
*/
bool
Grow(FileHandle *self, int64_t len);
@@ -110,7 +116,8 @@ abstract class Lucy::Store::FileHandle nickname FH
* should be be able to handle multiple invocations, returning success
* unless something unexpected happens.
*
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Close(FileHandle *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/Folder.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.cfh b/core/Lucy/Store/Folder.cfh
index 6ac2a81..c38a8f0 100644
--- a/core/Lucy/Store/Folder.cfh
+++ b/core/Lucy/Store/Folder.cfh
@@ -47,7 +47,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
void
Set_Path(Folder *self, String *path);
- /** Open an OutStream, or set Err_error and return NULL on failure.
+ /** Open an OutStream, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param path A relative filepath.
* @return an OutStream.
@@ -55,7 +56,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
public incremented nullable OutStream*
Open_Out(Folder *self, String *path);
- /** Open an InStream, or set Err_error and return NULL on failure.
+ /** Open an InStream, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param path A relative filepath.
* @return an InStream.
@@ -63,7 +65,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
public incremented nullable InStream*
Open_In(Folder *self, String *path);
- /** Open a FileHandle, or set Err_error and return NULL on failure.
+ /** Open a FileHandle, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param path A relative filepath.
* @param flags FileHandle flags.
@@ -72,7 +75,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
public incremented nullable FileHandle*
Open_FileHandle(Folder *self, String *path, uint32_t flags);
- /** Open a DirHandle or set Err_error and return NULL on failure.
+ /** Open a DirHandle or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param path Path to a subdirectory, relative to the Folder's path. If
* empty or NULL, returns a DirHandle for this Folder.
@@ -84,13 +88,15 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
/** Create a subdirectory.
*
* @param path A relative filepath.
- * @return true on success, false on failure (sets Err_error).
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error)).
*/
public bool
MkDir(Folder *self, String *path);
- /** List all local entries within a directory. Set Err_error and return
- * NULL if something goes wrong.
+ /** List all local entries within a directory. Set the global error
+ * object returned by [](cfish:cfish.Err.get_error) and return NULL if
+ * something goes wrong.
*
* @param path A relative filepath optionally specifying a subdirectory.
* @return an unsorted array of filenames.
@@ -139,9 +145,9 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
public bool
Delete_Tree(Folder *self, String *path);
- /** Rename a file or directory, or set Err_error and return false on
- * failure. If an entry exists at `to`, the results are
- * undefined.
+ /** Rename a file or directory, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return false on failure. If an entry
+ * exists at `to`, the results are undefined.
*
* @param from The filepath prior to renaming.
* @param to The filepath after renaming.
@@ -151,7 +157,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
Rename(Folder *self, String *from, String *to);
/** Create a hard link at path `to` pointing at the existing
- * file `from`, or set Err_error and return false on failure.
+ * file `from`, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return false on failure.
*
* @return true on success, false on failure.
*/
@@ -210,20 +217,21 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
public abstract void
Close(Folder *self);
- /** Open a FileHandle for a local file, or set Err_error and return NULL
- * on failure.
+ /** Open a FileHandle for a local file, or set the global error object
+ * returned by [](cfish:cfish.Err.get_error) and return NULL on failure.
*/
abstract incremented nullable FileHandle*
Local_Open_FileHandle(Folder *self, String *name, uint32_t flags);
- /** Open an InStream for a local file, or set Err_error and return NULL on
- * failure.
+ /** Open an InStream for a local file, or set the global error object
+ * returned by [](cfish:cfish.Err.get_error) and return NULL on failure.
*/
incremented nullable InStream*
Local_Open_In(Folder *self, String *name);
/** Open a DirHandle to iterate over the local entries in this Folder, or
- * set Err_error and return NULL on failure.
+ * set the global error object returned by [](cfish:cfish.Err.get_error)
+ * and return NULL on failure.
*/
abstract incremented nullable DirHandle*
Local_Open_Dir(Folder *self);
@@ -231,7 +239,8 @@ public abstract class Lucy::Store::Folder inherits Clownfish::Obj {
/** Create a local subdirectory.
*
* @param name The name of the subdirectory.
- * @return true on success, false on failure (sets Err_error)
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error))
*/
abstract bool
Local_MkDir(Folder *self, String *name);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/InStream.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/InStream.cfh b/core/Lucy/Store/InStream.cfh
index af10d2e..efa7f63 100644
--- a/core/Lucy/Store/InStream.cfh
+++ b/core/Lucy/Store/InStream.cfh
@@ -44,7 +44,8 @@ class Lucy::Store::InStream inherits Clownfish::Obj {
inert incremented nullable InStream*
open(Obj *file);
- /** Return a new InStream, or set Err_error and return NULL on failure.
+ /** Return a new InStream, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param file A FileHandle, a file path, or a RAMFile.
*/
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/Lock.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Lock.cfh b/core/Lucy/Store/Lock.cfh
index e6496a4..113467a 100644
--- a/core/Lucy/Store/Lock.cfh
+++ b/core/Lucy/Store/Lock.cfh
@@ -58,7 +58,8 @@ public abstract class Lucy::Store::Lock inherits Clownfish::Obj {
/** Call [](cfish:.Request) once per `interval` until [](cfish:.Request) returns
* success or the `timeout` has been reached.
*
- * @return true on success, false on failure (sets Err_error).
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error)).
*/
public bool
Obtain(Lock *self);
@@ -72,7 +73,8 @@ public abstract class Lucy::Store::Lock inherits Clownfish::Obj {
* not [](cfish:.Shared) -- i.e. it's an exclusive (write) lock -- then other locks
* should cause [](cfish:.Request) to fail.
*
- * @return true on success, false on failure (sets Err_error).
+ * @return true on success, false on failure (sets the global error object
+ * returned by [](cfish:cfish.Err.get_error)).
*/
public abstract bool
Request(Lock *self);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/OutStream.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/OutStream.cfh b/core/Lucy/Store/OutStream.cfh
index 5ffc9ca..6bcacac 100644
--- a/core/Lucy/Store/OutStream.cfh
+++ b/core/Lucy/Store/OutStream.cfh
@@ -38,7 +38,8 @@ class Lucy::Store::OutStream inherits Clownfish::Obj {
inert incremented nullable OutStream*
open(Obj *file);
- /** Return a new OutStream or set Err_error and return NULL on failure.
+ /** Return a new OutStream or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*/
inert nullable OutStream*
do_open(OutStream *self, Obj *file);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Store/RAMFileHandle.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.cfh b/core/Lucy/Store/RAMFileHandle.cfh
index 51469f6..e5a859b 100644
--- a/core/Lucy/Store/RAMFileHandle.cfh
+++ b/core/Lucy/Store/RAMFileHandle.cfh
@@ -32,8 +32,8 @@ class Lucy::Store::RAMFileHandle nickname RAMFH
open(String *path = NULL, uint32_t flags, RAMFile *file = NULL);
/**
- * Return a new RAMFileHandle, or set Err_error and return NULL on
- * failure.
+ * Return a new RAMFileHandle, or set the global error object returned by
+ * [](cfish:cfish.Err.get_error) and return NULL on failure.
*
* @param path Filepath.
* @param flags FileHandle flags.
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Store/TestCompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileReader.c b/core/Lucy/Test/Store/TestCompoundFileReader.c
index 8ed48bc..a7be1d2 100644
--- a/core/Lucy/Test/Store/TestCompoundFileReader.c
+++ b/core/Lucy/Test/Store/TestCompoundFileReader.c
@@ -96,7 +96,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when cfmeta file missing");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when cfmeta file missing");
+ "Set global error when cfmeta file missing");
DECREF(real_folder);
Err_set_error(NULL);
@@ -106,7 +106,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when cf.dat file missing");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when cf.dat file missing");
+ "Set global error when cf.dat file missing");
DECREF(real_folder);
Err_set_error(NULL);
@@ -119,7 +119,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when format is invalid");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when format is invalid");
+ "Set global error when format is invalid");
Err_set_error(NULL);
Hash_Store_Utf8(metadata, "format", 6, (Obj*)Str_newf("%i32", 1000));
@@ -129,7 +129,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when format is too recent");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when format too recent");
+ "Set global error when format too recent");
Err_set_error(NULL);
DECREF(Hash_Delete_Utf8(metadata, "format", 6));
@@ -139,7 +139,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when format key is missing");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when format key is missing");
+ "Set global error when format key is missing");
Hash_Store_Utf8(metadata, "format", 6,
(Obj*)Str_newf("%i32", CFWriter_current_file_format));
@@ -150,7 +150,7 @@ test_open(TestBatchRunner *runner) {
TEST_TRUE(runner, cf_reader == NULL,
"Return NULL when files key is missing");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Set Err_error when files key is missing");
+ "Set global error when files key is missing");
DECREF(metadata);
DECREF(real_folder);
@@ -182,13 +182,13 @@ test_Local_MkDir_and_Find_Folder(TestBatchRunner *runner) {
TEST_FALSE(runner, CFReader_MkDir(cf_reader, stuff),
"MkDir returns false when dir already exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "MkDir sets Err_error when dir already exists");
+ "MkDir sets global error when dir already exists");
Err_set_error(NULL);
TEST_FALSE(runner, CFReader_MkDir(cf_reader, foo),
"MkDir returns false when virtual file exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "MkDir sets Err_error when virtual file exists");
+ "MkDir sets global error when virtual file exists");
TEST_TRUE(runner,
CFReader_Find_Folder(cf_reader, foo) == NULL,
@@ -295,7 +295,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner) {
TEST_TRUE(runner, fh == NULL,
"Local_Open_FileHandle for non-existent file returns NULL");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_Open_FileHandle for non-existent file sets Err_error");
+ "Local_Open_FileHandle for non-existent file sets global error");
Err_set_error(NULL);
fh = CFReader_Local_Open_FileHandle(cf_reader, foo,
@@ -303,7 +303,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner) {
TEST_TRUE(runner, fh == NULL,
"Local_Open_FileHandle for virtual file returns NULL");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_Open_FileHandle for virtual file sets Err_error");
+ "Local_Open_FileHandle for virtual file sets global error");
DECREF(cf_reader);
DECREF(real_folder);
@@ -337,7 +337,7 @@ test_Local_Open_In(TestBatchRunner *runner) {
TEST_TRUE(runner, instream == NULL,
"Local_Open_In for non-existent file returns NULL");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_Open_In for non-existent file sets Err_error");
+ "Local_Open_In for non-existent file sets global error");
DECREF(cf_reader);
DECREF(real_folder);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Store/TestFSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFileHandle.c b/core/Lucy/Test/Store/TestFSFileHandle.c
index 53362f9..418d704 100644
--- a/core/Lucy/Test/Store/TestFSFileHandle.c
+++ b/core/Lucy/Test/Store/TestFSFileHandle.c
@@ -186,7 +186,7 @@ test_Close(TestBatchRunner *runner) {
bool result = FSFH_Close(fh);
TEST_FALSE(runner, result, "Failed Close() returns false");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed Close() sets Err_error");
+ "Failed Close() sets global error");
FSFH_IVARS(fh)->fd = saved_fd;
#endif /* _MSC_VER */
DECREF(fh);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Store/TestFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFolder.c b/core/Lucy/Test/Store/TestFolder.c
index 478b207..11a2594 100644
--- a/core/Lucy/Test/Store/TestFolder.c
+++ b/core/Lucy/Test/Store/TestFolder.c
@@ -132,7 +132,7 @@ test_MkDir_and_Is_Directory(TestBatchRunner *runner) {
TEST_FALSE(runner, Folder_MkDir(folder, foo_bar_baz),
"MkDir for deeply nested dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "MkDir for deeply nested dir sets Err_error");
+ "MkDir for deeply nested dir sets global error");
TEST_TRUE(runner, Folder_MkDir(folder, foo_bar),
"MkDir for nested dir");
@@ -143,7 +143,7 @@ test_MkDir_and_Is_Directory(TestBatchRunner *runner) {
TEST_FALSE(runner, Folder_MkDir(folder, foo_bar),
"Overwrite dir with MkDir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Overwrite dir with MkDir sets Err_error");
+ "Overwrite dir with MkDir sets global error");
fh = Folder_Open_FileHandle(folder, foo_boffo,
FH_CREATE | FH_WRITE_ONLY);
@@ -152,7 +152,7 @@ test_MkDir_and_Is_Directory(TestBatchRunner *runner) {
TEST_FALSE(runner, Folder_MkDir(folder, foo_boffo),
"Overwrite file with MkDir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Overwrite file with MkDir sets Err_error");
+ "Overwrite file with MkDir sets global error");
TEST_FALSE(runner, Folder_Is_Directory(folder, foo_boffo),
"Is_Directory() false for nested file");
@@ -284,14 +284,14 @@ test_Open_Dir(TestBatchRunner *runner) {
TEST_TRUE(runner, dh == NULL,
"Open_Dir on non-existent entry fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_Dir on non-existent entry sets Err_error");
+ "Open_Dir on non-existent entry sets global error");
Err_set_error(NULL);
dh = Folder_Open_Dir(folder, foo_foo);
TEST_TRUE(runner, dh == NULL,
"Open_Dir on non-existent nested entry fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_Dir on non-existent nested entry sets Err_error");
+ "Open_Dir on non-existent nested entry sets global error");
DECREF(folder);
}
@@ -318,7 +318,7 @@ test_Open_FileHandle(TestBatchRunner *runner) {
TEST_TRUE(runner, fh == NULL,
"Open_FileHandle on existing dir path fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_FileHandle on existing dir name sets Err_error");
+ "Open_FileHandle on existing dir name sets global error");
Err_set_error(NULL);
fh = Folder_Open_FileHandle(folder, foo_bar_baz_boffo,
@@ -326,7 +326,7 @@ test_Open_FileHandle(TestBatchRunner *runner) {
TEST_TRUE(runner, fh == NULL,
"Open_FileHandle for entry within non-existent dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_FileHandle for entry within non-existent dir sets Err_error");
+ "Open_FileHandle for entry within non-existent dir sets global error");
DECREF(folder);
}
@@ -353,21 +353,21 @@ test_Open_Out(TestBatchRunner *runner) {
TEST_TRUE(runner, outstream == NULL,
"Open_OutStream on existing file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_Out on existing file sets Err_error");
+ "Open_Out on existing file sets global error");
Err_set_error(NULL);
outstream = Folder_Open_Out(folder, foo);
TEST_TRUE(runner, outstream == NULL,
"Open_OutStream on existing dir path fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_Out on existing dir name sets Err_error");
+ "Open_Out on existing dir name sets global error");
Err_set_error(NULL);
outstream = Folder_Open_Out(folder, foo_bar_baz_boffo);
TEST_TRUE(runner, outstream == NULL,
"Open_Out for entry within non-existent dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_Out for entry within non-existent dir sets Err_error");
+ "Open_Out for entry within non-existent dir sets global error");
DECREF(folder);
}
@@ -400,14 +400,14 @@ test_Open_In(TestBatchRunner *runner) {
TEST_TRUE(runner, instream == NULL,
"Open_InStream on existing dir path fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_In on existing dir name sets Err_error");
+ "Open_In on existing dir name sets global error");
Err_set_error(NULL);
instream = Folder_Open_In(folder, foo_bar_baz_boffo);
TEST_TRUE(runner, instream == NULL,
"Open_In for entry within non-existent dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Open_In for entry within non-existent dir sets Err_error");
+ "Open_In for entry within non-existent dir sets global error");
DECREF(folder);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Store/TestFolderCommon.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFolderCommon.c b/core/Lucy/Test/Store/TestFolderCommon.c
index ce13170..27fcf33 100644
--- a/core/Lucy/Test/Store/TestFolderCommon.c
+++ b/core/Lucy/Test/Store/TestFolderCommon.c
@@ -181,7 +181,7 @@ test_Local_MkDir(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down
TEST_FALSE(runner, result,
"Local_MkDir returns false when a dir already exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_MkDir sets Err_error when a dir already exists");
+ "Local_MkDir sets global error when a dir already exists");
TEST_TRUE(runner, Folder_Exists(folder, foo),
"Existing dir untouched after failed Local_MkDir");
@@ -192,7 +192,7 @@ test_Local_MkDir(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down
TEST_FALSE(runner, result,
"Local_MkDir returns false when a file already exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_MkDir sets Err_error when a file already exists");
+ "Local_MkDir sets global error when a file already exists");
TEST_TRUE(runner, Folder_Exists(folder, boffo) &&
!Folder_Local_Is_Directory(folder, boffo),
"Existing file untouched after failed Local_MkDir");
@@ -237,7 +237,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner, set_up_t set_up,
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
TEST_TRUE(runner, fh == NULL, "FH_EXLUSIVE flag prevents clobber");
TEST_TRUE(runner, Err_get_error() != NULL,
- "failure due to FH_EXLUSIVE flag sets Err_error");
+ "failure due to FH_EXLUSIVE flag sets global error");
fh = Folder_Local_Open_FileHandle(folder, boffo, FH_READ_ONLY);
TEST_TRUE(runner, fh && FH_Is_A(fh, FILEHANDLE),
@@ -249,7 +249,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner, set_up_t set_up,
TEST_TRUE(runner, fh == NULL,
"Can't open non-existent file for reading");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Opening non-existent file for reading sets Err_error");
+ "Opening non-existent file for reading sets global error");
Folder_Delete(folder, boffo);
DECREF(folder);
@@ -371,7 +371,7 @@ test_Rename(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down) {
result = Folder_Rename(folder, foo_boffo, foo_bar);
TEST_FALSE(runner, result, "Rename file clobbering dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed rename sets Err_error");
+ "Failed rename sets global error");
TEST_TRUE(runner, Folder_Exists(folder, foo_boffo),
"File still exists at old path");
TEST_TRUE(runner, Folder_Exists(folder, foo_bar),
@@ -381,7 +381,7 @@ test_Rename(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down) {
result = Folder_Rename(folder, foo_bar, foo_boffo);
TEST_FALSE(runner, result, "Rename dir clobbering file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed rename sets Err_error");
+ "Failed rename sets global error");
TEST_TRUE(runner, Folder_Exists(folder, foo_bar),
"Dir still exists at old path");
TEST_TRUE(runner, Folder_Exists(folder, foo_boffo),
@@ -405,7 +405,7 @@ test_Rename(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down) {
result = Folder_Rename(folder, foo_boffo, nope_nyet);
TEST_FALSE(runner, result, "Rename into non-existent subdir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Renaming into non-existent subdir sets Err_error");
+ "Renaming into non-existent subdir sets global error");
TEST_TRUE(runner, Folder_Exists(folder, foo_boffo),
"Entry still exists at old path");
@@ -413,7 +413,7 @@ test_Rename(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down) {
result = Folder_Rename(folder, nope_nyet, boffo);
TEST_FALSE(runner, result, "Rename non-existent file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Renaming non-existent source file sets Err_error");
+ "Renaming non-existent source file sets global error");
Folder_Delete(folder, foo_bar_baz);
Folder_Delete(folder, foo_bar);
@@ -505,7 +505,7 @@ test_Hard_Link(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down)
result = Folder_Rename(folder, foo_boffo, nope_nyet);
TEST_FALSE(runner, result, "Hard_Link into non-existent subdir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Hard_Link into non-existent subdir sets Err_error");
+ "Hard_Link into non-existent subdir sets global error");
TEST_TRUE(runner, Folder_Exists(folder, foo_boffo),
"Entry still exists at old path");
@@ -513,7 +513,7 @@ test_Hard_Link(TestBatchRunner *runner, set_up_t set_up, tear_down_t tear_down)
result = Folder_Rename(folder, nope_nyet, boffo);
TEST_FALSE(runner, result, "Hard_Link non-existent source file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Hard_Link non-existent source file sets Err_error");
+ "Hard_Link non-existent source file sets global error");
Folder_Delete(folder, foo_bar);
Folder_Delete(folder, foo_boffo);
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Store/TestRAMFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestRAMFolder.c b/core/Lucy/Test/Store/TestRAMFolder.c
index 01b9f8f..7532354 100644
--- a/core/Lucy/Test/Store/TestRAMFolder.c
+++ b/core/Lucy/Test/Store/TestRAMFolder.c
@@ -178,7 +178,7 @@ test_Local_MkDir(TestBatchRunner *runner) {
TEST_FALSE(runner, result,
"Local_MkDir returns false when a dir already exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_MkDir sets Err_error when a dir already exists");
+ "Local_MkDir sets global error when a dir already exists");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo),
"Existing dir untouched after failed Local_MkDir");
@@ -190,7 +190,7 @@ test_Local_MkDir(TestBatchRunner *runner) {
TEST_FALSE(runner, result,
"Local_MkDir returns false when a file already exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Local_MkDir sets Err_error when a file already exists");
+ "Local_MkDir sets global error when a file already exists");
TEST_TRUE(runner, RAMFolder_Exists(folder, boffo) &&
!RAMFolder_Local_Is_Directory(folder, boffo),
"Existing file untouched after failed Local_MkDir");
@@ -230,7 +230,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner) {
FH_CREATE | FH_WRITE_ONLY | FH_EXCLUSIVE);
TEST_TRUE(runner, fh == NULL, "FH_EXLUSIVE flag prevents open");
TEST_TRUE(runner, Err_get_error() != NULL,
- "failure due to FH_EXLUSIVE flag sets Err_error");
+ "failure due to FH_EXLUSIVE flag sets global error");
fh = RAMFolder_Local_Open_FileHandle(folder, boffo, FH_READ_ONLY);
TEST_TRUE(runner, fh && FH_Is_A(fh, RAMFILEHANDLE),
@@ -242,7 +242,7 @@ test_Local_Open_FileHandle(TestBatchRunner *runner) {
TEST_TRUE(runner, fh == NULL,
"Can't open non-existent file for reading");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Opening non-existent file for reading sets Err_error");
+ "Opening non-existent file for reading sets global error");
DECREF(folder);
}
@@ -347,7 +347,7 @@ test_Rename(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, foo_boffo, foo_bar);
TEST_FALSE(runner, result, "Rename file clobbering dir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed rename sets Err_error");
+ "Failed rename sets global error");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_boffo),
"File still exists at old path");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_bar),
@@ -357,7 +357,7 @@ test_Rename(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, foo_bar, foo_boffo);
TEST_FALSE(runner, result, "Rename dir clobbering file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed rename sets Err_error");
+ "Failed rename sets global error");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_bar),
"Dir still exists at old path");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_boffo),
@@ -381,7 +381,7 @@ test_Rename(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, foo_boffo, nope_nyet);
TEST_FALSE(runner, result, "Rename into non-existent subdir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Renaming into non-existent subdir sets Err_error");
+ "Renaming into non-existent subdir sets global error");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_boffo),
"Entry still exists at old path");
@@ -389,7 +389,7 @@ test_Rename(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, nope_nyet, boffo);
TEST_FALSE(runner, result, "Rename non-existent file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Renaming non-existent source file sets Err_error");
+ "Renaming non-existent source file sets global error");
DECREF(folder);
}
@@ -476,7 +476,7 @@ test_Hard_Link(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, foo_boffo, nope_nyet);
TEST_FALSE(runner, result, "Hard_Link into non-existent subdir fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Hard_Link into non-existent subdir sets Err_error");
+ "Hard_Link into non-existent subdir sets global error");
TEST_TRUE(runner, RAMFolder_Exists(folder, foo_boffo),
"Entry still exists at old path");
@@ -484,7 +484,7 @@ test_Hard_Link(TestBatchRunner *runner) {
result = RAMFolder_Rename(folder, nope_nyet, boffo);
TEST_FALSE(runner, result, "Hard_Link non-existent source file fails");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Hard_Link non-existent source file sets Err_error");
+ "Hard_Link non-existent source file sets global error");
DECREF(folder);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Test/Util/TestJson.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c
index 9b8d4ed..10c6f7d 100644
--- a/core/Lucy/Test/Util/TestJson.c
+++ b/core/Lucy/Test/Util/TestJson.c
@@ -47,7 +47,7 @@ test_tolerance(TestBatchRunner *runner) {
TEST_TRUE(runner, not_json == NULL,
"to_json returns NULL when fed invalid data type");
TEST_TRUE(runner, Err_get_error() != NULL,
- "to_json sets Err_error when fed invalid data type");
+ "to_json sets global error when fed invalid data type");
DECREF(foo);
}
@@ -216,7 +216,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
result = Json_spew_json(dump, folder, foo);
TEST_FALSE(runner, result, "Can't spew_json when file exists");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed spew_json sets Err_error");
+ "Failed spew_json sets global error");
Err_set_error(NULL);
String *bar = (String*)SSTR_WRAP_UTF8("bar", 3);
@@ -224,7 +224,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
TEST_TRUE(runner, got == NULL,
"slurp_json returns NULL when file doesn't exist");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed slurp_json sets Err_error");
+ "Failed slurp_json sets global error");
String *boffo = (String*)SSTR_WRAP_UTF8("boffo", 5);
@@ -238,7 +238,7 @@ test_spew_and_slurp(TestBatchRunner *runner) {
TEST_TRUE(runner, got == NULL,
"slurp_json returns NULL when file doesn't contain valid JSON");
TEST_TRUE(runner, Err_get_error() != NULL,
- "Failed slurp_json sets Err_error");
+ "Failed slurp_json sets global error");
DECREF(got);
DECREF(dump);
@@ -251,8 +251,8 @@ S_verify_bad_syntax(TestBatchRunner *runner, const char *bad, const char *mess)
Err_set_error(NULL);
Obj *not_json = Json_from_json((String*)has_errors);
TEST_TRUE(runner, not_json == NULL, "from_json returns NULL: %s", mess);
- TEST_TRUE(runner, Err_get_error() != NULL, "from_json sets Err_error: %s",
- mess);
+ TEST_TRUE(runner, Err_get_error() != NULL,
+ "from_json sets global error: %s", mess);
}
static void
@@ -332,7 +332,7 @@ test_max_depth(TestBatchRunner *runner) {
TEST_TRUE(runner, not_json == NULL,
"to_json returns NULL when fed recursing data");
TEST_TRUE(runner, Err_get_error() != NULL,
- "to_json sets Err_error when fed recursing data");
+ "to_json sets global error when fed recursing data");
DECREF(Hash_Delete_Utf8(circular, "circular", 8));
DECREF(circular);
}
@@ -347,7 +347,7 @@ test_illegal_keys(TestBatchRunner *runner) {
TEST_TRUE(runner, not_json == NULL,
"to_json returns NULL when fed an illegal key");
TEST_TRUE(runner, Err_get_error() != NULL,
- "to_json sets Err_error when fed an illegal key");
+ "to_json sets global error when fed an illegal key");
DECREF(key);
DECREF(hash);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Util/Json.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c
index 1d8ea9c..92a3e2e 100644
--- a/core/Lucy/Util/Json.c
+++ b/core/Lucy/Util/Json.c
@@ -39,8 +39,8 @@ LucyParseJsonFree(void *json_parser, void(*freemem)(void*));
void
LucyParseJsonTrace(FILE *trace, char *line_prefix);
-// Encode JSON for supplied "dump". On failure, sets Err_error and returns
-// false.
+// Encode JSON for supplied "dump". On failure, sets the global error object
+// and returns false.
static bool
S_to_json(Obj *dump, CharBuf *buf, int32_t depth);
@@ -84,7 +84,8 @@ static const size_t INDENTATION_LEN = sizeof(indentation) - 1;
static void
S_cat_whitespace(CharBuf *buf, int32_t depth);
-// Set Err_error, appending escaped JSON in the vicinity of the error.
+// Set the global error object, appending escaped JSON in the vicinity of the
+// error.
static void
S_set_error(CharBuf *buf, const char *json, const char *limit, int line,
const char *func);
@@ -696,7 +697,7 @@ S_set_error(CharBuf *buf, const char *json, const char *limit, int line,
String *mess = CB_Yield_String(buf);
DECREF(buf);
- // Set Err_error.
+ // Set global error object.
Err_set_error(Err_new(mess));
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/516bea18/core/Lucy/Util/Json.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Json.cfh b/core/Lucy/Util/Json.cfh
index daa3f86..631cf23 100644
--- a/core/Lucy/Util/Json.cfh
+++ b/core/Lucy/Util/Json.cfh
@@ -22,30 +22,32 @@ parcel Lucy;
*/
class Lucy::Util::Json inherits Clownfish::Obj {
- /** Encode `dump` as JSON. Returns NULL and sets Err_error on
- * failure.
+ /** Encode `dump` as JSON. Returns NULL and sets the global error object
+ * returned by [](cfish:cfish.Err.get_error) on failure.
*/
inert incremented nullable String*
to_json(Obj *dump);
/** Decode the supplied JSON and return a data structure made
- * of Hashes, VArrays, and Strings. Returns NULL and sets Err_error on
- * failure.
+ * of Hashes, VArrays, and Strings. Returns NULL and sets the global
+ * error object returned by [](cfish:cfish.Err.get_error) on failure.
*/
inert incremented nullable Obj*
from_json(String *json);
/** Encode `dump` as JSON and attempt to write to the indicated
* file.
- * @return true if the write succeeds, false on failure (sets Err_error).
+ * @return true if the write succeeds, false on failure (sets the global
+ * error object returned by [](cfish:cfish.Err.get_error)).
*/
inert bool
spew_json(Obj *dump, Folder *folder, String *path);
/** Decode the JSON in the file at `path` and return a data
* structure made of Hashes, VArrays, and Strings. Returns NULL and sets
- * Err_error if the file can't be can't be opened or if the file doesn't
- * contain valid JSON.
+ * the global error object returned by [](cfish:cfish.Err.get_error) if
+ * the file can't be can't be opened or if the file doesn't contain valid
+ * JSON.
*/
inert incremented nullable Obj*
slurp_json(Folder *folder, String *path);