ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/pxys2-2.0.0/pxyservd/dbprim/le_init.c
Revision: 3252
Committed: Wed Apr 2 20:41:43 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 1839 byte(s)
Log Message:
- Imported pxys2-2.0.0

File Contents

# Content
1 /*
2 ** Copyright (C) 2002 by Kevin L. Mitchell <klmitch@mit.edu>
3 **
4 ** This library is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU Library General Public
6 ** License as published by the Free Software Foundation; either
7 ** version 2 of the License, or (at your option) any later version.
8 **
9 ** This library is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ** Library General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Library General Public
15 ** License along with this library; if not, write to the Free
16 ** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17 ** MA 02111-1307, USA
18 **
19 ** @(#)$Id: le_init.c,v 1.2 2003/06/12 01:10:04 klmitch Exp $
20 */
21 #include "dbprim.h"
22 #include "dbprim_int.h"
23
24 RCSTAG("@(#)$Id: le_init.c,v 1.2 2003/06/12 01:10:04 klmitch Exp $");
25
26 /** \ingroup dbprim_link
27 * \brief Dynamically initialize a linked list element.
28 *
29 * This function dynamically initializes a linked list element.
30 *
31 * \param elem A pointer to a #link_elem_t to be initialized.
32 * \param object
33 * A pointer to \c void used to represent the object
34 * associated with the element. May not be \c NULL.
35 *
36 * \retval DB_ERR_BADARGS A \c NULL pointer was passed for \p
37 * elem or \p object.
38 */
39 unsigned long
40 le_init(link_elem_t *elem, void *object)
41 {
42 initialize_dbpr_error_table(); /* initialize error table */
43
44 if (!elem || !object) /* verify arguments */
45 return DB_ERR_BADARGS;
46
47 elem->le_next = 0; /* initialize the element */
48 elem->le_prev = 0;
49 elem->le_object = object;
50 elem->le_head = 0;
51 elem->le_flags = 0;
52
53 elem->le_magic = LINK_ELEM_MAGIC; /* set the magic number */
54
55 return 0;
56 }