[telepathy-idle/master] Define _GNU_SOURCE not __USE_GNU to get strnlen(3).
Will Thompson
will.thompson at collabora.co.uk
Tue Jul 7 07:25:11 PDT 2009
__USE_GNU is a glibc-internal macro that we should not be using; this
was causing a build failure in openSUSE, which has a glibc from the
future.
idle-connection.c doesn't actually use strnlen.
Based on a patch by Vincent Untz, which didn't compile for me: it seemed
like string.h was getting #included before the #define, and thus strnlen
wasn't exposed. Making the #define the first thing in idle-parser.c
fixed this.
Fixes: fd.o#22291
---
src/idle-connection.c | 2 --
src/idle-parser.c | 5 +++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/idle-connection.c b/src/idle-connection.c
index 7080ae3..10613b4 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -22,8 +22,6 @@
#include <config.h>
-/* strnlen */
-#define __USE_GNU
#include <string.h>
#include <time.h>
diff --git a/src/idle-parser.c b/src/idle-parser.c
index b5d561a..93c330d 100644
--- a/src/idle-parser.c
+++ b/src/idle-parser.c
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/* For strnlen(), which is a GNU extension. */
+#define _GNU_SOURCE
+
#include "idle-parser.h"
#include "idle-connection.h"
@@ -26,9 +29,7 @@
#include <glib.h>
#include <glib-object.h>
-#define __USE_GNU
#include <string.h>
-#undef __USE_GNU
#include <stdio.h>
#define IDLE_DEBUG_FLAG IDLE_DEBUG_PARSER
--
1.5.6.5
More information about the telepathy-commits
mailing list