xref: /titanic_50/usr/src/lib/libldap5/sources/ldap/common/reslist.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 #pragma ident	"%Z%%M%	%I%	%E% SMI"
2 
3 /*
4  * The contents of this file are subject to the Netscape Public
5  * License Version 1.1 (the "License"); you may not use this file
6  * except in compliance with the License. You may obtain a copy of
7  * the License at http://www.mozilla.org/NPL/
8  *
9  * Software distributed under the License is distributed on an "AS
10  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * rights and limitations under the License.
13  *
14  * The Original Code is Mozilla Communicator client code, released
15  * March 31, 1998.
16  *
17  * The Initial Developer of the Original Code is Netscape
18  * Communications Corporation. Portions created by Netscape are
19  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
20  * Rights Reserved.
21  *
22  * Contributor(s):
23  */
24 /*
25  *  Copyright (c) 1990 Regents of the University of Michigan.
26  *  All rights reserved.
27  */
28 /*
29  *  reslist.c
30  */
31 
32 #if 0
33 #ifndef lint
34 static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
35 #endif
36 #endif
37 
38 #include "ldap-int.h"
39 
40 LDAPMessage *
ldap_delete_result_entry(LDAPMessage ** list,LDAPMessage * e)41 ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
42 {
43 	LDAPMessage	*tmp, *prev = NULL;
44 
45 	for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
46 		prev = tmp;
47 
48 	if ( tmp == NULL )
49 		return( NULL );
50 
51 	if ( prev == NULL )
52 		*list = tmp->lm_chain;
53 	else
54 		prev->lm_chain = tmp->lm_chain;
55 	tmp->lm_chain = NULL;
56 
57 	return( tmp );
58 }
59 
60 void
ldap_add_result_entry(LDAPMessage ** list,LDAPMessage * e)61 ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
62 {
63 	e->lm_chain = *list;
64 	*list = e;
65 }
66