Finds usage of strdup, malloc, calloc, and realloc when xalloc.h is included. http://marc.info/?l=util-linux-ng&m=132438338929925&w=2 Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx> --- Ask and you shall receive ;) tools/checkxalloc.sh | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) create mode 100755 tools/checkxalloc.sh diff --git a/tools/checkxalloc.sh b/tools/checkxalloc.sh new file mode 100755 index 0000000..f8f8c8c --- /dev/null +++ b/tools/checkxalloc.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Find files which include the xalloc.h header, but which still call +# the unwrapped calloc and malloc. +# + +cd "$(git rev-parse --show-toplevel)" || { + echo "error: failed to chdir to git root" + exit 1 +} + +git grep -zl '#include "xalloc.h"' | + xargs -0 grep -nwE '[^x](([cm]|re)alloc|strdup)\(' + -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html