From 4b01f4b23a5577e63c87e3fc3dbf234448529a87 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 1 May 2009 03:10:25 +0000 Subject: [PATCH] ITS#6080 again: simplify ber_strnlen, don't use strnlen, revert _GNU_SOURCE --- libraries/liblber/memory.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/libraries/liblber/memory.c b/libraries/liblber/memory.c index 74261240c3..284cd04b8e 100644 --- a/libraries/liblber/memory.c +++ b/libraries/liblber/memory.c @@ -13,10 +13,6 @@ * . */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 /* Needed for if HAVE_STRNLEN */ -#endif - #include "portable.h" #include @@ -658,19 +654,11 @@ ber_strdup( LDAP_CONST char *s ) ber_len_t ber_strnlen( LDAP_CONST char *s, ber_len_t len ) { -#ifdef HAVE_STRNLEN - return (ber_len_t)strnlen( s, (ber_len_t)len ); -#else ber_len_t l; - for ( l = 0; l < len; l++ ) { - if ( s[l] == '\0' ) { - return l; - } - } + for ( l = 0; l < len && s[l] != '\0'; l++ ) ; - return len; -#endif /* HAVE_STRNLEN */ + return l; } char * -- 2.39.5