summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-22 12:01:47 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-22 12:01:47 -0700
commitf7f9e4590a75d629b3ca65887b6e477a72ba39b7 (patch)
tree796f695e65d3c7c7ad1869c648659e354c182cb3
parentbe8848c2203b489854982eb74727928cb5b622da (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.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/printev.c b/printev.c
index b556835..fc20356 100644
--- a/printev.c
+++ b/printev.c
@@ -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