From: Hallvard Furuseth Date: Fri, 1 May 2009 03:10:25 +0000 (+0000) Subject: ITS#6080 again: simplify ber_strnlen, don't use strnlen, revert _GNU_SOURCE X-Git-Tag: ACLCHECK_0~584 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4b01f4b23a5577e63c87e3fc3dbf234448529a87;p=openldap ITS#6080 again: simplify ber_strnlen, don't use strnlen, revert _GNU_SOURCE --- 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 *