chiark / gitweb /
coccinelle: make use of DIV_ROUND_UP() wherever appropriate
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Mar 2018 19:36:09 +0000 (20:36 +0100)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
Let's use our macros where we can

src/basic/exec-util.c
src/basic/hexdecoct.c

index f8ac40671cbccbffcd5e4e81c72112daf00a6f0a..73330c278031219591e78435a3944a9c2a1bfa7b 100644 (file)
@@ -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;
index fe7e4954ef4633db7a7ce847e1f3762b6c5277e6..0764521b6ff006921ac10191a40e75f229f8c80d 100644 (file)
@@ -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);