aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c6
-rw-r--r--lib/lib.h2
-rw-r--r--lib/linestack.c3
-rw-r--r--lib/llist.c2
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 87bda4f6..9f9b8136 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -370,7 +370,7 @@ int wctoutf8(char *s, unsigned wc)
// Convert utf8 sequence to a unicode wide character
// returns bytes consumed, or -1 if err, or -2 if need more data.
-int utf8towc(wchar_t *wc, char *str, unsigned len)
+int utf8towc(unsigned *wc, char *str, unsigned len)
{
unsigned result, mask, first;
char *s, c;
@@ -403,7 +403,7 @@ char *strlower(char *s)
{
char *try, *new;
int len, mlen = (strlen(s)|7)+9;
- wchar_t c;
+ unsigned c;
try = new = xmalloc(mlen);
@@ -739,7 +739,7 @@ void loopfiles(char **argv, void (*function)(int fd, char *name))
loopfiles_rw(argv, O_RDONLY|O_CLOEXEC|WARN_ONLY, 0, function);
}
-// glue to call dl_lines() from loopfiles
+// glue to call do_lines() from loopfiles
static void (*do_lines_bridge)(char **pline, long len);
static void loopfile_lines_bridge(int fd, char *name)
{
diff --git a/lib/lib.h b/lib/lib.h
index f9c04281..cf1920f9 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -231,7 +231,7 @@ long long atolx(char *c);
long long atolx_range(char *numstr, long long low, long long high);
int stridx(char *haystack, char needle);
int wctoutf8(char *s, unsigned wc);
-int utf8towc(wchar_t *wc, char *str, unsigned len);
+int utf8towc(unsigned *wc, char *str, unsigned len);
char *strlower(char *s);
char *strafter(char *haystack, char *needle);
char *chomp(char *s);
diff --git a/lib/linestack.c b/lib/linestack.c
index 0fc83e6b..e6ae1b57 100644
--- a/lib/linestack.c
+++ b/lib/linestack.c
@@ -93,10 +93,9 @@ int crunch_str(char **str, int width, FILE *out, char *escmore,
{
int columns = 0, col, bytes;
char *start, *end;
+ unsigned wc;
for (end = start = *str; *end; columns += col, end += bytes) {
- wchar_t wc;
-
if ((bytes = utf8towc(&wc, end, 4))>0 && (col = wcwidth(wc))>=0) {
if (!escmore || wc>255 || !strchr(escmore, wc)) {
if (width-columns<col) break;
diff --git a/lib/llist.c b/lib/llist.c
index 45fe014d..e82cb954 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -82,6 +82,7 @@ void *dlist_lpop(void *list)
return v;
}
+// Append to list in-order (*list unchanged unless empty, ->prev is new node)
void dlist_add_nomalloc(struct double_list **list, struct double_list *new)
{
if (*list) {
@@ -92,7 +93,6 @@ void dlist_add_nomalloc(struct double_list **list, struct double_list *new)
} else *list = new->next = new->prev = new;
}
-
// Add an entry to the end of a doubly linked list
struct double_list *dlist_add(struct double_list **list, char *data)
{