This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository terminology.
View the commit online.
commit e1924c7fa0ff9a3bdb51fc0aa66f8a686349fd90
Author: Boris Faure <[email protected]>
AuthorDate: Thu Jun 23 22:30:30 2022 +0200
coccinelle: use ROUND_UP()
---
scripts/coccinelle/coccicheck.sh | 6 +++---
scripts/coccinelle/div_round_up.cocci | 11 -----------
scripts/coccinelle/macros.cocci | 26 ++++++++++++++++++++++++++
src/bin/backlog.c | 2 +-
4 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/scripts/coccinelle/coccicheck.sh b/scripts/coccinelle/coccicheck.sh
index 01b00f3..4d27c42 100755
--- a/scripts/coccinelle/coccicheck.sh
+++ b/scripts/coccinelle/coccicheck.sh
@@ -13,14 +13,14 @@ notnull.cocci
null_ref.cocci
unused.cocci
use_after_iter.cocci
-div_round_up.cocci
+macros.cocci
"
HAS_ERROR=0
for f in $COCCI_FILES; do
OPTIONS=""
- if [ "$f" = "div_round_up.cocci" ]; then
- OPTIONS="--defined DIV_ROUND_UP"
+ if [ "$f" = "macros.cocci" ]; then
+ OPTIONS="--defined DIV_ROUND_UP --defined ROUND_UP"
fi
CMD="spatch --timeout 200 --very-quiet --cocci-file scripts/coccinelle/$f --include-headers --dir $DIR $OPTIONS"
OUT=$($CMD)
diff --git a/scripts/coccinelle/div_round_up.cocci b/scripts/coccinelle/div_round_up.cocci
deleted file mode 100644
index 2af6d42..0000000
--- a/scripts/coccinelle/div_round_up.cocci
+++ /dev/null
@@ -1,11 +0,0 @@
-@@
-_expression_ n, d;
-@@
-
-(
-- (((n + d) - 1) / d)
-+ DIV_ROUND_UP(n, d)
-|
-- ((n + (d - 1)) / d)
-+ DIV_ROUND_UP(n, d)
-)
diff --git a/scripts/coccinelle/macros.cocci b/scripts/coccinelle/macros.cocci
new file mode 100644
index 0000000..62208e2
--- /dev/null
+++ b/scripts/coccinelle/macros.cocci
@@ -0,0 +1,26 @@
+// DIV_ROUND_UP
+@@
+_expression_ n, d;
+@@
+(
+- (((n + d) - 1) / d)
++ DIV_ROUND_UP(n, d)
+|
+- ((n + (d - 1)) / d)
++ DIV_ROUND_UP(n, d)
+)
+
+// ROUND_UP
+@@
+_expression_ n, d;
+@@
+(
+- ((((n + d) - 1) / d) * d)
++ ROUND_UP(n, d)
+|
+- (((n + (d - 1)) / d) * d)
++ ROUND_UP(n, d)
+|
+- (DIV_ROUND_UP(n,d) * d)
++ ROUND_UP(n, d)
+)
diff --git a/src/bin/backlog.c b/src/bin/backlog.c
index aa8765d..6b687f4 100644
--- a/src/bin/backlog.c
+++ b/src/bin/backlog.c
@@ -16,7 +16,7 @@ _accounting_change(int64_t diff)
{
if (diff > 0)
{
- diff = DIV_ROUND_UP(diff, 16) * 16;
+ diff = ROUND_UP(diff, 16);
}
else
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.