=== modified file 'termkey.c' --- termkey.c 2008-12-02 00:56:43 +0000 +++ termkey.c 2008-12-01 22:36:14 +0000 @@ -824,20 +824,6 @@ return "UNKNOWN"; } -termkey_keysym termkey_keyname2sym(termkey_t *tk, const char *keyname) -{ - /* We store an array, so we can't do better than a linear search. Doesn't - * matter because user won't be calling this too often */ - - termkey_keysym sym; - - for(sym = 0; sym < tk->nkeynames; sym++) - if(tk->keynames[sym] && strcmp(keyname, tk->keynames[sym]) == 0) - return sym; - - return TERMKEY_SYM_UNKNOWN; -} - static termkey_keysym register_c0(termkey_t *tk, termkey_keysym sym, unsigned char ctrl, const char *name) { return register_c0_full(tk, sym, 0, 0, ctrl, name); === modified file 'termkey.h.in' --- termkey.h.in 2008-12-02 00:56:43 +0000 +++ termkey.h.in 2008-12-01 22:36:14 +0000 @@ -156,8 +156,6 @@ termkey_keysym termkey_register_keyname(termkey_t *tk, termkey_keysym sym, const char *name); const char *termkey_get_keyname(termkey_t *tk, termkey_keysym sym); -termkey_keysym termkey_keyname2sym(termkey_t *tk, const char *keyname); - typedef enum { TERMKEY_FORMAT_LONGMOD = 1 << 0, // Shift-... instead of S-... TERMKEY_FORMAT_CARETCTRL = 1 << 1, // ^X instead of C-X === modified file 'termkey_get_keyname.3' --- termkey_get_keyname.3 2008-12-02 00:56:43 +0000 +++ termkey_get_keyname.3 2008-11-06 19:50:53 +0000 @@ -10,12 +10,11 @@ .sp Link with \fI-ltermkey\fP. .SH DESCRIPTION -\fBtermkey_get_keyname\fP returns a human-readable string name for the symbolic key value given by \fBsym\fP. The returned string is owned by the termkey instance \fItk\fP so should not be modified or freed. The returned pointer is guaranteed to be valid until the termkey instance is released using \fBtermkey_destroy\fP(3). This function is the inverse of \fBtermkey_keyname2sym\fP(3). +\fBtermkey_get_keyname\fP returns a human-readable string name for the symbolic key value given by \fBsym\fP. The returned string is owned by the termkey instance \fItk\fP so should not be modified or freed. The returned pointer is guaranteed to be valid until the termkey instance is released using \fBtermkey_destroy\fP(3). .SH "RETURN VALUE" \fBtermkey_get_key\fP() returns a pointer to a string. .SH "SEE ALSO" .BR termkey_new (3), .BR termkey_getkey (3), .BR termkey_waitkey (3), -.BR termkey_keyname2sym (3), .BR termkey_snprint_key (3) === removed file 'termkey_keyname2sym.3' --- termkey_keyname2sym.3 2008-12-02 00:56:43 +0000 +++ termkey_keyname2sym.3 1970-01-01 00:00:00 +0000 @@ -1,21 +0,0 @@ -.TH TERMKEY_KEYNAME2SYM 3 -.SH NAME -termkey_keyname2sym \- look up a symbolic key value for a string name -.SH SYNOPSIS -.nf -.B #include -.sp -.BI "termkey_keysym termkey_keyname2sym(termkey_t *" tk ", const char *" keyname ); -.fi -.sp -Link with \fI-ltermkey\fP. -.SH DESCRIPTION -\fBtermkey_keyname2sym\fP looks up the symbolic key value represented by the given string name. This is a case-sensitive comparison. If the given name is not found, \fBTERMKEY_SYM_UNKNOWN\fP is returned instead. This function is the inverse of \fBtermkey_get_keyname\fP(3). -.PP -Because the key names are stored in an array indexed by the symbol number, this function has to perform a linear search of the names. Use of this function should be restricted to converting key names into symbolic values during a program's initialisation, so that efficient comparisons can be done while it is running. -.SH "RETURN VALUE" -\fBtermkey_get_key\fP() returns a pointer to a string. -.SH "SEE ALSO" -.BR termkey_new (3), -.BR termkey_get_keyname (3), -.BR termkey_snprint_key (3)