This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Define fputs_unlocked to fputs if it is not available
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: elfutils-devel at sourceware dot org
- Date: Wed, 22 Feb 2017 15:05:54 +0100
- Subject: [PATCH] Define fputs_unlocked to fputs if it is not available
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=ulf dot hermann at qt dot io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=VQkQcfwmKLQYIu3J2Ch0kjeAou0/IyEyx/lusZurjKw=; b=Kz5Df0Fuxf8dPTTIX2q8ycQd05Qzq7UBxq/Es3MgdPc5GVC1q8mTrmmLT1o0fO7kdV2qrbRZEhm00DdaLJoLw00artcHgKiS8Jgxup11lsKOFiWVaXeYLO3V1lq7T+/8ykg4nGn98K/200MRZiWmqBrSiFHlGOuQX9hk9wT3lcI=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Using fputs_unlocked over fputs is a nice optimization, but ultimately
the result is the same. So, if we don't have fputs_unlocked we can just
use fputs instead.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
ChangeLog | 4 ++++
configure.ac | 4 ++++
lib/ChangeLog | 5 +++++
lib/system.h | 4 ++++
4 files changed, 17 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index d1e36f6..dd9b9ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2017-02-22 Ulf Hermann <ulf.hermann@qt.io>
+ * configure.ac: Add check for fputs_unlocked.
+
+2017-02-22 Ulf Hermann <ulf.hermann@qt.io>
+
* configure.ac: Add check GNU-style basename.
2017-02-22 Ulf Hermann <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index 889f88c..8119e07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -305,6 +305,10 @@ AC_CHECK_DECLS([basename],[],[],
#include <string.h>])
AM_CONDITIONAL(HAVE_BASENAME, [test "x$ac_cv_have_decl_basename" = "xyes"])
+AC_CHECK_DECLS([fputs_unlocked],[],[],
+ [#define _GNU_SOURCE
+ #include <stdio.h>])
+
AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
diff --git a/lib/ChangeLog b/lib/ChangeLog
index a8d9b91..d9aabfa 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,10 @@
2017-02-22 Ulf Hermann <ulf.hermann@qt.io>
+ * system.h: Define fputs_unlocked to fputs if
+ !HAVE_DECL_FPUTS_UNLOCKED.
+
+2017-02-22 Ulf Hermann <ulf.hermann@qt.io>
+
* Makefile.am (libeu_a_SOURCES): Add basname.c if no GNU-style
basename is available.
* basename.c: New file.
diff --git a/lib/system.h b/lib/system.h
index 7539e11..dc78997 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -84,6 +84,10 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
char *basename (const char *path);
#endif
+#if !HAVE_DECL_FPUTS_UNLOCKED
+#define fputs_unlocked(str, stream) fputs (str, stream)
+#endif
+
/* A special gettext function we use if the strings are too short. */
#define sgettext(Str) \
({ const char *__res = strrchr (gettext (Str), '|'); \
--
2.1.4