Commit Graph

64 Commits

Author SHA1 Message Date
christos 6cac535e17 Respect $EDITOR when execution one (Baptiste Daroussin) 2021-08-28 17:17:47 +00:00
christos 113f06a345 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.
2019-07-23 10:18:52 +00:00
christos a2d6b270ec s/protected/libedit_private/g 2016-05-09 21:46:56 +00:00
christos 4fc1f47d56 From Ingo Schwarze:
* Replace fcns.c by a shorter and simpler func.h
   and include it only in the one file needing it, map.c.
 * Combine help.h and help.c into a simplified help.h
   and include it only in the one file needing it, map.c.
 * Check the very simple, static files editline.c, historyn.c, and
   tokenizern.c into CVS rather than needlessly generating them.
 * So we no longer autogenerate any C files.  :-)
 * Shorten and simplify makelist by deleting the options -n, -e, -bc,
   and -m; the latter was unused and useless in the first place.
 * Move the declaration of el_func_t from fcns.h to the header
   actually needing it, map.h.  Since that header is already
   included by el.h for unrelated reasons, that makes el_func_t
   just as globally available as before.
 * No longer include the simplified fcns.h into el.h,
   include it directly into the *.c files needing it.
2016-04-18 17:01:19 +00:00
christos 469d44f8e7 Get rid of private/public; keep protected (Ingo Schwarze) 2016-04-11 18:56:31 +00:00
christos 0594af8028 Char -> wchar_t from Ingo Schwarze. 2016-04-11 00:50:13 +00:00
christos 0aefc7f9ad more macro WIDECHAR undoing from Ingo Schwarze. 2016-04-11 00:22:48 +00:00
christos 2dd09931ab Change some 0's to NULL's from Pedro Giffuni 2016-04-09 18:47:05 +00:00
christos fcf85103b4 More WIDECHAR elimination (Ingo Schwarze) 2016-04-09 18:43:17 +00:00
christos d784c57539 PR/50880: David Binderman: Remove redundant code.
While here, fix all debugging formats.
2016-03-02 19:24:20 +00:00
christos 22383670cc whitespace and header sorting changes (Ingo Schwarze). No functional changes. 2016-02-17 19:47:49 +00:00
christos e84df91e32 More header cleanups from Ingo Schwarze. 2016-02-16 22:53:14 +00:00
christos 747f681109 more include file cleanup (Ingo Schwarze) 2016-02-16 19:08:41 +00:00
christos aefc1e4460 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...
2016-02-16 15:53:48 +00:00
christos f09cb8c626 cleanup chartype.h includes (Ingo Schwarze) 2016-02-16 14:08:25 +00:00
christos 40850369f8 cleanup inclusion of histedit.h (Ingo Schwarze) 2016-02-16 14:06:05 +00:00
christos f54e4f97f9 From Ingo Schwarze:
As we have seen before, "histedit.h" can never get rid of including
the <wchar.h> header because using the data types defined there is
deeply ingrained in the public interfaces of libedit.

Now POSIX unconditionally requires that <wchar.h> defines the type
wint_t.  Consequently, it can be used unconditionally, no matter
whether WIDECHAR is active or not.  Consequently, the #define Int
is pointless.

Note that removing it is not gratuitious churn.  Auditing for
integer signedness problems is already hard when only fundamental
types like "int" and "unsigned" are involved.  It gets very hard
when types come into the picture that have platform-dependent
signedness, like "char" and "wint_t".  Adding yet another layer
on top, changing both the signedness and the width in a platform-
dependent way, makes auditing yet harder, which IMHO is really
dangerous.  Note that while removing the #define, i already found
one bug caused by this excessive complication - in the function
re_putc() in refresh.c.  If WIDECHAR was defined, it printed an
Int = wint_t value with %c.  Fortunately, that bug only affects
debugging, not production.  The fix is contained in the patch.

With WIDECHAR, this doesn't change anything.  For the case without
WIDECHAR, i checked that none of the places wants to store values
that might not fit in wint_t.

This only changes internal interfaces; public ones remain unchanged.
2016-02-14 14:49:34 +00:00
christos 0fe5419e98 Use the full buffer for the conversion; ideally we should be dynamically
allocating this. From Jilles Tjoelker
2015-10-21 21:45:30 +00:00
christos 234792da04 make sure we have space for NUL and NUL terminate buffer array (Jilles Tjoelker) 2015-10-19 00:36:27 +00:00
christos e06822a79d Don't depend on weak aliases to define the vi "alias" expansion function,
provide an API instead to set it.
2014-06-18 18:12:28 +00:00
christos 0bd5e60967 accomodate FreeBSD's flavor of weak references. 2014-06-18 13:03:08 +00:00
christos 3c15bad9a7 PR/45843: Henning Petersen: Fix resource leak on error. 2012-01-16 14:57:45 +00:00
christos e09907eccd Off by one in allocation could cause buffer overflow (Kamil Dudka) 2011-11-18 20:24:21 +00:00
christos b6f308812d fixed warnings where wint_t is unsigned. 2011-10-04 15:27:04 +00:00
christos 3d802cf59d re-enable -Wconversion 2011-08-16 16:25:15 +00:00
christos c11bd863f5 pass -Wconversion 2011-07-29 23:44:44 +00:00
christos 1237974a30 - fix unused params
- unconditionalize vis.h
2011-07-29 20:58:07 +00:00
christos b71bed95b3 KNF return (\1); -> return \1; 2011-07-29 15:16:33 +00:00
christos a13cd75612 kill ptr_t and ioctl_t, add * sizeof(*foo) to all allocations. 2011-07-28 20:50:55 +00:00
christos c2c011fc82 term -> terminal 2011-07-28 00:45:14 +00:00
joerg 9674b81ed9 Introduce __weakref_visible to handle the different required visibility
for weak references. GCC 4.2+ and Clang require static, older GCC wants
extern. Change __weak_reference to include sym. This requires changes
the existing users to not reuse the name of the symbol, but avoids
further differences between GCC 4.1 and GCC 4.2+/clang.
2011-02-22 05:45:05 +00:00
joerg 6f7bc0c1ed Deal with changes in the weak_reference semantic in GCC 4.2 and later. 2011-02-17 16:44:48 +00:00
christos f70a466a92 fix fd leak found by Igor Zinovik 2010-10-23 23:27:40 +00:00
christos 34e53048e6 Wide character support (UTF-8) from Johny Mattsson; currently disabled. 2009-12-30 22:37:40 +00:00
christos 954af9bb67 more size_t stuff. 2009-02-21 23:31:56 +00:00
christos 5c894153a3 pass lint on _LP64. 2009-02-15 21:55:23 +00:00
sketch 5e72d51013 Portability fix. 2009-02-06 13:14:37 +00:00
mrg d257e1e9bd __weakref__ attribute can not be applied to anything when inside function
scope, so, move the extern of get_alias_text outside vi_alias().

fixes build problems with GCC 4.1-20061021.
2006-10-22 07:48:13 +00:00
christos 96473fa808 change __weak_extern to __weak_reference so that gcc4 works. 2006-05-18 17:54:19 +00:00
christos 230c3d4ed6 Print the actual eofc, instead of ^D\b\b.
Change internal character decoding to prevent buffer oveflows.
2006-03-06 21:11:56 +00:00
christos 55ca57f0a2 Don't save the el->el_line.cursor over a cv_insert call and use it later
because it might change. From Stefan Farfedeler.
2005-08-10 12:46:24 +00:00
christos fda9b4f722 Don't delete the current line in vi mode when typing 'yy'.
From Stefan Farfeleder.
2005-08-09 16:40:12 +00:00
christos 2ecb0fb73d Spelling mistakes and comment errors (from FreeBSD via Stefan Farfeleder; many
thanks)
2005-08-08 14:05:37 +00:00
matt 35f4d7fe23 Terminate the arglist with a NULL instead of 0. (Shuts up gcc4.x) 2005-04-25 01:06:03 +00:00
mycroft 6360c4b0f8 Delete-previous-char and delete-next-char without an argument are not supposed
to modify the yank buffer in Emacs.  Make it so.
2004-08-13 12:10:38 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
christos 839ca00b3c From michael@moria.de:
- use __attribute__((__unused__)) in arguments where appropriate.
- some int -> size_t and char * to const char * conversions.
2003-06-19 15:55:05 +00:00
matt 362ac6119e Only return CC_EOF if ^D (VEOF) was the only thing on the line. Otherwise
beep and don't do anything else.  This mimics the behavor of ^D outside in
normal terminal mode.  (^D in vi scrolls forwards and as such isn't
appropriate to emulation)
2003-06-04 20:14:05 +00:00
dsl 25456aecdb Put the __weak_extern() back inside vi_alias, but after the extern for
get_alias_text().
2003-03-10 11:09:25 +00:00
he d5428a2906 Move the __weak_extern() (ifdef'ed) outside of the vi_alias()
function, so that this compiles again.
2003-03-10 09:55:10 +00:00