diff mbox series

[2/9] util: Make qemu_oom_check() a static function

Message ID 20220226180723.1706285-3-peter.maydell@linaro.org
State Superseded
Headers show
Series Cleanup of qemu_oom_check() and qemu_memalign() | expand

Commit Message

Peter Maydell Feb. 26, 2022, 6:07 p.m. UTC
The qemu_oom_check() function, which we define in both oslib-posix.c
and oslib-win32.c, is now used only locally in that file; make it
static.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/qemu-common.h | 2 --
 util/oslib-posix.c    | 2 +-
 util/oslib-win32.c    | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

Comments

Richard Henderson Feb. 27, 2022, 12:27 a.m. UTC | #1
On 2/26/22 08:07, Peter Maydell wrote:
> The qemu_oom_check() function, which we define in both oslib-posix.c
> and oslib-win32.c, is now used only locally in that file; make it
> static.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/qemu-common.h | 2 --
>   util/oslib-posix.c    | 2 +-
>   util/oslib-win32.c    | 2 +-
>   3 files changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Philippe Mathieu-Daudé March 1, 2022, midnight UTC | #2
On 26/2/22 19:07, Peter Maydell wrote:
> The qemu_oom_check() function, which we define in both oslib-posix.c
> and oslib-win32.c, is now used only locally in that file; make it
> static.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   include/qemu-common.h | 2 --
>   util/oslib-posix.c    | 2 +-
>   util/oslib-win32.c    | 2 +-
>   3 files changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 68b2e3bc109..8c0d9ab0f77 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -26,8 +26,6 @@ 
 int qemu_main(int argc, char **argv, char **envp);
 #endif
 
-void *qemu_oom_check(void *ptr);
-
 ssize_t qemu_write_full(int fd, const void *buf, size_t count)
     QEMU_WARN_UNUSED_RESULT;
 
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index f2be7321c59..ed5974d3845 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -199,7 +199,7 @@  fail_close:
     return false;
 }
 
-void *qemu_oom_check(void *ptr)
+static void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
         fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno));
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index af559ef3398..c87e6977246 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -44,7 +44,7 @@ 
 /* this must come after including "trace.h" */
 #include <shlobj.h>
 
-void *qemu_oom_check(void *ptr)
+static void *qemu_oom_check(void *ptr)
 {
     if (ptr == NULL) {
         fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError());