diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-03-18 21:24:49 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-03-18 21:24:49 +0000 |
commit | 962f255ee8f271920e8901824ae30fa7a0b40804 (patch) | |
tree | 32c8466be03d668fc42360e5f415ad689c5c95f9 /utf8.c | |
parent | 1d6fe43c7b2250f042d0113da8545d5ebb75c01e (diff) | |
parent | 979313832ce1d5f6cdc2c512e8524d6c517422e0 (diff) |
Merge branch 'obsd-master'
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 60 |
1 files changed, 0 insertions, 60 deletions
@@ -408,66 +408,6 @@ utf8_cstrwidth(const char *s) return (width); } -/* Trim UTF-8 string to width. Caller frees. */ -char * -utf8_trimcstr(const char *s, u_int width) -{ - struct utf8_data *tmp, *next; - char *out; - u_int at; - - tmp = utf8_fromcstr(s); - - at = 0; - for (next = tmp; next->size != 0; next++) { - if (at + next->width > width) { - next->size = 0; - break; - } - at += next->width; - } - - out = utf8_tocstr(tmp); - free(tmp); - return (out); -} - -/* Trim UTF-8 string to width. Caller frees. */ -char * -utf8_rtrimcstr(const char *s, u_int width) -{ - struct utf8_data *tmp, *next, *end; - char *out; - u_int at; - - tmp = utf8_fromcstr(s); - - for (end = tmp; end->size != 0; end++) - /* nothing */; - if (end == tmp) { - free(tmp); - return (xstrdup("")); - } - next = end - 1; - - at = 0; - for (;;) { - if (at + next->width > width) { - next++; - break; - } - at += next->width; - - if (next == tmp) - break; - next--; - } - - out = utf8_tocstr(next); - free(tmp); - return (out); -} - /* Pad UTF-8 string to width. Caller frees. */ char * utf8_padcstr(const char *s, u_int width) |