You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/05/09 22:25:57 UTC
[2/5] lucy-clownfish git commit: Downcase LFReg routines to indicate
pure C.
Downcase LFReg routines to indicate pure C.
Replace Clownfish-method style capitalization with lowercasing to
connote that they are inert functions.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/aaa90295
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/aaa90295
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/aaa90295
Branch: refs/heads/master
Commit: aaa9029554303dbe3339b6ac1e4eda3be322d8c4
Parents: 09ab279
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed May 6 20:18:15 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed May 6 20:47:48 2015 -0700
----------------------------------------------------------------------
runtime/core/Clownfish/Class.c | 14 +++++++-------
runtime/core/Clownfish/LockFreeRegistry.c | 6 +++---
runtime/core/Clownfish/LockFreeRegistry.h | 12 ++++++------
runtime/core/Clownfish/Test/TestLockFreeRegistry.c | 14 +++++++-------
4 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aaa90295/runtime/core/Clownfish/Class.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c
index 40129f5..dbfeb30 100644
--- a/runtime/core/Clownfish/Class.c
+++ b/runtime/core/Clownfish/Class.c
@@ -250,7 +250,7 @@ Class_singleton(String *class_name, Class *parent) {
Class_init_registry();
}
- Class *singleton = (Class*)LFReg_Fetch(Class_registry, class_name);
+ Class *singleton = (Class*)LFReg_fetch(Class_registry, class_name);
if (singleton == NULL) {
Vector *fresh_host_methods;
uint32_t num_fresh;
@@ -309,7 +309,7 @@ Class_singleton(String *class_name, Class *parent) {
}
else {
DECREF(singleton);
- singleton = (Class*)LFReg_Fetch(Class_registry, class_name);
+ singleton = (Class*)LFReg_fetch(Class_registry, class_name);
if (!singleton) {
THROW(ERR, "Failed to either insert or fetch Class for '%o'",
class_name);
@@ -325,12 +325,12 @@ Class_add_to_registry(Class *klass) {
if (Class_registry == NULL) {
Class_init_registry();
}
- if (LFReg_Fetch(Class_registry, klass->name)) {
+ if (LFReg_fetch(Class_registry, klass->name)) {
return false;
}
else {
String *class_name = Str_Clone(klass->name);
- bool retval = LFReg_Register(Class_registry, class_name, (Obj*)klass);
+ bool retval = LFReg_register(Class_registry, class_name, (Obj*)klass);
DECREF(class_name);
return retval;
}
@@ -343,12 +343,12 @@ Class_add_alias_to_registry(Class *klass, const char *alias_ptr,
Class_init_registry();
}
StackString *alias = SSTR_WRAP_UTF8(alias_ptr, alias_len);
- if (LFReg_Fetch(Class_registry, (String*)alias)) {
+ if (LFReg_fetch(Class_registry, (String*)alias)) {
return false;
}
else {
String *class_name = SStr_Clone(alias);
- bool retval = LFReg_Register(Class_registry, class_name, (Obj*)klass);
+ bool retval = LFReg_register(Class_registry, class_name, (Obj*)klass);
DECREF(class_name);
return retval;
}
@@ -358,7 +358,7 @@ Class*
Class_fetch_class(String *class_name) {
Class *klass = NULL;
if (Class_registry != NULL) {
- klass = (Class*)LFReg_Fetch(Class_registry, class_name);
+ klass = (Class*)LFReg_fetch(Class_registry, class_name);
}
return klass;
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aaa90295/runtime/core/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/LockFreeRegistry.c b/runtime/core/Clownfish/LockFreeRegistry.c
index 5ab28fb..1e54218 100644
--- a/runtime/core/Clownfish/LockFreeRegistry.c
+++ b/runtime/core/Clownfish/LockFreeRegistry.c
@@ -53,7 +53,7 @@ LFReg_init(LockFreeRegistry *self, size_t capacity) {
}
bool
-LFReg_Register(LockFreeRegistry *self, String *key, Obj *value) {
+LFReg_register(LockFreeRegistry *self, String *key, Obj *value) {
LFRegEntry *new_entry = NULL;
int32_t hash_sum = Str_Hash_Sum(key);
size_t bucket = (uint32_t)hash_sum % self->capacity;
@@ -95,7 +95,7 @@ FIND_END_OF_LINKED_LIST:
}
Obj*
-LFReg_Fetch(LockFreeRegistry *self, String *key) {
+LFReg_fetch(LockFreeRegistry *self, String *key) {
int32_t hash_sum = Str_Hash_Sum(key);
size_t bucket = (uint32_t)hash_sum % self->capacity;
LFRegEntry **entries = (LFRegEntry**)self->entries;
@@ -114,7 +114,7 @@ LFReg_Fetch(LockFreeRegistry *self, String *key) {
}
void
-LFReg_Destroy(LockFreeRegistry *self) {
+LFReg_destroy(LockFreeRegistry *self) {
LFRegEntry **entries = (LFRegEntry**)self->entries;
for (size_t i = 0; i < self->capacity; i++) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aaa90295/runtime/core/Clownfish/LockFreeRegistry.h
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/LockFreeRegistry.h b/runtime/core/Clownfish/LockFreeRegistry.h
index e02910f..75c4fed 100644
--- a/runtime/core/Clownfish/LockFreeRegistry.h
+++ b/runtime/core/Clownfish/LockFreeRegistry.h
@@ -29,21 +29,21 @@ cfish_LockFreeRegistry*
cfish_LFReg_init(cfish_LockFreeRegistry *self, size_t capacity);
void
-CFISH_LFReg_Destroy(cfish_LockFreeRegistry *self);
+cfish_LFReg_destroy(cfish_LockFreeRegistry *self);
bool
-CFISH_LFReg_Register(cfish_LockFreeRegistry *self, struct cfish_String *key,
+cfish_LFReg_register(cfish_LockFreeRegistry *self, struct cfish_String *key,
struct cfish_Obj *value);
struct cfish_Obj*
-CFISH_LFReg_Fetch(cfish_LockFreeRegistry *self, struct cfish_String *key);
+cfish_LFReg_fetch(cfish_LockFreeRegistry *self, struct cfish_String *key);
#ifdef CFISH_USE_SHORT_NAMES
#define LockFreeRegistry cfish_LockFreeRegistry
#define LFReg_new cfish_LFReg_new
#define LFReg_init cfish_LFReg_init
- #define LFReg_Destroy CFISH_LFReg_Destroy
- #define LFReg_Register CFISH_LFReg_Register
- #define LFReg_Fetch CFISH_LFReg_Fetch
+ #define LFReg_destroy cfish_LFReg_destroy
+ #define LFReg_register cfish_LFReg_register
+ #define LFReg_fetch cfish_LFReg_fetch
#endif
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aaa90295/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
index 335d8c6..8f41f33 100644
--- a/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
+++ b/runtime/core/Clownfish/Test/TestLockFreeRegistry.c
@@ -53,27 +53,27 @@ test_all(TestBatchRunner *runner) {
StupidHashString *baz = StupidHashString_new("baz");
StupidHashString *foo_dupe = StupidHashString_new("foo");
- TEST_TRUE(runner, LFReg_Register(registry, (String*)foo, (Obj*)foo),
+ TEST_TRUE(runner, LFReg_register(registry, (String*)foo, (Obj*)foo),
"Register() returns true on success");
TEST_FALSE(runner,
- LFReg_Register(registry, (String*)foo_dupe, (Obj*)foo_dupe),
+ LFReg_register(registry, (String*)foo_dupe, (Obj*)foo_dupe),
"Can't Register() keys that test equal");
- TEST_TRUE(runner, LFReg_Register(registry, (String*)bar, (Obj*)bar),
+ TEST_TRUE(runner, LFReg_register(registry, (String*)bar, (Obj*)bar),
"Register() key with the same Hash_Sum but that isn't Equal");
- TEST_TRUE(runner, LFReg_Fetch(registry, (String*)foo_dupe) == (Obj*)foo,
+ TEST_TRUE(runner, LFReg_fetch(registry, (String*)foo_dupe) == (Obj*)foo,
"Fetch()");
- TEST_TRUE(runner, LFReg_Fetch(registry, (String*)bar) == (Obj*)bar,
+ TEST_TRUE(runner, LFReg_fetch(registry, (String*)bar) == (Obj*)bar,
"Fetch() again");
- TEST_TRUE(runner, LFReg_Fetch(registry, (String*)baz) == NULL,
+ TEST_TRUE(runner, LFReg_fetch(registry, (String*)baz) == NULL,
"Fetch() non-existent key returns NULL");
DECREF(foo_dupe);
DECREF(baz);
DECREF(bar);
DECREF(foo);
- LFReg_Destroy(registry);
+ LFReg_destroy(registry);
}
void