From 4b56dee0873d57ed2a0891a4a2370d20d46845c3 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 18 Feb 2024 07:06:15 +0000 Subject: code base: set the visilbity of internal library interfaces to hidden. --- src/internal/slibtool_dprintf_impl.c | 3 ++- src/internal/slibtool_driver_impl.h | 1 + src/internal/slibtool_errinfo_impl.c | 3 ++- src/internal/slibtool_lconf_impl.c | 3 ++- src/internal/slibtool_libmeta_impl.c | 3 ++- src/internal/slibtool_mapfile_impl.c | 7 ++++--- src/internal/slibtool_objlist_impl.c | 3 ++- src/internal/slibtool_objmeta_impl.c | 3 ++- src/internal/slibtool_snprintf_impl.c | 3 ++- src/internal/slibtool_symlink_impl.c | 5 +++-- src/internal/slibtool_visibility_impl.h | 10 ++++++++++ 11 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 src/internal/slibtool_visibility_impl.h (limited to 'src/internal') diff --git a/src/internal/slibtool_dprintf_impl.c b/src/internal/slibtool_dprintf_impl.c index bc84ca9..ad90a0d 100644 --- a/src/internal/slibtool_dprintf_impl.c +++ b/src/internal/slibtool_dprintf_impl.c @@ -11,8 +11,9 @@ #include #include "slibtool_dprintf_impl.h" +#include "slibtool_visibility_impl.h" -int slbt_dprintf(int fd, const char * fmt, ...) +slbt_hidden int slbt_dprintf(int fd, const char * fmt, ...) { int ret; int cnt; diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index 2fecb92..e4c0977 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -15,6 +15,7 @@ #include #include "slibtool_dprintf_impl.h" #include "slibtool_mapfile_impl.h" +#include "slibtool_visibility_impl.h" #include "argv/argv.h" #define SLBT_OPTV_ELEMENTS 128 diff --git a/src/internal/slibtool_errinfo_impl.c b/src/internal/slibtool_errinfo_impl.c index 02ebfc4..3b95b46 100644 --- a/src/internal/slibtool_errinfo_impl.c +++ b/src/internal/slibtool_errinfo_impl.c @@ -7,8 +7,9 @@ #include #include "slibtool_driver_impl.h" #include "slibtool_errinfo_impl.h" +#include "slibtool_visibility_impl.h" -int slbt_record_error( +slbt_hidden int slbt_record_error( const struct slbt_driver_ctx * dctx, int esyscode, int elibcode, diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c index c7d2fd3..32f192d 100644 --- a/src/internal/slibtool_lconf_impl.c +++ b/src/internal/slibtool_lconf_impl.c @@ -18,6 +18,7 @@ #include "slibtool_errinfo_impl.h" #include "slibtool_symlink_impl.h" #include "slibtool_readlink_impl.h" +#include "slibtool_visibility_impl.h" enum slbt_lconf_opt { SLBT_LCONF_OPT_UNKNOWN, @@ -708,7 +709,7 @@ static int slbt_get_lconf_var( return 0; } -int slbt_get_lconf_flags( +slbt_hidden int slbt_get_lconf_flags( struct slbt_driver_ctx * dctx, const char * lconf, uint64_t * flags) diff --git a/src/internal/slibtool_libmeta_impl.c b/src/internal/slibtool_libmeta_impl.c index c3f4109..db2753b 100644 --- a/src/internal/slibtool_libmeta_impl.c +++ b/src/internal/slibtool_libmeta_impl.c @@ -13,6 +13,7 @@ #include "slibtool_dprintf_impl.h" #include "slibtool_errinfo_impl.h" #include "slibtool_metafile_impl.h" +#include "slibtool_visibility_impl.h" static int slbt_create_default_library_wrapper( const struct slbt_driver_ctx * dctx, @@ -266,7 +267,7 @@ static int slbt_create_compatible_library_wrapper( return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } -int slbt_create_library_wrapper( +slbt_hidden int slbt_create_library_wrapper( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, char * arname, diff --git a/src/internal/slibtool_mapfile_impl.c b/src/internal/slibtool_mapfile_impl.c index b6c749d..3440484 100644 --- a/src/internal/slibtool_mapfile_impl.c +++ b/src/internal/slibtool_mapfile_impl.c @@ -15,6 +15,7 @@ #include "slibtool_errinfo_impl.h" #include "slibtool_mapfile_impl.h" +#include "slibtool_visibility_impl.h" static void slbt_munmap(void * addr, size_t size) { @@ -23,7 +24,7 @@ static void slbt_munmap(void * addr, size_t size) } } -struct slbt_map_info * slbt_map_file( +slbt_hidden struct slbt_map_info * slbt_map_file( int fdat, const char * path, uint32_t flags) @@ -82,13 +83,13 @@ struct slbt_map_info * slbt_map_file( return mapinfo; } -void slbt_unmap_file(struct slbt_map_info * mapinfo) +slbt_hidden void slbt_unmap_file(struct slbt_map_info * mapinfo) { slbt_munmap(mapinfo->addr,mapinfo->size); free(mapinfo); } -int slbt_mapped_readline( +slbt_hidden int slbt_mapped_readline( const struct slbt_driver_ctx * dctx, struct slbt_map_info * mapinfo, char * buf, diff --git a/src/internal/slibtool_objlist_impl.c b/src/internal/slibtool_objlist_impl.c index 91bf94f..a7176cd 100644 --- a/src/internal/slibtool_objlist_impl.c +++ b/src/internal/slibtool_objlist_impl.c @@ -17,8 +17,9 @@ #include "slibtool_errinfo_impl.h" #include "slibtool_mapfile_impl.h" #include "slibtool_objlist_impl.h" +#include "slibtool_visibility_impl.h" -int slbt_objlist_read( +slbt_hidden int slbt_objlist_read( int fdcwd, struct slbt_obj_list * objlist) { diff --git a/src/internal/slibtool_objmeta_impl.c b/src/internal/slibtool_objmeta_impl.c index 06a11a6..1694e1d 100644 --- a/src/internal/slibtool_objmeta_impl.c +++ b/src/internal/slibtool_objmeta_impl.c @@ -11,6 +11,7 @@ #include "slibtool_dprintf_impl.h" #include "slibtool_errinfo_impl.h" #include "slibtool_metafile_impl.h" +#include "slibtool_visibility_impl.h" static int slbt_create_default_object_wrapper( const struct slbt_driver_ctx * dctx, @@ -101,7 +102,7 @@ static int slbt_create_compatible_object_wrapper( return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } -int slbt_create_object_wrapper( +slbt_hidden int slbt_create_object_wrapper( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx) { diff --git a/src/internal/slibtool_snprintf_impl.c b/src/internal/slibtool_snprintf_impl.c index 3b9f266..a60fb60 100644 --- a/src/internal/slibtool_snprintf_impl.c +++ b/src/internal/slibtool_snprintf_impl.c @@ -11,6 +11,7 @@ #include #include "slibtool_snprintf_impl.h" +#include "slibtool_visibility_impl.h" /*****************************************************************/ @@ -23,7 +24,7 @@ /**********************************************************/ -int slbt_snprintf(char * buf, size_t buflen, const char * fmt, ...) +slbt_hidden int slbt_snprintf(char * buf, size_t buflen, const char * fmt, ...) { va_list ap; size_t nbytes; diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c index 174cb48..21d4972 100644 --- a/src/internal/slibtool_symlink_impl.c +++ b/src/internal/slibtool_symlink_impl.c @@ -14,12 +14,13 @@ #include "slibtool_symlink_impl.h" #include "slibtool_readlink_impl.h" #include "slibtool_snprintf_impl.h" +#include "slibtool_visibility_impl.h" #define SLBT_DEV_NULL_FLAGS (SLBT_DRIVER_ALL_STATIC \ | SLBT_DRIVER_DISABLE_SHARED \ | SLBT_DRIVER_DISABLE_STATIC) -int slbt_create_symlink( +slbt_hidden int slbt_create_symlink( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, const char * target, @@ -130,7 +131,7 @@ int slbt_create_symlink( : 0; } -int slbt_symlink_is_a_placeholder(int fdcwd, char * lnkpath) +slbt_hidden int slbt_symlink_is_a_placeholder(int fdcwd, char * lnkpath) { size_t len; char slink [PATH_MAX]; diff --git a/src/internal/slibtool_visibility_impl.h b/src/internal/slibtool_visibility_impl.h new file mode 100644 index 0000000..7b1e50f --- /dev/null +++ b/src/internal/slibtool_visibility_impl.h @@ -0,0 +1,10 @@ +#ifndef SLIBTOOL_VISIBILITY_IMPL_H +#define SLIBTOOL_VISIBILITY_IMPL_H + +#ifdef _ATTR_VISIBILITY_HIDDEN +#define slbt_hidden _ATTR_VISIBILITY_HIDDEN +#else +#define slbt_hidden +#endif + +#endif -- cgit v1.2.3