The NetBSD Project

CVS log for src/lib/libedit/chartype.c

[BACK] Up to [cvs.NetBSD.org] / src / lib / libedit

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.37: download - view: text, markup, annotated - select for diffs
Thu Aug 10 20:38:00 2023 UTC (16 months ago) by mrg
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +6 -6 lines
avoid various use-after-free issues.

create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.

found by GCC 12.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sun Oct 30 19:11:31 2022 UTC (2 years, 1 month ago) by christos
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +4 -2 lines
improvements in malloc/free handling.

Revision 1.31.14.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:03:12 2020 UTC (4 years, 8 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.31.14.1: preferred, colored; branchpoint 1.31: preferred, colored; next MAIN 1.32: preferred, colored
Changes since revision 1.31.14.1: +3 -3 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.35: download - view: text, markup, annotated - select for diffs
Tue Jul 23 10:18:52 2019 UTC (5 years, 4 months ago) by christos
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +3 -3 lines
PR/54399: Sören Tempel: Uninitialized memory access in libedit history.
Initialize the buffer using calloc. While here change all malloc(a * sizeof(b))
to calloc(a, sizeof(b)). XXX: should fix realloc similarly.

Revision 1.31.14.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:05:23 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +11 -13 lines
Sync with HEAD

Revision 1.31.12.1: download - view: text, markup, annotated - select for diffs
Mon Nov 26 01:52:12 2018 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.31: preferred, colored; next MAIN 1.32: preferred, colored
Changes since revision 1.31: +11 -13 lines
Sync with HEAD, resolve a couple of conflicts

Revision 1.34: download - view: text, markup, annotated - select for diffs
Sun Nov 25 16:20:28 2018 UTC (6 years ago) by christos
Branches: MAIN
CVS tags: phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +8 -5 lines
From Yuichiro Naito (FreeBSD):
hrs@ says that wctomb(3) has an internal shift state,
if wctomb(3) is called outside of libedit,
the internal state can be changed and causes miscalculate multibyte size.

So in this part, wcrtomb(3) should be used.
wcrtomb(3) requires that shift state is given in the argument.
We always initialize the shift state in ct_enc_width() to keep independent
from outside of libedit.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Sun Nov 18 17:15:41 2018 UTC (6 years ago) by christos
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +5 -4 lines
fix compilation

Revision 1.32: download - view: text, markup, annotated - select for diffs
Sun Nov 18 17:09:39 2018 UTC (6 years ago) by christos
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +7 -13 lines
Remove utf-8 requirement (Yuichiro NAITO)

Revision 1.30.2.1: download - view: text, markup, annotated - select for diffs
Mon Mar 20 06:56:59 2017 UTC (7 years, 8 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.30: preferred, colored; next MAIN 1.31: preferred, colored
Changes since revision 1.30: +4 -3 lines
Sync with HEAD

Revision 1.31: download - view: text, markup, annotated - select for diffs
Mon Jan 9 02:54:18 2017 UTC (7 years, 11 months ago) by christos
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-compat-base, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi, pgoyette-compat
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +4 -3 lines
Make sure that argv is NULL terminated since functions like tty_stty rely
on it to be so (Gerry Swinslow)

Revision 1.30: download - view: text, markup, annotated - select for diffs
Mon May 9 21:46:56 2016 UTC (8 years, 7 months ago) by christos
Branches: MAIN
CVS tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, localcount-20160914
Branch point for: pgoyette-localcount
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +9 -9 lines
s/protected/libedit_private/g

Revision 1.29: download - view: text, markup, annotated - select for diffs
Mon May 2 16:48:34 2016 UTC (8 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +31 -38 lines
eliminate static buffer with custom resizing code.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Mon Apr 11 18:56:31 2016 UTC (8 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +8 -8 lines
Get rid of private/public; keep protected (Ingo Schwarze)

Revision 1.27: download - view: text, markup, annotated - select for diffs
Mon Apr 11 16:06:52 2016 UTC (8 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +7 -4 lines
chartype cleanups from Ingo Schwarze:

 - The file tokenizer.c no longer uses chartype.h,
   so don't include the header.

 - The dummy definitions of ct_{de,en}code_string() for the
   NARROWCHAR case are only used in history.c, so move them there.

 - Now the whole content of chartype.h is for the wide character
   case only.  So remove the NARROWCHAR ifdef and include the
   header only in the wide character case.

 - In chartype.h, move ct_encode_char() below the comment explaining it.

 - No more need for underscores before ct_{de,en}code_string().

 - Make the conversion buffer resize functions private.
   They are only called from the decoding and encoding functions
   inside chartype.c, and no need can possibly arise to call them
   from anywhere else.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Mon Apr 11 00:50:13 2016 UTC (8 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +16 -16 lines
Char -> wchar_t from Ingo Schwarze.

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sat Apr 9 18:43:17 2016 UTC (8 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +8 -17 lines
More WIDECHAR elimination (Ingo Schwarze)

Revision 1.24: download - view: text, markup, annotated - select for diffs
Wed Mar 23 22:27:48 2016 UTC (8 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +2 -32 lines
Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sun Feb 28 23:02:24 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +2 -9 lines
remove 4 clause licenses.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Wed Feb 24 17:20:01 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +12 -5 lines
Tuck in mbstate_t to the wide char version only to avoid exposing the zeroing
hack and doing it in the narrow case.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Wed Feb 24 17:13:22 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +3 -3 lines
Make the read_char function always take a wchar_t * argument (Ingo Schwarze)

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Feb 24 14:25:38 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +4 -3 lines
Get split el_getc and el_wgetc completely and call el_wgetc internally.
Change some character constants to they wide versions. (Ingo Schwarze)

Revision 1.19: download - view: text, markup, annotated - select for diffs
Wed Feb 17 19:47:49 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +3 -3 lines
whitespace and header sorting changes (Ingo Schwarze). No functional changes.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Feb 16 22:53:14 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +7 -3 lines
More header cleanups from Ingo Schwarze.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Feb 16 15:53:48 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +3 -7 lines
From Ingo Scharze:
Let "el.h" include everything needed for struct editline,
and don't include that stuff multiple times.  That also improves
consistency, also avoids circular inclusions, and also makes it
easier to follow what is going on, even though not quite as nice.
But it seems like the best we can do...

Revision 1.16: download - view: text, markup, annotated - select for diffs
Tue Feb 16 14:08:25 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +5 -3 lines
cleanup chartype.h includes (Ingo Schwarze)

Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Feb 16 14:06:05 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +4 -2 lines
cleanup inclusion of histedit.h (Ingo Schwarze)

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sun Feb 14 14:47:48 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +16 -2 lines
From Ingo Schwartze:

Next step:  Remove #ifdef'ing in read_char(), in the same style
as we did for setlocale(3) in el.c.

A few remarks are required to explain the choices made.

 * On first sight, handling mbrtowc(3) seems a bit less trivial
   than handling setlocale(3) because its prototype uses the data
   type mbstate_t from <wchar.h>.  However, it turns out that
   "histedit.h" already includes <wchar.h> unconditionally (i don't
   like headers including other headers, but that ship has sailed,
   people are by now certainly used to the fact that including
   "histedit.h" doesn't require including <wchar.h> before), and
   "histedit.h" is of course included all over the place.  So from
   that perspective, there is no problem with using mbrtowc(3)
   unconditionally ever for !WIDECHAR.

 * However, <wchar.h> also defines the mbrtowc(3) prototype,
   so we cannot just #define mbrtowc away, or including the header
   will break.  It would also be a bad idea to porovide a local
   implementation of mbrtowc() and hope that it overrides the one
   in libc.  Besides, the required prototype is subtly different:
   While mbrtowc(3) takes "wchar_t *" as its first argument, we
   need a function that takes "Char *".  So unfortunately, we have
   to keep a ct_mbrtowc #define, at least until we can maybe get
   rid of "Char *" in the more remote future.

 * After getting rid of the #else clause in read_char(), we can
   pull "return 1;" into the default: clause.  After that, we can
   get rid of the ugly "goto again_lastbyte;" and just "break;".
   As a bonus, that also gets rid of the ugly CONSTCOND.

 * While here, delete the unused ct_mbtowc() from chartype.h.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Feb 11 19:21:04 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +3 -3 lines
- Add some more Char casts
- reduce ifdefs by providing empty defs for nls functions (Ingo Schwarze)

Revision 1.10.20.1: download - view: text, markup, annotated - select for diffs
Tue Apr 14 05:30:24 2015 UTC (9 years, 8 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Diff to: previous 1.10: preferred, colored; next MAIN 1.11: preferred, colored
Changes since revision 1.10: +54 -46 lines
Pull up following revision(s) (requested by christos in ticket #679):
	lib/libedit/chartype.c: revisions 1.11, 1.12
	lib/libedit/chartype.h: revisions 1.12, 1.13
PR/49683: Amir Plivatsky: Off-by-one comparison in ct_decode_string() leading
to out of bounds referrence.
--
split the allocation functions, their mixed usage was too confusing.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sun Feb 22 02:16:19 2015 UTC (9 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +41 -30 lines
split the allocation functions, their mixed usage was too confusing.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Feb 22 00:46:58 2015 UTC (9 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +24 -27 lines
PR/49683: Amir Plivatsky: Off-by-one comparison in ct_decode_string() leading
to out of bounds referrence.
XXX: pullup-7

Revision 1.10: download - view: text, markup, annotated - select for diffs
Tue Aug 16 16:25:15 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
CVS tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, agc-symver-base, agc-symver
Branch point for: netbsd-7
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +7 -7 lines
re-enable -Wconversion

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Jul 29 23:44:44 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +11 -10 lines
pass -Wconversion

Revision 1.8: download - view: text, markup, annotated - select for diffs
Fri Jul 29 15:16:33 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +3 -3 lines
KNF return (\1); -> return \1;

Revision 1.7: download - view: text, markup, annotated - select for diffs
Thu Jul 28 20:50:55 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +4 -4 lines
kill ptr_t and ioctl_t, add  * sizeof(*foo) to all allocations.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Jul 28 00:48:21 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +7 -5 lines
- fix memory allocation botch in wide strings
- check mbstowcs return code

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Jul 27 02:18:30 2011 UTC (13 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +8 -15 lines
fix buffer growing code.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Apr 15 00:55:57 2010 UTC (14 years, 8 months ago) by christos
Branches: MAIN
CVS tags: matt-mips64-premerge-20101231, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +5 -6 lines
From Jess Thrysoee
	expose ct_enc_width()

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Jan 12 19:37:18 2010 UTC (14 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +5 -5 lines
- in the argv conversion, handle NULL as NULL
- when printing tab/nl print them, don't handle them specially.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Thu Dec 31 18:32:37 2009 UTC (14 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +4 -4 lines
expose the encode and decode string functions for the benefit of history
and readline.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Wed Dec 30 22:37:40 2009 UTC (14 years, 11 months ago) by christos
Branches: MAIN
Wide character support (UTF-8) from Johny Mattsson; currently disabled.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>