git: 0843a53a966e - main - biology/libbigwig: Fix name-clashing in roundup

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Thu, 28 Dec 2023 23:03:52 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0843a53a966e654d77e3d190c695d6e33bd549b5

commit 0843a53a966e654d77e3d190c695d6e33bd549b5
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2023-12-28 21:29:57 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2023-12-28 23:03:34 +0000

    biology/libbigwig: Fix name-clashing in roundup
    
    Rename the roundup method defined in bwValues.c as it clashes with the
    roundup macro defined in sys/param.h
    
    /wrkdirs/usr/ports/biology/libbigwig/work/libBigWig-0.4.7/bwValues.c:9:35:
    error: too few arguments provided to function-like macro invocation
    static uint32_t roundup(uint32_t v) {
                                      ^
    /usr/include/sys/param.h:300:9: note: macro 'roundup' defined here
            ^
    /wrkdirs/usr/ports/biology/libbigwig/work/libBigWig-0.4.7/bwValues.c:9:24:
    error: expected ';' after top level declarator
    static uint32_t roundup(uint32_t v) {
                           ^
                           ;
    /wrkdirs/usr/ports/biology/libbigwig/work/libBigWig-0.4.7/bwValues.c:350:30:
    error: too few arguments provided to function-like macro invocation
            o->m = roundup(o->l+1);
                                 ^
    /usr/include/sys/param.h:300:9: note: macro 'roundup' defined here
            ^
    /wrkdirs/usr/ports/biology/libbigwig/work/libBigWig-0.4.7/bwValues.c:370:30:
    error: too few arguments provided to function-like macro invocation
            o->m = roundup(o->l+1);
                                 ^
    /usr/include/sys/param.h:300:9: note: macro 'roundup' defined here
            ^
    4 errors generated.
    
    Approved by:    portmgr (blanket)
---
 biology/libbigwig/files/patch-bwValues.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/biology/libbigwig/files/patch-bwValues.c b/biology/libbigwig/files/patch-bwValues.c
new file mode 100644
index 000000000000..af1a590abdb8
--- /dev/null
+++ b/biology/libbigwig/files/patch-bwValues.c
@@ -0,0 +1,29 @@
+--- bwValues.c.orig	2023-12-28 21:21:29 UTC
++++ bwValues.c
+@@ -6,7 +6,7 @@
+ #include <zlib.h>
+ #include <errno.h>
+ 
+-static uint32_t roundup(uint32_t v) {
++static uint32_t bwRoundup(uint32_t v) {
+     v--;
+     v |= v >> 1;
+     v |= v >> 2;
+@@ -347,7 +347,7 @@ static bwOverlappingIntervals_t *pushIntervals(bwOverl
+ //Returns NULL on error, in which case o has been free()d
+ static bwOverlappingIntervals_t *pushIntervals(bwOverlappingIntervals_t *o, uint32_t start, uint32_t end, float value) {
+     if(o->l+1 >= o->m) {
+-        o->m = roundup(o->l+1);
++        o->m = bwRoundup(o->l+1);
+         o->start = realloc(o->start, o->m * sizeof(uint32_t));
+         if(!o->start) goto error;
+         o->end = realloc(o->end, o->m * sizeof(uint32_t));
+@@ -367,7 +367,7 @@ static bbOverlappingEntries_t *pushBBIntervals(bbOverl
+ 
+ static bbOverlappingEntries_t *pushBBIntervals(bbOverlappingEntries_t *o, uint32_t start, uint32_t end, char *str, int withString) {
+     if(o->l+1 >= o->m) {
+-        o->m = roundup(o->l+1);
++        o->m = bwRoundup(o->l+1);
+         o->start = realloc(o->start, o->m * sizeof(uint32_t));
+         if(!o->start) goto error;
+         o->end = realloc(o->end, o->m * sizeof(uint32_t));