summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-03-29 16:06:56 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-03-29 16:17:55 +0200
commitc9ea08d9b5c99f6f04935d2a60a7c197f391731c (patch)
tree07b0241edc3d97d05b79bdd4a82f21e5118cae3a /tests
parenta31455a10b1f95c821ca2a3ef639513f5549564c (diff)
unicode: use static global symbol table
A symbol table should never be created twice therefore we can make it static and global. We add locks so it is totally thread-safe, too. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_buffer.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/test_buffer.c b/tests/test_buffer.c
index d136d5c..ab6c9f6 100644
--- a/tests/test_buffer.c
+++ b/tests/test_buffer.c
@@ -102,34 +102,26 @@ static void test1(struct kmscon_buffer *buf)
static void test2()
{
- struct kmscon_symbol_table *st;
- int ret;
kmscon_symbol_t sym, sym2, sym3, sym4;
const uint32_t *str;
size_t len, i;
log_info("Test2:\n");
- ret = kmscon_symbol_table_new(&st);
- if (ret)
- return;
-
sym = kmscon_symbol_make('a');
- sym2 = kmscon_symbol_append(st, sym, '^');
- sym3 = kmscon_symbol_append(st, sym2, '^');
- sym4 = kmscon_symbol_append(st, sym, '^');
+ sym2 = kmscon_symbol_append(sym, '^');
+ sym3 = kmscon_symbol_append(sym2, '^');
+ sym4 = kmscon_symbol_append(sym, '^');
log_info("equality: %i %i %i\n", sym == sym2, sym2 == sym4,
sym3 == sym2);
- str = kmscon_symbol_get(st, &sym3, &len);
+ str = kmscon_symbol_get(&sym3, &len);
printf("sym3: ");
for (i = 0; i < len; ++i)
printf("%c", str[i]);
printf("\n");
-
- kmscon_symbol_table_unref(st);
}
static void test3()