diff options
author | Manish Singh <yosh@gimp.org> | 2005-02-23 06:04:05 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 2005-02-23 06:04:05 +0000 |
commit | 1ecb9a686cb917111569e52207662c51dbbfb6bf (patch) | |
tree | bf5015864d6b9cac9f2f00c05a86c738753be3ea /glib | |
parent | ea28f59fc1bb7d16f7e39ac260a6364ffc7f2e52 (diff) | |
download | glib-1ecb9a686cb917111569e52207662c51dbbfb6bf.tar.gz |
On G_OS_UNIX, simple #define g_open and co. as aliases for their
Tue Feb 22 22:03:38 2005 Manish Singh <yosh@gimp.org>
* glib/gstdio.h: On G_OS_UNIX, simple #define g_open and co. as
aliases for their respective C library functions, instead of
using the function wrappers. This avoids library users having to
care about matching large file support with whatever glib has been
built with. Fixes bug #167942.
* glib/gstdio.c
* glib/abicheck.sh
* glib/glib.symbols
* glib/makegalias.pl: Logic to make the gstdio wrappers still
available for compatibility, but not used in new code.
Diffstat (limited to 'glib')
-rwxr-xr-x | glib/abicheck.sh | 2 | ||||
-rw-r--r-- | glib/glib.symbols | 23 | ||||
-rw-r--r-- | glib/gstdio.c | 2 | ||||
-rw-r--r-- | glib/gstdio.h | 21 | ||||
-rwxr-xr-x | glib/makegalias.pl | 12 |
5 files changed, 49 insertions, 11 deletions
diff --git a/glib/abicheck.sh b/glib/abicheck.sh index d77e63dcd..fc4ba1d86 100755 --- a/glib/abicheck.sh +++ b/glib/abicheck.sh @@ -5,7 +5,7 @@ egrep '^#([^i]|if).*[^\]$' "${top_builddir:-..}/glibconfig.h" > glibconfig.cpp INCLUDES="-include ${top_builddir:-..}/config.h" INCLUDES="$INCLUDES -include glibconfig.cpp" -cpp -P -DINCLUDE_INTERNAL_SYMBOLS $INCLUDES "${srcdir:-.}/glib.symbols" | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE$//' | sort > expected-abi +cpp -P -DINCLUDE_INTERNAL_SYMBOLS -DG_STDIO_NO_WRAP_ON_UNIX $INCLUDES "${srcdir:-.}/glib.symbols" | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE$//' | sort > expected-abi rm glibconfig.cpp nm -D .libs/libglib-2.0.so | grep " T " | cut -d ' ' -f 3 | sort > actual-abi diff --git a/glib/glib.symbols b/glib/glib.symbols index ec3272664..850def2bc 100644 --- a/glib/glib.symbols +++ b/glib/glib.symbols @@ -199,10 +199,8 @@ g_find_program_in_path PRIVATE #ifdef G_OS_WIN32 g_find_program_in_path_utf8 #endif -g_fopen g_fprintf G_GNUC_PRINTF(2,3) g_free -g_freopen g_get_application_name g_get_charset g_get_current_dir PRIVATE @@ -415,7 +413,6 @@ g_log_set_default_handler g_log_set_fatal_mask g_log_set_handler g_logv -g_lstat g_main_context_acquire g_main_context_add_poll g_main_context_check @@ -470,7 +467,6 @@ g_memdup G_GNUC_MALLOC g_mem_is_system_malloc g_mem_profile g_mem_set_vtable -g_mkdir g_mkstemp PRIVATE #ifdef G_OS_WIN32 g_mkstemp_utf8 @@ -509,7 +505,6 @@ g_nullify_pointer g_once_impl g_on_error_query g_on_error_stack_trace -g_open g_option_context_add_group g_option_context_add_main_entries g_option_error_quark @@ -626,10 +621,7 @@ g_relation_insert g_relation_new g_relation_print g_relation_select -g_remove -g_rename g_return_if_fail_warning -g_rmdir g_scanner_cur_line g_scanner_cur_position g_scanner_cur_token @@ -723,7 +715,6 @@ g_spawn_command_line_sync g_spawn_error_quark g_spawn_sync g_sprintf G_GNUC_PRINTF(2,3) -g_stat g_static_mutex_free g_static_mutex_get_mutex_impl g_static_mutex_init @@ -891,7 +882,6 @@ g_unichar_validate g_unichar_xdigit_value G_GNUC_CONST g_unicode_canonical_decomposition G_GNUC_MALLOC g_unicode_canonical_ordering -g_unlink g_unsetenv PRIVATE #ifdef G_OS_WIN32 g_unsetenv_utf8 @@ -967,3 +957,16 @@ g_bit_nth_lsf g_bit_nth_msf g_bit_storage #endif +#if !defined(G_OS_UNIX) || defined(G_STDIO_NO_WRAP_ON_UNIX) +/* gstdio wrappers */ +g_open +g_rename +g_mkdir +g_stat +g_lstat +g_unlink +g_remove +g_rmdir +g_fopen +g_freopen +#endif diff --git a/glib/gstdio.c b/glib/gstdio.c index 43ad2c347..38c37618e 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -19,6 +19,8 @@ */ #include "config.h" + +#define G_STDIO_NO_WRAP_ON_UNIX #include "galias.h" #include "glib.h" diff --git a/glib/gstdio.h b/glib/gstdio.h index 82874b456..534a61e27 100644 --- a/glib/gstdio.h +++ b/glib/gstdio.h @@ -25,6 +25,25 @@ #include <sys/stat.h> +#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX) + +/* Just pass on to the system functions, so there's no potential for data + * format mismatches, especially with large file interfaces. + */ + +#define g_open open +#define g_rename rename +#define g_mkdir mkdir +#define g_stat stat +#define g_lstat lstat +#define g_unlink unlink +#define g_remove remove +#define g_rmdir rmdir +#define g_fopen fopen +#define g_freopen freopen + +#else /* ! G_OS_UNIX */ + /* Wrappers for C library functions that take pathname arguments. On * Unix, the pathname is a file name as it literally is in the file * system. On well-maintained systems with consistent users who know @@ -64,4 +83,6 @@ FILE *g_freopen (const gchar *filename, const gchar *mode, FILE *stream); +#endif /* G_OS_UNIX */ + #endif /* __G_STDIO_H__ */ diff --git a/glib/makegalias.pl b/glib/makegalias.pl index daa6769ff..1978784bc 100755 --- a/glib/makegalias.pl +++ b/glib/makegalias.pl @@ -16,7 +16,12 @@ print <<EOF; #include "glib.h" +#include "gprintf.h" + +#if !defined(G_OS_UNIX) || defined(G_STDIO_NO_WRAP_ON_UNIX) #include "gstdio.h" +#endif + #ifdef G_OS_WIN32 #include "gwin32.h" #endif @@ -77,6 +82,13 @@ while (<>) { next; } + if ($_ =~ /^\#if.*G_STDIO_NO_WRAP_ON_UNIX/) + { + print $_; + + next; + } + chop; my $str = $_; my @words; |