Skip to content

Commit

Permalink
mocklibc: move the print_indent function to the file where it is used
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vmihalko authored and jrybar-rh committed Mar 12, 2024
1 parent 6c9c079 commit 0d78d1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 11 additions & 0 deletions test/mocklibc/src/netgroup-debug.c
Expand Up @@ -21,6 +21,17 @@
#include <stdio.h>
#include <stdlib.h>

/**
* 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);

Expand Down
11 changes: 0 additions & 11 deletions test/mocklibc/src/netgroup.c
Expand Up @@ -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
Expand Down

0 comments on commit 0d78d1e

Please sign in to comment.