]> git.sur5r.net Git - openldap/blob - servers/slapd/mods.c
Changed search attrs to struct berval **.
[openldap] / servers / slapd / mods.c
1 /*
2  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5 /*
6  * Copyright (c) 1995 Regents of the University of Michigan.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms are permitted
10  * provided that this notice is preserved and that due credit is given
11  * to the University of Michigan at Ann Arbor. The name of the University
12  * may not be used to endorse or promote products derived from this
13  * software without specific prior written permission. This software
14  * is provided ``as is'' without express or implied warranty.
15  */
16
17 #include "portable.h"
18
19 #include "slap.h"
20
21 void
22 slap_mod_free(
23         Modification    *mod,
24         int                             freeit
25 )
26 {
27         if ( mod->sm_bvalues != NULL )
28                 ber_bvecfree( mod->sm_bvalues );
29
30         if( freeit )
31                 free( mod );
32 }
33
34 void
35 slap_mods_free(
36     Modifications       *ml
37 )
38 {
39         Modifications *next;
40
41         for ( ; ml != NULL; ml = next ) {
42                 next = ml->sml_next;
43
44                 slap_mod_free( &ml->sml_mod, 0 );
45                 free( ml );
46         }
47 }
48
49 void
50 slap_modlist_free(
51     LDAPModList *ml
52 )
53 {
54         LDAPModList *next;
55
56         for ( ; ml != NULL; ml = next ) {
57                 next = ml->ml_next;
58
59                 if (ml->ml_type)
60                         free( ml->ml_type );
61
62                 if ( ml->ml_bvalues != NULL )
63                         ber_bvecfree( ml->ml_bvalues );
64
65                 free( ml );
66         }
67 }