aboutsummaryrefslogtreecommitdiffstats
path: root/src/libdisplay
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-03-18 19:49:56 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2023-03-18 19:49:56 +0100
commit28a297f97d53174c2d780e3f6ef6457ed336adeb (patch)
tree9609547a577d4d246fb72fb3f463f689fa388a39 /src/libdisplay
parentbdecacc99eaa29d16516a0776c7482e985657654 (diff)
Generate compador table only once when the application starts
Diffstat (limited to 'src/libdisplay')
-rw-r--r--src/libdisplay/display_measurements.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libdisplay/display_measurements.c b/src/libdisplay/display_measurements.c
index e2c2f0f..543ca1c 100644
--- a/src/libdisplay/display_measurements.c
+++ b/src/libdisplay/display_measurements.c
@@ -24,6 +24,7 @@
#include <pthread.h>
#include <sys/ioctl.h>
#include <math.h>
+#include <sys/param.h>
#include "../libsample/sample.h"
#include "../libdebug/debug.h"
#include "../libdisplay/display.h"
@@ -246,7 +247,7 @@ static void print_measurements(int on)
memset(line_color + width - MAX_UNIT_LEN, 4, MAX_UNIT_LEN); /* blue */
else
memset(line_color + width - MAX_UNIT_LEN, 3, MAX_UNIT_LEN); /* yellow */
- strncpy(line + width - MAX_UNIT_LEN + 1, text, (strlen(text) < MAX_UNIT_LEN) ? strlen(text) : MAX_UNIT_LEN);
+ memcpy(line + width - MAX_UNIT_LEN + 1, text, MAX(strlen(text), MAX_UNIT_LEN));
display_line(on, width);
}
}