From: Lennart Poettering Date: Tue, 20 Mar 2018 19:36:09 +0000 (+0100) Subject: coccinelle: make use of DIV_ROUND_UP() wherever appropriate X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5a265e9aca07f4d8e2e6f33dc822e635b0cc36b9;p=elogind.git coccinelle: make use of DIV_ROUND_UP() wherever appropriate Let's use our macros where we can --- diff --git a/src/basic/exec-util.c b/src/basic/exec-util.c index f8ac40671..73330c278 100644 --- a/src/basic/exec-util.c +++ b/src/basic/exec-util.c @@ -116,7 +116,7 @@ static int do_execute( * default action terminating the process, and turn on alarm(). */ if (timeout != USEC_INFINITY) - alarm((timeout + USEC_PER_SEC - 1) / USEC_PER_SEC); + alarm(DIV_ROUND_UP(timeout, USEC_PER_SEC)); STRV_FOREACH(path, paths) { _cleanup_free_ char *t = NULL; diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c index fe7e4954e..0764521b6 100644 --- a/src/basic/hexdecoct.c +++ b/src/basic/hexdecoct.c @@ -583,7 +583,7 @@ static int base64_append_width( if (len <= 0) return len; - lines = (len + width - 1) / width; + lines = DIV_ROUND_UP(len, width); slen = strlen_ptr(sep); t = realloc(*prefix, plen + 1 + slen + (indent + width + 1) * lines);