diff options
| -rw-r--r-- | src/common/utils.c | 6 | ||||
| -rw-r--r-- | tests/common/check_utils.c | 36 | 
2 files changed, 21 insertions, 21 deletions
| diff --git a/src/common/utils.c b/src/common/utils.c index 8397419..f745146 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -6,7 +6,7 @@   * See the file LICENSE.   */ -#define SB_STRING_CHUNK_SIZE 128 +#define BC_STRING_CHUNK_SIZE 128  #include <string.h>  #include <stdarg.h> @@ -389,7 +389,7 @@ bc_string_append_len(bc_string_t *str, const char *suffix, size_t len)      size_t old_len = str->len;      str->len += len;      if (str->len + 1 > str->allocated_len) { -        str->allocated_len = (((str->len + 1) / SB_STRING_CHUNK_SIZE) + 1) * SB_STRING_CHUNK_SIZE; +        str->allocated_len = (((str->len + 1) / BC_STRING_CHUNK_SIZE) + 1) * BC_STRING_CHUNK_SIZE;          str->str = bc_realloc(str->str, str->allocated_len);      }      memcpy(str->str + old_len, suffix, len); @@ -416,7 +416,7 @@ bc_string_append_c(bc_string_t *str, char c)      size_t old_len = str->len;      str->len += 1;      if (str->len + 1 > str->allocated_len) { -        str->allocated_len = (((str->len + 1) / SB_STRING_CHUNK_SIZE) + 1) * SB_STRING_CHUNK_SIZE; +        str->allocated_len = (((str->len + 1) / BC_STRING_CHUNK_SIZE) + 1) * BC_STRING_CHUNK_SIZE;          str->str = bc_realloc(str->str, str->allocated_len);      }      str->str[old_len] = c; diff --git a/tests/common/check_utils.c b/tests/common/check_utils.c index 9d49434..f761cd8 100644 --- a/tests/common/check_utils.c +++ b/tests/common/check_utils.c @@ -14,7 +14,7 @@  #include <stdlib.h>  #include "../../src/common/utils.h" -#define SB_STRING_CHUNK_SIZE 128 +#define BC_STRING_CHUNK_SIZE 128  static void @@ -302,7 +302,7 @@ test_string_new(void **state)      assert_non_null(str);      assert_string_equal(str->str, "");      assert_int_equal(str->len, 0); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));  } @@ -314,7 +314,7 @@ test_string_free(void **state)      free(str->str);      str->str = bc_strdup("bola");      str->len = 4; -    str->allocated_len = SB_STRING_CHUNK_SIZE; +    str->allocated_len = BC_STRING_CHUNK_SIZE;      char *tmp = bc_string_free(str, false);      assert_string_equal(tmp, "bola");      free(tmp); @@ -329,12 +329,12 @@ test_string_dup(void **state)      free(str->str);      str->str = bc_strdup("bola");      str->len = 4; -    str->allocated_len = SB_STRING_CHUNK_SIZE; +    str->allocated_len = BC_STRING_CHUNK_SIZE;      bc_string_t *new = bc_string_dup(str);      assert_non_null(new);      assert_string_equal(new->str, "bola");      assert_int_equal(new->len, 4); -    assert_int_equal(new->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(new->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(new, true));      assert_null(bc_string_free(str, true));      assert_null(bc_string_dup(NULL)); @@ -349,7 +349,7 @@ test_string_append_len(void **state)      assert_non_null(str);      assert_string_equal(str->str, "guda");      assert_int_equal(str->len, 4); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append_len(str, "guda", 4); @@ -357,7 +357,7 @@ test_string_append_len(void **state)      assert_non_null(str);      assert_string_equal(str->str, "gudabola");      assert_int_equal(str->len, 8); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append_len(str, "guda", 3); @@ -365,7 +365,7 @@ test_string_append_len(void **state)      assert_non_null(str);      assert_string_equal(str->str, "gudbola");      assert_int_equal(str->len, 7); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append_len(str, "guda", 4); @@ -411,14 +411,14 @@ test_string_append_len(void **state)          "pdnqokswiondusnuymqwaryrmdgscbnuilxtypuynckancsfnwtgokxhegoifakimxbba"          "fkeannglvsxprqzfekdinssqymtfexf");      assert_int_equal(str->len, 1204); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 10); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE * 10);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append_len(str, NULL, 0);      assert_non_null(str);      assert_string_equal(str->str, "");      assert_int_equal(str->len, 0); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      assert_null(bc_string_append_len(NULL, "foo", 3));  } @@ -432,7 +432,7 @@ test_string_append(void **state)      assert_non_null(str);      assert_string_equal(str->str, "guda");      assert_int_equal(str->len, 4); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append(str, "guda"); @@ -440,7 +440,7 @@ test_string_append(void **state)      assert_non_null(str);      assert_string_equal(str->str, "gudabola");      assert_int_equal(str->len, 8); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append(str, "guda"); @@ -486,14 +486,14 @@ test_string_append(void **state)          "pdnqokswiondusnuymqwaryrmdgscbnuilxtypuynckancsfnwtgokxhegoifakimxbba"          "fkeannglvsxprqzfekdinssqymtfexf");      assert_int_equal(str->len, 1204); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 10); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE * 10);      assert_null(bc_string_free(str, true));      str = bc_string_new();      str = bc_string_append(str, NULL);      assert_non_null(str);      assert_string_equal(str->str, "");      assert_int_equal(str->len, 0); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      assert_null(bc_string_append(NULL, "asd"));      assert_null(bc_string_append(NULL, NULL)); @@ -519,7 +519,7 @@ test_string_append_c(void **state)          "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"          "cccccccccccccccccccccccccccccccccccccccccccccccccccc");      assert_int_equal(str->len, 604); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 5); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE * 5);      assert_null(bc_string_free(str, true));      assert_null(bc_string_append_c(NULL, 0));  } @@ -533,7 +533,7 @@ test_string_append_printf(void **state)      assert_non_null(str);      assert_string_equal(str->str, "guda: bola 1");      assert_int_equal(str->len, 12); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      assert_null(bc_string_append_printf(NULL, "asd"));  } @@ -547,12 +547,12 @@ test_string_append_escaped(void **state)      assert_non_null(str);      assert_string_equal(str->str, "");      assert_int_equal(str->len, 0); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      str = bc_string_append_escaped(str, "foo \\a bar \\\\ lol");      assert_non_null(str);      assert_string_equal(str->str, "foo a bar \\ lol");      assert_int_equal(str->len, 15); -    assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE); +    assert_int_equal(str->allocated_len, BC_STRING_CHUNK_SIZE);      assert_null(bc_string_free(str, true));      assert_null(bc_string_append_escaped(NULL, "asd"));  } | 
