summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-04-11 20:54:06 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-04-11 20:54:06 +0000
commita92ad82749e70afe10b98ba3356bd38ba4594528 (patch)
treede1785998566f8ac9df17dce9475b2116cb7cf37 /lib
parentb4c93c7ba9d727cb7cd0cdbe52c0123401424db1 (diff)
Clean up chartype.h:
* not used in tokenizer.c * only use it for !NARROWCHAR * no need for underscores before ct_{de,en}code_string() * make the conversion buffer resize function private OK martijn@
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/chartype.c6
-rw-r--r--lib/libedit/chartype.h22
-rw-r--r--lib/libedit/history.c6
-rw-r--r--lib/libedit/tokenizer.c5
4 files changed, 14 insertions, 25 deletions
diff --git a/lib/libedit/chartype.c b/lib/libedit/chartype.c
index 5d94347e9df..298732d6e2e 100644
--- a/lib/libedit/chartype.c
+++ b/lib/libedit/chartype.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chartype.c,v 1.13 2016/04/11 20:43:33 schwarze Exp $ */
+/* $OpenBSD: chartype.c,v 1.14 2016/04/11 20:54:05 schwarze Exp $ */
/* $NetBSD: chartype.c,v 1.6 2011/07/28 00:48:21 christos Exp $ */
/*-
@@ -40,7 +40,9 @@
#define CT_BUFSIZ 1024
-protected void
+private void ct_conv_buff_resize(ct_buffer_t *, size_t, size_t);
+
+private void
ct_conv_buff_resize(ct_buffer_t *conv, size_t mincsize, size_t minwsize)
{
void *p;
diff --git a/lib/libedit/chartype.h b/lib/libedit/chartype.h
index 787520cc94f..2cc4bc719d4 100644
--- a/lib/libedit/chartype.h
+++ b/lib/libedit/chartype.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: chartype.h,v 1.17 2016/04/11 20:43:33 schwarze Exp $ */
-/* $NetBSD: chartype.h,v 1.5 2010/04/15 00:55:57 christos Exp $ */
+/* $OpenBSD: chartype.h,v 1.18 2016/04/11 20:54:05 schwarze Exp $ */
+/* $NetBSD: chartype.h,v 1.30 2016/04/11 16:06:52 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,8 +30,6 @@
#ifndef _h_chartype_f
#define _h_chartype_f
-#ifndef NARROWCHAR
-
/* Ideally we should also test the value of the define to see if it
* supports non-BMP code points without requiring UTF-16, but nothing
* seems to actually advertise this properly, despite Unicode 3.1 having
@@ -62,11 +60,9 @@ typedef struct ct_buffer_t {
size_t wsize;
} ct_buffer_t;
-#define ct_encode_string __ct_encode_string
/* Encode a wide-character string and return the UTF-8 encoded result. */
public char *ct_encode_string(const wchar_t *, ct_buffer_t *);
-#define ct_decode_string __ct_decode_string
/* Decode a (multi)?byte string and return the wide-character string result. */
public wchar_t *ct_decode_string(const char *, ct_buffer_t *);
@@ -74,20 +70,11 @@ public wchar_t *ct_decode_string(const char *, ct_buffer_t *);
* The pointer returned must be free()d when done. */
protected wchar_t **ct_decode_argv(int, const char *[], ct_buffer_t *);
-/* Resizes the conversion buffer(s) if needed. */
-protected void ct_conv_buff_resize(ct_buffer_t *, size_t, size_t);
-protected ssize_t ct_encode_char(char *, size_t, wchar_t);
-protected size_t ct_enc_width(wchar_t);
-
-#else
-#define ct_encode_string(s, b) (s)
-#define ct_decode_string(s, b) (s)
-#endif
-
-#ifndef NARROWCHAR
/* Encode a characted into the destination buffer, provided there is sufficent
* buffer space available. Returns the number of bytes used up (zero if the
* character cannot be encoded, -1 if there was not enough space available). */
+protected ssize_t ct_encode_char(char *, size_t, wchar_t);
+protected size_t ct_enc_width(wchar_t);
/* The maximum buffer size to hold the most unwieldly visual representation,
* in this case \U+nnnnn. */
@@ -124,6 +111,5 @@ protected const wchar_t *ct_visual_string(const wchar_t *);
#define CHTYPE_NONPRINT (-4)
/* classification of character c, as one of the above defines */
protected int ct_chr_class(wchar_t c);
-#endif
#endif /* _chartype_f */
diff --git a/lib/libedit/history.c b/lib/libedit/history.c
index 8ecc11e78fe..a5738cc48c7 100644
--- a/lib/libedit/history.c
+++ b/lib/libedit/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.26 2016/04/11 20:43:33 schwarze Exp $ */
+/* $OpenBSD: history.c,v 1.27 2016/04/11 20:54:05 schwarze Exp $ */
/* $NetBSD: history.c,v 1.37 2010/01/03 18:27:10 christos Exp $ */
/*-
@@ -51,7 +51,6 @@
static const char hist_cookie[] = "_HiStOrY_V2_\n";
#include "histedit.h"
-#include "chartype.h"
#ifdef NARROWCHAR
@@ -68,8 +67,11 @@ static const char hist_cookie[] = "_HiStOrY_V2_\n";
#define Strncmp(d, s, n) strncmp(d, s, n)
#define Strncpy(d, s, n) strncpy(d, s, n)
#define Strncat(d, s, n) strncat(d, s, n)
+#define ct_decode_string(s, b) (s)
+#define ct_encode_string(s, b) (s)
#else
+#include "chartype.h"
#define Char wchar_t
#define FUN(prefix, rest) prefix ## _w ## rest
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index d88054382b0..2f759baae16 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tokenizer.c,v 1.19 2016/04/11 20:43:33 schwarze Exp $ */
-/* $NetBSD: tokenizer.c,v 1.26 2016/04/11 00:50:13 christos Exp $ */
+/* $OpenBSD: tokenizer.c,v 1.20 2016/04/11 20:54:05 schwarze Exp $ */
+/* $NetBSD: tokenizer.c,v 1.27 2016/04/11 16:06:52 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -43,7 +43,6 @@
#include <string.h>
#include "histedit.h"
-#include "chartype.h"
typedef enum {
Q_none, Q_single, Q_double, Q_one, Q_doubleone