]>
Commit | Line | Data |
---|---|---|
e1e7be22 DR |
1 | #!/bin/sh |
2 | # | |
3 | # Find files which include the xalloc.h header, but which still call | |
4 | # the unwrapped calloc and malloc. | |
5 | # | |
6 | ||
7 | cd "$(git rev-parse --show-toplevel)" || { | |
8 | echo "error: failed to chdir to git root" | |
9 | exit 1 | |
10 | } | |
11 | ||
12 | git grep -zl '#include "xalloc.h"' | | |
99d618c0 | 13 | xargs -0 grep -nE '\b(([cm]|re)alloc|strdup|asprintf)[[:space:]]*\([^)]' |
d05a3e97 KZ |
14 | |
15 | result=$? | |
16 | ||
17 | if [ $result -eq 123 ]; then | |
18 | exit 0 # not found | |
19 | elif [ $result -eq 0 ]; then | |
20 | exit 1 # found | |
21 | fi | |
22 | ||
23 | exit $result |