Skip to content

Commit

Permalink
Fix another potability issues about stdint.h and va_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoh committed Nov 27, 2012
1 parent 9bd2af7 commit 38ee513
Show file tree
Hide file tree
Showing 9 changed files with 832 additions and 17 deletions.
4 changes: 3 additions & 1 deletion Makefile.am
Expand Up @@ -33,7 +33,9 @@ MAINTAINERCLEANFILES = \
$(srcdir)/ltmain.sh \
$(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/m4macros/*.m4 \
$(srcdir)/m4macros/gtk-doc.m4 \
$(srcdir)/m4macros/libtool.m4 \
$(srcdir)/m4macros/lt*.m4 \
`find "$(srcdir)" -type f -name Makefile.in -print` \
$(NULL)
DISTCLEANFILES = \
Expand Down
8 changes: 3 additions & 5 deletions configure.ac
Expand Up @@ -200,12 +200,10 @@ AC_CHECK_ALIGNOF(void *)
dnl ======================================================================
dnl functions testing
dnl ======================================================================
AX_CREATE_STDINT_H([liblangtag/lt-stdint.h])
AC_CHECK_HEADERS([dirent.h execinfo.h libgen.h sys/param.h])
AC_CHECK_FUNCS([backtrace dlopen strndup va_copy __va_copy])

if test "x$ac_cv_func_dlopen" != xyes; then
enable_modules=no
fi
AC_CHECK_FUNCS([backtrace dlopen strndup])
AC_CHECK_VA_COPY

dnl ======================================================================
dnl gettext stuff
Expand Down
3 changes: 2 additions & 1 deletion extensions/lt-ext-ldml-u.c
Expand Up @@ -14,7 +14,8 @@
#include "config.h"
#endif

#include <stdint.h>
#include "lt-stdint.h"

#include <string.h>
#include <libxml/xpath.h>
#include "lt-error.h"
Expand Down
9 changes: 9 additions & 0 deletions liblangtag/Makefile.am
Expand Up @@ -31,7 +31,9 @@ MAINTAINERCLEANFILES = \
$(NULL)
DISTCLEANFILES = \
stamp-lt-config \
stamp-lt-stdint \
lt-config.h \
lt-stdint.h \
$(NULL)
CLEANFILES = \
xgen-h \
Expand All @@ -42,6 +44,7 @@ BUILT_SOURCES = \
$(liblangtag_built_private_headers) \
$(liblangtag_built_sources) \
stamp-lt-config \
stamp-lt-stdint \
$(NULL)

##
Expand Down Expand Up @@ -87,6 +90,7 @@ liblangtag_private_headers = \
lt-redundant-private.h \
lt-region-private.h \
lt-script-private.h \
lt-stdint.h \
lt-tag-private.h \
lt-trie.h \
lt-utils.h \
Expand Down Expand Up @@ -151,6 +155,11 @@ lt-localealias.h: @BUILD_LOCALEALIAS@ Makefile
echo "Failed to generate $@."; \
exit 1; \
fi
stamp-lt-stdint: $(top_builddir)/config.status
$(AM_V_GEN) cd $(top_builddir) && \
$(SHELL) ./config.status liblangtag/lt-stdint.h
@touch $@
$(NULL)
stamp-lt-config: $(top_builddir)/config.status
$(AM_V_GEN) cd $(top_builddir) && \
$(SHELL) ./config.status liblangtag/lt-config.h
Expand Down
3 changes: 2 additions & 1 deletion liblangtag/lt-tag.c
Expand Up @@ -14,9 +14,10 @@
#include "config.h"
#endif

#include "lt-stdint.h"

#include <ctype.h>
#include <locale.h>
#include <stdint.h>
#include <string.h>
#include <libxml/xpath.h>
#include "lt-config.h"
Expand Down
2 changes: 1 addition & 1 deletion liblangtag/lt-utils.c
Expand Up @@ -132,7 +132,7 @@ lt_strdup_vprintf(const char *format,

lt_return_val_if_fail (format != NULL, NULL);

lt_va_copy(ap, args);
va_copy(ap, args);

size = vsnprintf(&c, 1, format, ap) + 1;

Expand Down
8 changes: 0 additions & 8 deletions liblangtag/lt-utils.h
Expand Up @@ -24,14 +24,6 @@

LT_BEGIN_DECLS

#if HAVE_VA_COPY
#define lt_va_copy(_d_,_s_) va_copy(_d_,_s_)
#elsif HAVE___VA_COPY
#define lt_va_copy(_d_,_s_) __va_copy(_d_,_s_)
#else
#define lt_va_copy(_d_,_s_) memcpy(&(_d_), &(_s_), sizeof (va_list))
#endif

int lt_strcmp0 (const char *v1,
const char *v2);
int lt_strcasecmp (const char *s1,
Expand Down

0 comments on commit 38ee513

Please sign in to comment.