Skip to content

Commit 7202c22

Browse files
musicinmybrainnvictus
authored andcommitted
Do not use function pointers of unspecified arguments
This is necessary in order to build with C23, which is the default standard in GCC 15. In C23, `int foo()` is no longer a function taking unspecified arguments, but a function taking no arguments, like `int foo(void)`. Furthermore, treating a pointer to a function of unspecified arguments as compatible with a pointer to a function with declared arguments was probably always dubious, although it worked in practice.
1 parent 2f933e9 commit 7202c22

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

include/bedTabix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct lineFile *lf;
1212
struct bedTabixFile *bedTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end);
1313
/* Open a bed file that has been compressed and indexed by tabix */
1414

15-
struct bed *bedTabixReadBeds(struct bedTabixFile *btf, char *chromName, int winStart, int winEnd, struct bed * (*loadBed)(), int minScore);
15+
struct bed *bedTabixReadBeds(struct bedTabixFile *btf, char *chromName, int winStart, int winEnd, struct bed * (*loadBed)(void *), int minScore);
1616

1717
void bedTabixFileClose(struct bedTabixFile *btf);
1818
#endif //BEDTABIX_H

include/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ void slSort(void *pList, CmpFunction *compare);
423423
* The arguments to the compare function in real, non-void, life
424424
* are pointers to pointers. */
425425

426-
void slUniqify(void *pList, CmpFunction *compare, void (*free)());
426+
void slUniqify(void *pList, CmpFunction *compare, void (*free)(void *));
427427
/* Return sorted list with duplicates removed.
428428
* Compare should be same type of function as slSort's compare (taking
429429
* pointers to pointers to elements. Free should take a simple
@@ -432,7 +432,7 @@ void slUniqify(void *pList, CmpFunction *compare, void (*free)());
432432
void slSortMerge(void *pA, void *b, CmpFunction *compare);
433433
// Merges and sorts a pair of singly linked lists using slSort.
434434

435-
void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)());
435+
void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)(void *));
436436
// Merges and sorts a pair of singly linked lists leaving only unique
437437
// items via slUniqufy. duplicate itens are defined by the compare routine
438438
// returning 0. If free is provided, items dropped from list can disposed of.

include/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void freeHashAndVals(struct hash **pHash);
250250
/* Free up hash table and all values associated with it.
251251
* (Just calls freeMem on each hel->val) */
252252

253-
void hashFreeWithVals(struct hash **pHash, void (freeFunc)());
253+
void hashFreeWithVals(struct hash **pHash, void (freeFunc)(void **));
254254
/* Free up hash table and all values associated with it. freeFunc is a
255255
* function to free an entry, should take a pointer to a pointer to an
256256
* entry. */

src/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ if (count > 1)
341341
}
342342
}
343343

344-
void slUniqify(void *pList, int (*compare )(const void *elem1, const void *elem2), void (*free)())
344+
void slUniqify(void *pList, int (*compare )(const void *elem1, const void *elem2), void (*free)(void *))
345345
/* Return sorted list with duplicates removed.
346346
* Compare should be same type of function as slSort's compare (taking
347347
* pointers to pointers to elements. Free should take a simple
@@ -371,7 +371,7 @@ slCat(*pList, b);
371371
slSort(pList,compare);
372372
}
373373

374-
void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)())
374+
void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)(void *))
375375
// Merges and sorts a pair of singly linked lists leaving only unique
376376
// items via slUniqufy. duplicate itens are defined by the compare routine
377377
// returning 0. If free is provided, items dropped from list can disposed of.

src/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ if ((hash = *pHash) != NULL)
638638
}
639639
}
640640

641-
void hashFreeWithVals(struct hash **pHash, void (freeFunc)())
641+
void hashFreeWithVals(struct hash **pHash, void (freeFunc)(void **))
642642
/* Free up hash table and all values associated with it. freeFunc is a
643643
* function to free an entry, should take a pointer to a pointer to an
644644
* entry. */

0 commit comments

Comments
 (0)