[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scratch_buffer: Document the exported API
From: |
Bruno Haible |
Subject: |
Re: scratch_buffer: Document the exported API |
Date: |
Sun, 07 Mar 2021 00:28:00 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; ) |
Paul Eggert wrote:
> The idea was that the gl_* symbols would not compete with the like-named
> __libc_* symbols when Gnulib dynarray is built under glibc. I don't
> recall the details about the competition, unfortunately.
Ah, it's to avoid conflicts with glibc. I thought it was pure convenience.
Indeed, glibc exports lots of __libc_* symbols:
$ nm --dynamic /lib/x86_64-linux-gnu/libc.so.6 | grep __libc_
0000000000114b30 T __libc_alloca_cutoff
00000000000368a0 T __libc_allocate_rtsig
00000000000368a0 T __libc_allocate_rtsig_private
0000000000084d80 T __libc_calloc
0000000000136280 T __libc_clntudp_bufcreate
0000000000036890 T __libc_current_sigrtmax
0000000000036890 T __libc_current_sigrtmax_private
0000000000036880 T __libc_current_sigrtmin
0000000000036880 T __libc_current_sigrtmin_private
0000000000143820 T __libc_dlclose
0000000000143e20 T __libc_dl_error_tsd
00000000001436d0 T __libc_dlopen_mode
0000000000143770 T __libc_dlsym
U __libc_enable_secure
0000000000077800 T __libc_fatal
00000000000cc3c0 T __libc_fork
0000000000084540 T __libc_free
0000000000174410 T __libc_freeres
0000000000106340 T __libc_ifunc_impl_list
00000000000205a0 T __libc_init_first
0000000000035270 T __libc_longjmp
0000000000086ef0 T __libc_mallinfo
0000000000084180 T __libc_malloc
00000000000852e0 T __libc_mallopt
0000000000084b10 T __libc_memalign
00000000000f5b20 T __libc_pread
0000000000115270 T __libc_pthread_init
0000000000086940 T __libc_pvalloc
00000000000f5b80 T __libc_pwrite
0000000000084710 T __libc_realloc
0000000000137e50 T __libc_rpc_getport
0000000000108b20 T __libc_sa_len
0000000000089710 T __libc_scratch_buffer_grow
0000000000089790 T __libc_scratch_buffer_grow_preserve
0000000000089840 T __libc_scratch_buffer_set_array_size
0000000000039f00 W __libc_secure_getenv
0000000000035270 T __libc_siglongjmp
0000000000020750 T __libc_start_main
00000000000453a0 T __libc_system
00000000001751e0 T __libc_thread_freeres
0000000000086690 T __libc_valloc
00000000000cc740 T __libc_vfork
Worth a comment.
2021-03-06 Bruno Haible <bruno@clisp.org>
scratch_buffer: Add comment.
* lib/scratch_buffer.h: Add comment.
diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h
index f4b5f9e..da4455d 100644
--- a/lib/scratch_buffer.h
+++ b/lib/scratch_buffer.h
@@ -112,10 +112,12 @@ extern void *scratch_buffer_dupfree (struct
scratch_buffer *buffer,
#include <libc-config.h>
+/* Avoid possible conflicts with symbols exported by the GNU libc. */
#define __libc_scratch_buffer_dupfree gl_scratch_buffer_dupfree
#define __libc_scratch_buffer_grow gl_scratch_buffer_grow
#define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve
#define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size
+
#include <malloc/scratch_buffer.h>
#endif /* _GL_SCRATCH_BUFFER_H */