From 42b9df59c1a54092e3857ec075f614e042df328c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Dec 2017 20:44:54 +1030 Subject: [PATCH] update-mocks: allow it to handle missing notleak_ Signed-off-by: Rusty Russell --- tools/mockup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/mockup.sh b/tools/mockup.sh index 448c99741..9a9a49f26 100755 --- a/tools/mockup.sh +++ b/tools/mockup.sh @@ -15,7 +15,9 @@ if [ $# -eq 0 ]; then fi for SYMBOL; do - WHERE=$(grep -nH "^[a-zA-Z0-9_ (),]* [*]*$SYMBOL(" */*.h ) + # If there are multiple declarations, pick first (eg. common/memleak.h + # has notleak_ as a declaration, and then an inline). + WHERE=$(grep -nH "^[a-zA-Z0-9_ (),]* [*]*$SYMBOL(" */*.h | head -n1) if [ x"$WHERE" != x ]; then STUB='\n{ fprintf(stderr, "'$SYMBOL' called!\\n"); abort(); }' else