-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(scripts): clean up bash scripts
- Loading branch information
1 parent
33045ee
commit 9328fa7
Showing
18 changed files
with
237 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
src_dir="lib/src" | ||
src_dir=lib/src | ||
allocation_functions=(malloc calloc realloc free) | ||
|
||
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" | ||
for function in "${allocation_functions[@]}"; do | ||
usages=$(grep -n -E "\b${function}\(" -r $src_dir --exclude alloc.c --exclude stdlib.c) | ||
if [[ -n $usages ]]; then | ||
printf 'The %s function should not be called directly, but is called here:\n%s\n' "$function" "$usages" >&2 | ||
exit 1 | ||
fi | ||
done |
Oops, something went wrong.