=== modified file 'driver-ti.c' --- driver-ti.c 2008-10-09 23:44:13 +0000 +++ driver-ti.c 2008-10-09 22:53:35 +0000 @@ -125,7 +125,6 @@ int mods; } funcs[] = { - /* THIS LIST MUST REMAIN SORTED! */ { "backspace", TERMKEY_TYPE_KEYSYM, TERMKEY_SYM_BACKSPACE, 0 }, { "begin", TERMKEY_TYPE_KEYSYM, TERMKEY_SYM_BEGIN, 0 }, { "btab", TERMKEY_TYPE_KEYSYM, TERMKEY_SYM_TAB, TERMKEY_KEYMOD_SHIFT }, @@ -148,29 +147,15 @@ static int funcname2keysym(const char *funcname, termkey_type *typep, termkey_keysym *symp, int *modmaskp, int *modsetp) { - // Binary search - - int start = 0; - int end = sizeof(funcs)/sizeof(funcs[0]); // is "one past" the end of the range - - while(1) { - int i = (start+end) / 2; - int cmp = strcmp(funcname, funcs[i].funcname); - - if(cmp == 0) { + int i; + for(i = 0; funcs[i].funcname; i++) { + if(strcmp(funcname, funcs[i].funcname) == 0) { *typep = funcs[i].type; *symp = funcs[i].sym; *modmaskp = funcs[i].mods; *modsetp = funcs[i].mods; return 1; } - else if(end == start + 1) - // That was our last choice and it wasn't it - not found - break; - else if(cmp > 0) - start = i; - else - end = i; } if(funcname[0] == 'f' && isdigit(funcname[1])) {