diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 12:01:47 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 12:01:47 -0700 |
commit | f7f9e4590a75d629b3ca65887b6e477a72ba39b7 (patch) | |
tree | 796f695e65d3c7c7ad1869c648659e354c182cb3 | |
parent | be8848c2203b489854982eb74727928cb5b622da (diff) |
eventTypeToString: remove unnecessary strcpy to static buffer
Since the results are just passed to fprintf(), we can just return
a pointer to the string constants directly.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | printev.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -32,23 +32,20 @@ #define Unknown "unknown" #define ynText(v) ((v)?Yes:No) -static char * +static const char * eventTypeToString(int evType) { - static char name[20]; - switch (evType) { case KeyPress: - strcpy(name, "KeyPress"); + return "KeyPress"; break; case KeyRelease: - strcpy(name, "KeyRelease"); + return "KeyRelease"; break; default: - strcpy(name, "unknown"); + return "unknown"; break; } - return name; } static void |