20 lines
397 B
Bash
Executable file
20 lines
397 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
src_dir="src/runtime"
|
|
|
|
allocation_functions=(
|
|
malloc
|
|
calloc
|
|
realloc
|
|
free
|
|
)
|
|
|
|
for function in ${allocation_functions[@]}; do
|
|
usages=$(grep --line-number -E "\b${function}\(" -r "${src_dir}" --exclude alloc.h )
|
|
|
|
if [[ ! -z $usages ]]; then
|
|
echo "The ${function} function should not be called directly, but is called here:"
|
|
echo "$usages"
|
|
exit 1
|
|
fi
|
|
done
|