From 9974cec26b9999a150cadd5ee99d426badc03aeb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 10 May 2019 12:58:56 +0100 Subject: [PATCH] =?UTF-8?q?glib:=20Rename=20G=5FSTDIO=5FNO=5FWRAP=5FON=5FU?= =?UTF-8?q?NIX=20=E2=86=92=20G=5FSTDIO=5FWRAP=5FON=5FUNIX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This clarifies the meaning a bit. Don’t change the logic associated with it. Add a few comments to clarify things further. Based on work done by Emmanuel Fleury. Signed-off-by: Philip Withnall Fixes: #77 --- glib/gstdio.c | 4 +++- glib/gstdio.h | 5 ++++- glib/tests/fileutils.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/glib/gstdio.c b/glib/gstdio.c index 51a1ddbe9..16df66bd2 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -19,7 +19,9 @@ #include "config.h" #include "glibconfig.h" -#define G_STDIO_NO_WRAP_ON_UNIX +/* Don’t redefine (for example) g_open() to open(), since we actually want to + * define g_open() in this file and export it as a symbol. See gstdio.h. */ +#define G_STDIO_WRAP_ON_UNIX #include #include diff --git a/glib/gstdio.h b/glib/gstdio.h index 94f4fa36f..f1781f3e9 100644 --- a/glib/gstdio.h +++ b/glib/gstdio.h @@ -54,12 +54,15 @@ typedef struct stat GStatBuf; #endif -#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX) +#if defined(G_OS_UNIX) && !defined(G_STDIO_WRAP_ON_UNIX) /* Just pass on to the system functions, so there's no potential for data * format mismatches, especially with large file interfaces. * A few functions can't be handled in this way, since they are not defined * in a portable system header that we could include here. + * + * #G_STDIO_WRAP_ON_UNIX is not public API and its behaviour is not guaranteed + * in future. */ #ifndef __GTK_DOC_IGNORE__ diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index 34f650247..b1f0cbc74 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -28,8 +28,8 @@ #include -/* Test our stdio wrappers here */ -#define G_STDIO_NO_WRAP_ON_UNIX +/* Test our stdio wrappers here; this disables redefining (e.g.) g_open() to open() */ +#define G_STDIO_WRAP_ON_UNIX #include #ifdef G_OS_UNIX