coccinelle: make use of DIV_ROUND_UP() wherever appropriate
Let's use our macros where we can
This commit is contained in:
@@ -1169,7 +1169,7 @@ static int find_matching_component(const CalendarSpec *spec, const CalendarCompo
|
||||
} else if (c->repeat > 0) {
|
||||
int k;
|
||||
|
||||
k = start + c->repeat * ((*val - start + c->repeat - 1) / c->repeat);
|
||||
k = start + c->repeat * DIV_ROUND_UP(*val - start, c->repeat);
|
||||
|
||||
if ((!d_set || k < d) && (stop < 0 || k <= stop)) {
|
||||
d = k;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user