X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fdisptmpl.c;h=32c253d32dc0699290e10ba5c9e709f37cc84775;hb=ac8b5468aadcb26e9729c0c90e682e904774c7d3;hp=104d5e51adbf4b15f0cfb4cdbc7fbf1083a14800;hpb=1bcec8bf6a17a65396b2c947faed846d20428db9;p=openldap diff --git a/libraries/libldap/disptmpl.c b/libraries/libldap/disptmpl.c index 104d5e51ad..32c253d32d 100644 --- a/libraries/libldap/disptmpl.c +++ b/libraries/libldap/disptmpl.c @@ -20,7 +20,8 @@ #include "portable.h" #include -#include + +#include #include #include @@ -35,7 +36,7 @@ #include "disptmpl.h" static void free_disptmpl LDAP_P(( struct ldap_disptmpl *tmpl )); -static int read_next_tmpl LDAP_P(( char **bufp, long *blenp, +static int read_next_tmpl LDAP_P(( char **bufp, ber_len_t *blenp, struct ldap_disptmpl **tmplp, int dtversion )); static const char *const tmploptions[] = { @@ -98,7 +99,7 @@ ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ) long rlen, len; int rc, eof; - *tmpllistp = NULLDISPTMPL; + *tmpllistp = NULL; if (( fp = fopen( file, "r" )) == NULL ) { return( LDAP_TMPL_ERR_FILE ); @@ -138,14 +139,14 @@ ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp ) int -ldap_init_templates_buf( char *buf, long buflen, +ldap_init_templates_buf( char *buf, ber_len_t buflen, struct ldap_disptmpl **tmpllistp ) { int rc=-1, version; char **toks; struct ldap_disptmpl *prevtmpl, *tmpl; - *tmpllistp = prevtmpl = NULLDISPTMPL; + *tmpllistp = prevtmpl = NULL; if ( next_line_tokens( &buf, &buflen, &toks ) != 2 || strcasecmp( toks[ 0 ], "version" ) != 0 ) { @@ -159,8 +160,8 @@ ldap_init_templates_buf( char *buf, long buflen, } while ( buflen > 0 && ( rc = read_next_tmpl( &buf, &buflen, &tmpl, - version )) == 0 && tmpl != NULLDISPTMPL ) { - if ( prevtmpl == NULLDISPTMPL ) { + version )) == 0 && tmpl != NULL ) { + if ( prevtmpl == NULL ) { *tmpllistp = tmpl; } else { prevtmpl->dt_next = tmpl; @@ -281,7 +282,7 @@ struct ldap_disptmpl * ldap_next_disptmpl( struct ldap_disptmpl *tmpllist, struct ldap_disptmpl *tmpl ) { - return( tmpl == NULLDISPTMPL ? tmpl : tmpl->dt_next ); + return( tmpl == NULL ? tmpl : tmpl->dt_next ); } @@ -290,14 +291,14 @@ ldap_name2template( char *name, struct ldap_disptmpl *tmpllist ) { struct ldap_disptmpl *dtp; - for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL; + for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULL; dtp = ldap_next_disptmpl( tmpllist, dtp )) { if ( strcasecmp( name, dtp->dt_name ) == 0 ) { return( dtp ); } } - return( NULLDISPTMPL ); + return( NULL ); } @@ -309,12 +310,12 @@ ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist ) int i, j, needcnt, matchcnt; if ( tmpllist == NULL || oclist == NULL || oclist[ 0 ] == NULL ) { - return( NULLDISPTMPL ); + return( NULL ); } - for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULLDISPTMPL; + for ( dtp = ldap_first_disptmpl( tmpllist ); dtp != NULL; dtp = ldap_next_disptmpl( tmpllist, dtp )) { - for ( oclp = dtp->dt_oclist; oclp != NULLOCLIST; + for ( oclp = dtp->dt_oclist; oclp != NULL; oclp = oclp->oc_next ) { needcnt = matchcnt = 0; for ( i = 0; oclp->oc_objclasses[ i ] != NULL; ++i ) { @@ -333,7 +334,7 @@ ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist ) } } - return( NULLDISPTMPL ); + return( NULL ); } @@ -347,7 +348,7 @@ ldap_first_tmplrow( struct ldap_disptmpl *tmpl ) struct ldap_tmplitem * ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row ) { - return( row == NULLTMPLITEM ? row : row->ti_next_in_col ); + return( row == NULL ? row : row->ti_next_in_col ); } @@ -362,7 +363,7 @@ struct ldap_tmplitem * ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row, struct ldap_tmplitem *col ) { - return( col == NULLTMPLITEM ? col : col->ti_next_in_row ); + return( col == NULL ? col : col->ti_next_in_row ); } @@ -388,7 +389,7 @@ ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, for ( i = 0; !memerr && includeattrs[ i ] != NULL; ++i ) { if (( attrs = (char **)LDAP_REALLOC( attrs, ( attrcnt + 2 ) * sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] = - strdup( includeattrs[ i ] )) == NULL ) { + LDAP_STRDUP( includeattrs[ i ] )) == NULL ) { memerr = 1; } else { attrs[ attrcnt ] = NULL; @@ -397,10 +398,10 @@ ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, } for ( tirowp = ldap_first_tmplrow( tmpl ); - !memerr && tirowp != NULLTMPLITEM; + !memerr && tirowp != NULL; tirowp = ldap_next_tmplrow( tmpl, tirowp )) { for ( ticolp = ldap_first_tmplcol( tmpl, tirowp ); - ticolp != NULLTMPLITEM; + ticolp != NULL; ticolp = ldap_next_tmplcol( tmpl, tirowp, ticolp )) { if ( syntaxmask != 0 ) { @@ -415,7 +416,7 @@ ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, if ( ticolp->ti_attrname != NULL ) { if (( attrs = (char **)LDAP_REALLOC( attrs, ( attrcnt + 2 ) * sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] = - strdup( ticolp->ti_attrname )) == NULL ) { + LDAP_STRDUP( ticolp->ti_attrname )) == NULL ) { memerr = 1; } else { attrs[ attrcnt ] = NULL; @@ -440,7 +441,7 @@ ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, static int -read_next_tmpl( char **bufp, long *blenp, struct ldap_disptmpl **tmplp, +read_next_tmpl( char **bufp, ber_len_t *blenp, struct ldap_disptmpl **tmplp, int dtversion ) { int i, j, tokcnt, samerow, adsource;