From: Pierangelo Masarati Date: Sat, 7 Jul 2001 09:13:05 +0000 (+0000) Subject: moved some slap_mods_* functions into mods.c, so mods.o can be included X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1249 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a4dc886f02babad24ab65f989e0155969468a180;p=openldap moved some slap_mods_* functions into mods.c, so mods.o can be included by slapd/tools/*; slap_mods_free is needed by ldbm_back_modrdn after fixing ITS#1184 (at present -DMULTIATTRVAL_RDN is needed when compiling back-ldbm/modrdn.c to trigger the compilation of new code). --- diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index 10e3fb24d6..5415b9332e 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -17,8 +17,9 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \ repl.c lock.c controls.c extended.c kerberos.c passwd.c \ schema.c schema_check.c schema_init.c schema_prep.c \ schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \ - monitor.c configinfo.c starttls.c index.c sets.c\ - root_dse.c sasl.c module.c suffixalias.c mra.c $(@PLAT@_SRCS) + monitor.c configinfo.c starttls.c index.c sets.c \ + root_dse.c sasl.c module.c suffixalias.c mra.c mods.c \ + $(@PLAT@_SRCS) OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ attr.o entry.o config.o backend.o result.o operation.o \ @@ -28,8 +29,9 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ repl.o lock.o controls.o extended.o kerberos.o passwd.o \ schema.o schema_check.o schema_init.o schema_prep.o \ schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \ - monitor.o configinfo.o starttls.o index.o sets.o\ - root_dse.o sasl.o module.o suffixalias.o mra.o $(@PLAT@_OBJS) + monitor.o configinfo.o starttls.o index.o sets.o \ + root_dse.o sasl.o module.o suffixalias.o mra.o mods.o \ + $(@PLAT@_OBJS) LDAP_INCDIR= ../../include LDAP_LIBDIR= ../../libraries diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 0104b4c873..7d6626c0cb 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -565,53 +565,3 @@ int slap_mods_opattrs( return LDAP_SUCCESS; } - -void -slap_mod_free( - Modification *mod, - int freeit -) -{ - ad_free( mod->sm_desc, 1 ); - - if ( mod->sm_bvalues != NULL ) - ber_bvecfree( mod->sm_bvalues ); - - if( freeit ) - free( mod ); -} - -void -slap_mods_free( - Modifications *ml -) -{ - Modifications *next; - - for ( ; ml != NULL; ml = next ) { - next = ml->sml_next; - - slap_mod_free( &ml->sml_mod, 0 ); - free( ml ); - } -} - -void -slap_modlist_free( - LDAPModList *ml -) -{ - LDAPModList *next; - - for ( ; ml != NULL; ml = next ) { - next = ml->ml_next; - - if (ml->ml_type) - free( ml->ml_type ); - - if ( ml->ml_bvalues != NULL ) - ber_bvecfree( ml->ml_bvalues ); - - free( ml ); - } -} diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c new file mode 100644 index 0000000000..7b59cc5e1e --- /dev/null +++ b/servers/slapd/mods.c @@ -0,0 +1,69 @@ +/* + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ +/* + * Copyright (c) 1995 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#include "portable.h" + +#include "slap.h" + +void +slap_mod_free( + Modification *mod, + int freeit +) +{ + ad_free( mod->sm_desc, 1 ); + + if ( mod->sm_bvalues != NULL ) + ber_bvecfree( mod->sm_bvalues ); + + if( freeit ) + free( mod ); +} + +void +slap_mods_free( + Modifications *ml +) +{ + Modifications *next; + + for ( ; ml != NULL; ml = next ) { + next = ml->sml_next; + + slap_mod_free( &ml->sml_mod, 0 ); + free( ml ); + } +} + +void +slap_modlist_free( + LDAPModList *ml +) +{ + LDAPModList *next; + + for ( ; ml != NULL; ml = next ) { + next = ml->ml_next; + + if (ml->ml_type) + free( ml->ml_type ); + + if ( ml->ml_bvalues != NULL ) + ber_bvecfree( ml->ml_bvalues ); + + free( ml ); + } +} diff --git a/servers/slapd/tools/Makefile.in b/servers/slapd/tools/Makefile.in index 7cc2795446..a6752be57d 100644 --- a/servers/slapd/tools/Makefile.in +++ b/servers/slapd/tools/Makefile.in @@ -47,7 +47,7 @@ SLAPD_OBJS = ../config.o ../ch_malloc.o ../backend.o ../charray.o \ ../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \ ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \ ../controls.o ../kerberos.o ../passwd.o ../index.o \ - ../extended.o ../starttls.o ../sets.o ../mra.o + ../extended.o ../starttls.o ../sets.o ../mra.o ../mods.o SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o