Skip to content

Commit 8baf2f5

Browse files
committed
Fix a build warning when USE_MMAP isn't set
Building with USE_MMAP unset results in the following warning: util.c:158:13: warning: ‘safe_memcpy’ defined but not used [-Wunused-function] static void safe_memcpy(void *dest, const void *src, size_t n) ^~~~~~~~~~~ Only define the function when USE_MMAP is set. Signed-off-by: Jean Delvare <jdelvare@suse.de>
1 parent b9ebecc commit 8baf2f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ void *read_file(off_t base, size_t *max_len, const char *filename)
155155
return p;
156156
}
157157

158+
#ifdef USE_MMAP
158159
static void safe_memcpy(void *dest, const void *src, size_t n)
159160
{
160161
#ifdef USE_SLOW_MEMCPY
@@ -164,8 +165,9 @@ static void safe_memcpy(void *dest, const void *src, size_t n)
164165
*((u8 *)dest + i) = *((const u8 *)src + i);
165166
#else
166167
memcpy(dest, src, n);
167-
#endif
168+
#endif /* USE_SLOW_MEMCPY */
168169
}
170+
#endif /* USE_MMAP */
169171

170172
/*
171173
* Copy a physical memory chunk into a memory buffer.

0 commit comments

Comments
 (0)