From: Martin Mares Date: Sat, 10 Jul 2004 20:36:06 +0000 (+0000) Subject: Gone (some functions moved to the main lib, some were unused). X-Git-Tag: holmes-import~956 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=106de30bf6ec045259e95e95205e7195e1250fa4;p=libucw.git Gone (some functions moved to the main lib, some were unused). --- diff --git a/charset/debug.c b/charset/debug.c deleted file mode 100644 index 197739b6..00000000 --- a/charset/debug.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The UniCode Library -- Debugging Support Functions - * - * (c) 1997 Martin Mares - * - * This software may be freely distributed and used according to the terms - * of the GNU Lesser General Public License. - */ - -#include "lib/lib.h" -#include "charset/unicode.h" - -static byte * -get_static_buffer(uns size) -{ - static byte *static_debug_buffer; - static uns static_debug_size; - - if (!static_debug_buffer) - { - if (size < 1024) - size = 1024; - static_debug_buffer = xmalloc(size); - static_debug_size = size; - } - else if (static_debug_size < size) - { - size = (size+1023) & ~1023; - static_debug_buffer = xrealloc(static_debug_buffer, size); - static_debug_size = size; - } - return static_debug_buffer; -} - -byte * -static_ucs2_to_utf8(word *w) -{ - byte *buf = get_static_buffer(Ustrlen(w) * 3 + 1); - - ucs2_to_utf8(buf, w); - return buf; -} diff --git a/charset/strlen.c b/charset/strlen.c deleted file mode 100644 index 1fb0f756..00000000 --- a/charset/strlen.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The UniCode Library -- String Length - * - * (c) 1997--2003 Martin Mares - * (c) 2003 Robert Spalek - * - * This software may be freely distributed and used according to the terms - * of the GNU Lesser General Public License. - */ - -#include "lib/lib.h" -#include "charset/unicode.h" - -uns -Ustrlen(word *w) -{ - word *z = w; - - while (*z) - z++; - return z - w; -} - -uns -utf8_strlen(byte *str) -{ - uns len = 0; - while (*str) - { - UTF8_SKIP(str); - len++; - } - return len; -} - -uns -utf8_strnlen(byte *str, uns n) -{ - uns len = 0; - byte *end = str + n; - while (str < end) - { - UTF8_SKIP(str); - len++; - } - return len; -} diff --git a/charset/utf8.c b/charset/utf8.c deleted file mode 100644 index 09f924ae..00000000 --- a/charset/utf8.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The UniCode Library -- UTF-8 Functions - * - * (c) 1997 Martin Mares - * - * This software may be freely distributed and used according to the terms - * of the GNU Lesser General Public License. - */ - -#include "lib/lib.h" -#include "charset/unicode.h" - -uns -ucs2_to_utf8(byte *d, word *s) -{ - byte *d0 = d; - - while (*s) - { - uns u = *s++; - PUT_UTF8(d,u); - } - *d = 0; - return d - d0; -} - -uns -utf8_to_ucs2(word *d, byte *s) -{ - word *d0 = d; - - while (*s) - if (IS_UTF8(*s)) - { - uns u; - GET_UTF8_CHAR(s,u); - *d++ = u; - } - else if (*s >= 0x80) - *d++ = UNI_REPLACEMENT; - else - *d++ = *s++; - *d = 0; - return d - d0; -}