From 1380db9f7a3feab144452f990b79728c9f2e3dbf Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Sat, 20 Jun 2009 18:22:15 +0100 Subject: [PATCH] Define _GNU_SOURCE not __USE_GNU to get strnlen(3). __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. --- 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 -/* strnlen */ -#define __USE_GNU #include #include 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 #include -#define __USE_GNU #include -#undef __USE_GNU #include #define IDLE_DEBUG_FLAG IDLE_DEBUG_PARSER -- 1.6.3.1