From 0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5 Mon Sep 17 00:00:00 2001 From: Vincent Mihalkovic Date: Fri, 8 Mar 2024 14:04:33 +0100 Subject: [PATCH] mocklibc: move the print_indent function to the file where it is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes build error with GCC >= 14 and clang >= 17, failing on: ``` ../subprojects/mocklibc-1.0/src/netgroup-debug.c:25:3: error: implicit declaration of function ‘print_indent’ [-Wimplicit-function-declaration] 25 | print_indent(stream, indent); | ^~~~~~~~~~~~ ``` Closes: #6 --- test/mocklibc/src/netgroup-debug.c | 11 +++++++++++ test/mocklibc/src/netgroup.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/mocklibc/src/netgroup-debug.c b/test/mocklibc/src/netgroup-debug.c index 81d6e728..46e5b25f 100644 --- a/test/mocklibc/src/netgroup-debug.c +++ b/test/mocklibc/src/netgroup-debug.c @@ -21,6 +21,17 @@ #include #include +/** + * Print a varaible indentation to the stream. + * @param stream Stream to print to + * @param indent Number of indents to use + */ +static void print_indent(FILE *stream, unsigned int indent) { + int i; + for (i = 0; i < indent; i++) + fprintf(stream, " "); +} + void netgroup_debug_print_entry(struct entry *entry, FILE *stream, unsigned int indent) { print_indent(stream, indent); diff --git a/test/mocklibc/src/netgroup.c b/test/mocklibc/src/netgroup.c index 06a8a894..e16e4519 100644 --- a/test/mocklibc/src/netgroup.c +++ b/test/mocklibc/src/netgroup.c @@ -71,17 +71,6 @@ static char *parser_copy_word(char **cur) { return result; } -/** - * Print a varaible indentation to the stream. - * @param stream Stream to print to - * @param indent Number of indents to use - */ -void print_indent(FILE *stream, unsigned int indent) { - int i; - for (i = 0; i < indent; i++) - fprintf(stream, " "); -} - /** * Connect entries with 'child' type to their child entries. * @param headentry Head of list of entries that need to be connected