__weak_alias() doesn't exist on FreeBSD. Use __weak_reference();
Expose iconv functions as weak symbols as well as their internal remapped #define names. This is necessary for autoconf compatability - on Linux it appears that #include <iconv.h> isn't a link time prerequisite for their version that's built into glibc. Initialize the pthread rwlock. Note that upstream has three separate locks. The file-local static lock appears intentional. I'm using this as a ports-compatible compile-time substitute for converters/libiconv on one of my personal machines.
This commit is contained in:
parent
0d5daade6d
commit
3d4b80da4e
@ -17,6 +17,16 @@ FBSD_1.2 {
|
||||
libiconvlist;
|
||||
};
|
||||
|
||||
FBSD_1.3 {
|
||||
iconv;
|
||||
iconv_open;
|
||||
iconv_close;
|
||||
iconv_open_into;
|
||||
iconv_set_relocation_prefix;
|
||||
iconvctl;
|
||||
iconvlist;
|
||||
};
|
||||
|
||||
FBSDprivate_1.0 {
|
||||
_citrus_bcs_convert_to_lower;
|
||||
_citrus_bcs_convert_to_upper;
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static pthread_rwlock_t lock;
|
||||
/* XXX Yes, the original code has three separate file-local lock instances */
|
||||
static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
|
||||
|
||||
#define WLOCK if (__isthreaded) \
|
||||
pthread_rwlock_wrlock(&lock);
|
||||
|
@ -47,16 +47,13 @@
|
||||
#include "citrus_hash.h"
|
||||
#include "citrus_iconv.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(libiconv, _iconv)
|
||||
__weak_alias(libiconv_open, _iconv_open)
|
||||
__weak_alias(libiconv_open_into, _iconv_open_into)
|
||||
__weak_alias(libiconv_close, _iconv_close)
|
||||
__weak_alias(libiconvlist, _iconvlist)
|
||||
__weak_alias(libiconvctl, _iconvctl)
|
||||
__weak_alias(libiconv_set_relocation_prefix, _iconv_set_relocation_prefix)
|
||||
__weak_alias(iconv_canonicalize, _iconv_canonicalize)
|
||||
#endif
|
||||
__weak_reference(libiconv, iconv);
|
||||
__weak_reference(libiconv_open, iconv_open);
|
||||
__weak_reference(libiconv_open_into, iconv_open_into);
|
||||
__weak_reference(libiconv_close, iconv_close);
|
||||
__weak_reference(libiconvlist, iconvlist);
|
||||
__weak_reference(libiconvctl, iconvctl);
|
||||
__weak_reference(libiconv_set_relocation_prefix, iconv_set_relocation_prefix);
|
||||
|
||||
#define ISBADF(_h_) (!(_h_) || (_h_) == (iconv_t)-1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user