1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
45 copyright notice and this permission notice appear in supporting
46 documentation.
47
48 The above copyright notice and this permission notice shall be included
49 in all copies or substantial portions of the Software.
50
51 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
55 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
56 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
57 OTHER DEALINGS IN THE SOFTWARE.
58
59 Except as contained in this notice, the name of The Open Group shall
60 not be used in advertising or otherwise to promote the sale, use or
61 other dealings in this Software without prior written authorization
62 from The Open Group.
63
64 ----------------------------------------------------------------------- **/
65
66 #include <stdio.h>
67 #include <stdlib.h>
68
69 #include "list.h"
70
71
72 /** ------------------------------------------------------------------------
73 Sets the pointers of the specified list to NULL.
74 --------------------------------------------------------------------- **/
75 void zero_list(list_ptr lp)
76 {
77 lp->next = NULL;
78 lp->ptr.item = NULL;
79 }
80
81
82 /** ------------------------------------------------------------------------
83 Adds item to the list pointed to by lp. Finds the end of the
84 list, then mallocs a new list node onto the end of the list.
|
1 /*
2 * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
45 copyright notice and this permission notice appear in supporting
46 documentation.
47
48 The above copyright notice and this permission notice shall be included
49 in all copies or substantial portions of the Software.
50
51 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
54 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
55 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
56 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
57 OTHER DEALINGS IN THE SOFTWARE.
58
59 Except as contained in this notice, the name of The Open Group shall
60 not be used in advertising or otherwise to promote the sale, use or
61 other dealings in this Software without prior written authorization
62 from The Open Group.
63
64 ----------------------------------------------------------------------- **/
65
66 #ifdef HEADLESS
67 #error This file should not be included in headless library
68 #endif
69
70 #include <stdio.h>
71 #include <stdlib.h>
72
73 #include "list.h"
74
75
76 /** ------------------------------------------------------------------------
77 Sets the pointers of the specified list to NULL.
78 --------------------------------------------------------------------- **/
79 void zero_list(list_ptr lp)
80 {
81 lp->next = NULL;
82 lp->ptr.item = NULL;
83 }
84
85
86 /** ------------------------------------------------------------------------
87 Adds item to the list pointed to by lp. Finds the end of the
88 list, then mallocs a new list node onto the end of the list.
|