1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00
Commit Graph

20 Commits

Author SHA1 Message Date
schwarze
2e21385074 typos in comments; from Pedro Giffuni (FreeBSD) via Christos Zoulas (NetBSD) 2016-05-06 18:01:40 +00:00
schwarze
ddc8143785 delete the "private" and "public" preprocessor macros, just use standard C;
OK martijn@
2016-04-11 21:17:29 +00:00
schwarze
8dc8c69029 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@
2016-04-11 20:54:05 +00:00
schwarze
e3191321e1 get rid of the non-standard data type "Char" in almost all files;
ok martijn@
2016-04-11 20:43:33 +00:00
schwarze
5c93237dc6 Move wrapper macros to the two files actually needing them:
FUNW, Strlen, Strdup, Strcmp, Strncmp, Strncpy, Strncat -> history.c
Strchr, tok_strdup -> tokenizer.c
FUN, TYPE, STR -> both of these files

OK martijn@

Also proofread by Christian Heckendorf <mbie at ulmus dot me>
who reported some whitespace issues in parse.c.
2016-04-11 19:54:53 +00:00
schwarze
565aa7e845 Delete 26 wrapper macros and two wrapper functions that are no
longer needed now that we always compile with wide character support,
reducing code obfuscation.

OK czarkoff@ martijn@.
Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-04-09 20:15:26 +00:00
schwarze
59aed04376 Always compile with WIDECHAR on and delete that preprocessor switch.
OK martijn@.
Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-04-09 19:31:55 +00:00
schwarze
30806f50c6 format string fixes in debug code;
committing right away because this code is not even compiled by default
2016-03-22 11:32:18 +00:00
schwarze
4cc1fc08fa Christos Zoulas just rescinded clauses 3 & 4 of his licenses, see
NetBSD chartype.c rev. 1.23, chartype.h rev. 1.25, eln.c rev. 1.28.
No code change.
2016-03-21 18:40:25 +00:00
schwarze
c8b52917b0 Make the read_char() function always take a wchar_t * argument.
On first sight, it might look as if this required a bump because
it seems to change the public type el_rfunc_t.  But we only compile
with WIDECHAR, and in that case, there is no change in the interface.

This also simplifies some logic by getting rid of the NARROW_READ flag
which was broken anyway.

OK czarkoff@
2016-03-21 17:28:10 +00:00
schwarze
7ccfa089d5 Cleanup of standard header inclusion:
1. Add the missing <errno.h> to sig.c.
2. Do not include standard headers from private headers "chared.h"
and "el.h", include them directly where needed.
3. Delete a few needless inclusions of <ctype.h>.
4. Sort the standard headers.
5. Delete _GNU_SOURCE weirdness from histedit.h, that file doesn't even
need the access to wcsdup(3) mentioned in the comment.
6. Delete some trailing blanks and blanks before tabs.

OK czarkoff@
2016-03-20 23:48:27 +00:00
schwarze
b2589f0b32 Delete the useless Int datatype and always use the standard wint_t
directly.  This is not a problem because <wchar_t> is required all
over the place anyway, even when WIDECHAR is not defined.
No functional change except that it fixes a few printf(3)
format string issues, %c vs. %lc.
OK czarkoff@
2016-03-20 20:35:38 +00:00
schwarze
3a40234dc6 Get rid of "#ifdef WIDECHAR" and one goto in read_char(),
making the code more readable.  Instead, provide an mbrtowc(3)
replacement function in chartype.[hc], files that encapsulate
such system dependencies anyway.  No functional change.
OK czarkoff@
2016-03-20 20:16:09 +00:00
schwarze
8f65425a52 Fix the public interface function el_getc(3).
On OpenBSD, the effects are to set the return argument to the NUL byte
in case of a read failure (for robustness) and to properly set errno
when the character is out of range and cannot be stored in a byte.
Once we enable UTF-8, this will be needed to avoid returning bogus
bytes for valid Unicode characters.
On systems where the internal representation of wchar_t doesn't
match UCS-4, breakage was potentially even worse.
OK czarkoff@.
2016-03-20 19:14:29 +00:00
schwarze
b96b528f9d Fix the CHARSET_IS_UTF8 case in read_char().
For now, this mainly help programs explicitly using
wide-character functions like el_wgetc(3) and el_wgets(3).

1. After reading an invalid byte sequence, do not throw away additional
valid bytes; fix by me using mbrtowc(3), obsoleting utf8_islead().
2. When read(2) returns EOF, return that information to the caller,
do not prod on and potentially access garbage data in the buffer;
from Linas Vepstas via NetBSD read.c rev. 1.70 2013/05/27.
3. After read__fixio() failure, restore errno to the one set by read();
from Steffen Nurpmeso via NetBSD read.c rev. 1.68 2012/09/10.
4. After read__fixio() success, restore errno to the initial state
upon function entry; fix by me.

OK czarkoff@.  Also committed to NetBSD.
2016-03-20 17:19:48 +00:00
deraadt
014b1be8e7 Remove non-exposed malloc/realloc/free wrappers, and then substitute
reallocarray() where it helps.
ok doug
2014-10-17 06:07:50 +00:00
nicm
86d96b8f00 Enable wide character functions in libedit (not the other libe*t).
ok stsp deraadt
2011-07-07 16:15:47 +00:00
okan
5f805b19df sync with upstream, retaining local modifications.
ok nicm@
2011-07-07 05:40:42 +00:00
stsp
cf7973e199 Make wcwidth() callers cope with -1 return value. Doesn't affect the build yet.
ok nicm
2011-04-04 18:48:17 +00:00
nicm
aed0ee816f Update libedit to bring it into sync with the latest version from NetBSD.
ok deraadt
2010-06-30 00:05:35 +00:00