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