lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [40/50] [abbrv] git commit: refs/heads/master - Remove useless function S_grow in CharBuf
Date Fri, 11 Oct 2013 13:32:18 GMT
Remove useless function S_grow in CharBuf


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

Branch: refs/heads/master
Commit: 256d32c0ec7e0ac85d6f27cea25a78b06b17a841
Parents: f079ab9
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Sep 28 18:23:26 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Fri Oct 11 15:28:20 2013 +0200

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/CharBuf.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/256d32c0/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 893d0f5..6eb9c2e 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -116,13 +116,6 @@ CB_Destroy_IMP(CharBuf *self) {
     SUPER_DESTROY(self, CHARBUF);
 }
 
-static void
-S_grow(CharBuf *self, size_t size) {
-    if (size >= self->cap) {
-        CB_Grow(self, size);
-    }
-}
-
 char*
 CB_Grow_IMP(CharBuf *self, size_t size) {
     if (size >= self->cap) {
@@ -315,7 +308,7 @@ void
 CB_Cat_Char_IMP(CharBuf *self, int32_t code_point) {
     const size_t MAX_UTF8_BYTES = 4;
     if (self->size + MAX_UTF8_BYTES >= self->cap) {
-        S_grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
+        CB_Grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
                                      sizeof(char)));
     }
     char *end = self->ptr + self->size;
@@ -334,7 +327,7 @@ CB_Mimic_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
     if (!StrHelp_utf8_valid(ptr, size)) {
         DIE_INVALID_UTF8(ptr, size);
     }
-    if (size >= self->cap) { S_grow(self, size); }
+    if (size >= self->cap) { CB_Grow(self, size); }
     memmove(self->ptr, ptr, size);
     self->size = size;
     self->ptr[size] = '\0';
@@ -344,14 +337,14 @@ void
 CB_Mimic_IMP(CharBuf *self, Obj *other) {
     if (Obj_Is_A(other, CHARBUF)) {
         CharBuf *twin = (CharBuf*)other;
-        if (twin->size >= self->cap) { S_grow(self, twin->size); }
+        if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
         memmove(self->ptr, twin->ptr, twin->size);
         self->size = twin->size;
         self->ptr[twin->size] = '\0';
     }
     else if (Obj_Is_A(other, STRING)) {
         String *twin = (String*)other;
-        if (twin->size >= self->cap) { S_grow(self, twin->size); }
+        if (twin->size >= self->cap) { CB_Grow(self, twin->size); }
         memmove(self->ptr, twin->ptr, twin->size);
         self->size = twin->size;
         self->ptr[twin->size] = '\0';
@@ -374,7 +367,7 @@ CB_Cat_Trusted_Utf8_IMP(CharBuf *self, const char* ptr, size_t size) {
     const size_t new_size = self->size + size;
     if (new_size >= self->cap) {
         size_t amount = Memory_oversize(new_size, sizeof(char));
-        S_grow(self, amount);
+        CB_Grow(self, amount);
     }
     memcpy((self->ptr + self->size), ptr, size);
     self->size = new_size;
@@ -386,7 +379,7 @@ CB_Cat_IMP(CharBuf *self, String *string) {
     const size_t new_size = self->size + string->size;
     if (new_size >= self->cap) {
         size_t amount = Memory_oversize(new_size, sizeof(char));
-        S_grow(self, amount);
+        CB_Grow(self, amount);
     }
     memcpy((self->ptr + self->size), string->ptr, string->size);
     self->size = new_size;


Mime
View raw message