mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 10:39:34 -05:00
ITS#6080 again: simplify ber_strnlen, don't use strnlen, revert _GNU_SOURCE
This commit is contained in:
parent
4e3f04edc3
commit
4b01f4b23a
1 changed files with 2 additions and 14 deletions
|
|
@ -13,10 +13,6 @@
|
|||
* <http://www.OpenLDAP.org/license.html>.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1 /* Needed for <string.h> if HAVE_STRNLEN */
|
||||
#endif
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <ac/stdlib.h>
|
||||
|
|
@ -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 *
|
||||
|
|
|
|||
Loading…
Reference in a new issue