From 912443eafbedc008a457ab52b261066f426153c0 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Mon, 17 Sep 2018 21:15:14 +0300 Subject: [PATCH] inline emax_u() --- src/device.c | 3 +-- src/main.c | 1 - src/tools.h | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index bde80e9..b045ff5 100644 --- a/src/device.c +++ b/src/device.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include "tools.h" @@ -58,7 +57,7 @@ void device_init(struct device_t *dev, struct device_runtime_t *run) { dev->height = 480; dev->format = V4L2_PIX_FMT_YUYV; dev->standard = V4L2_STD_UNKNOWN; - dev->n_buffers = MAX(sysconf(_SC_NPROCESSORS_ONLN), 1) + 1; + dev->n_buffers = max_u(sysconf(_SC_NPROCESSORS_ONLN), 1) + 1; dev->jpeg_quality = 80; dev->timeout = 1; dev->error_timeout = 1; diff --git a/src/main.c b/src/main.c index d774558..8b1af74 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "tools.h" #include "device.h" diff --git a/src/tools.h b/src/tools.h index 8c8b404..c77633a 100644 --- a/src/tools.h +++ b/src/tools.h @@ -75,6 +75,10 @@ unsigned log_level; #define XIOCTL_RETRIES 4 +INLINE unsigned max_u(unsigned a, unsigned b) { + return (a > b ? a : b); +} + INLINE void now_ms(time_t *sec, long *msec) { struct timespec spec;