We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f72e46b commit 44a87a8Copy full SHA for 44a87a8
.ci/linters/c/alloc_linter.R
@@ -4,8 +4,9 @@
4
# 2. Check the next line for a check like 'if (!x || !y)'
5
alloc_linter = function(c_obj) {
6
lines = c_obj$lines
7
- # Be a bit more precise to avoid mentions in comments
8
- alloc_lines = grep(R"{=\s*([(]\w+\s*[*][)])?[mc]alloc[(]}", lines)
+ # Be a bit more precise to avoid mentions in comments, and allow
+ # malloc(0) to be used for convenience (e.g. #6757)
9
+ alloc_lines = grep(R"{=\s*([(]\w+\s*[*][)])?[mc]alloc[(][^0]}", lines)
10
if (!length(alloc_lines)) return()
11
# int *tmp=(int*)malloc(...); or just int tmp=malloc(...);
12
alloc_keys = lines[alloc_lines] |>
0 commit comments