diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-06-07 01:00:33 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-06-13 13:08:52 -0700 |
commit | 123ff05c2e2bbdb9d7d6d958d9f096cf854b8360 (patch) | |
tree | 504d8a812f89cc4f7eb0e5ef9573cb92abafeadf | |
parent | 369c37a62cdd2841a3e8778674029841231f45ad (diff) |
Delay generating unknown code string until we know we need it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xwininfo.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -431,11 +431,7 @@ static char _lookup_buffer[100]; static const char * LookupL (long code, const binding *table) { - const char *name; - - snprintf (_lookup_buffer, sizeof(_lookup_buffer), - "unknown (code = %ld. = 0x%lx)", code, code); - name = _lookup_buffer; + const char *name = NULL; while (table->name) { if (table->code == code) { @@ -445,6 +441,12 @@ LookupL (long code, const binding *table) table++; } + if (name == NULL) { + snprintf (_lookup_buffer, sizeof(_lookup_buffer), + "unknown (code = %ld. = 0x%lx)", code, code); + name = _lookup_buffer; + } + return (name); } |