Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: big key binding patch
- X-seq: zsh-workers 2470
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: big key binding patch
- Date: Mon, 25 Nov 1996 14:22:20 +0100
- In-reply-to: "Zefram"'s message of "Sun, 24 Nov 1996 15:30:04 MET." <19811.199611241530@xxxxxxxxxxxxxxxxxxxxxxx>
This key binding overhaul was certainly necessary. There's one bug:
the str Key element doesn't get set to null in addkeybindentry(),
causing `already free' error messages later. However, is the
zfree(cur->str) immediately after the addkeybindentry() in
bin_bindkey() still required? It's not quite clear to me since the
test at the end of addkeybindentry() is different (and so is the free,
but that must be essentially cosmetic).
There's also some not-bugs with uninitialized variables that gcc complains
about which I've fixed anyway (that's the current policy, not clear
how necessary it really is but it eliminates a source of complaints).
I still had -pedantic turned on when I first compiled this and gcc
doesn't like having to initialise the keybindtab elements of list[] in
unbindzlefunc() at load time. That probably needs fixing (if there
are any genuinely pedantic compilers around) but I couldn't think of a
portable fix without more verbose code.
*** Src/zle_main.c~ Mon Nov 25 09:24:14 1996
--- Src/zle_main.c Mon Nov 25 14:00:26 1996
***************
*** 937,943 ****
Key
addkeybindentry(int *tab, HashTable keytab, char *str, int len)
{
! Key ret;
int p, added=0;
char *buf = zalloc(len*2 + 1);
--- 937,943 ----
Key
addkeybindentry(int *tab, HashTable keytab, char *str, int len)
{
! Key ret = NULL;
int p, added=0;
char *buf = zalloc(len*2 + 1);
***************
*** 958,965 ****
if(p == len)
ret = ky;
}
! if(ret->func == z_sendstring)
free(ret->str);
return ret;
}
--- 958,967 ----
if(p == len)
ret = ky;
}
! if(ret->func == z_sendstring) {
free(ret->str);
+ ret->str = NULL;
+ }
return ret;
}
***************
*** 1052,1058 ****
while (*argv) {
Key ky = NULL;
char *s, *smeta;
! int func, len;
if (ops['u'] || ops['U']) {
/* unbind all references to given function */
--- 1054,1060 ----
while (*argv) {
Key ky = NULL;
char *s, *smeta;
! int func = 0, len;
if (ops['u'] || ops['U']) {
/* unbind all references to given function */
***************
*** 1301,1308 ****
void
unbindzlefunc(int ifunc, int notall)
{
! int i, *tab;
! HashTable keytab;
struct {
int *tab;
HashTable keytab;
--- 1303,1310 ----
void
unbindzlefunc(int ifunc, int notall)
{
! int i, *tab = 0;
! HashTable keytab = NULL;
struct {
int *tab;
HashTable keytab;
--
Peter Stephenson <pws@xxxxxx> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author