Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: ASI CEOS Translator 5 : * Purpose: Link list function replacements. 6 : * Author: Frank Warmerdam, warmerda@home.com 7 : * 8 : ****************************************************************************** 9 : * Copyright (c) 2000, Atlantis Scientific Inc 10 : * 11 : * Permission is hereby granted, free of charge, to any person obtaining a 12 : * copy of this software and associated documentation files (the "Software"), 13 : * to deal in the Software without restriction, including without limitation 14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15 : * and/or sell copies of the Software, and to permit persons to whom the 16 : * Software is furnished to do so, subject to the following conditions: 17 : * 18 : * The above copyright notice and this permission notice shall be included 19 : * in all copies or substantial portions of the Software. 20 : * 21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 : * DEALINGS IN THE SOFTWARE. 28 : ****************************************************************************/ 29 : 30 : #include "ceos.h" 31 : 32 : /************************************************************************/ 33 : /* ceos2CreateLink() */ 34 : /************************************************************************/ 35 : 36 46 : Link_t *ceos2CreateLink(void *pObject) 37 : 38 : { 39 46 : Link_t *psLink = (Link_t *)CPLCalloc(sizeof(Link_t), 1); 40 : 41 46 : psLink->object = pObject; 42 : 43 46 : return psLink; 44 : } 45 : 46 : /************************************************************************/ 47 : /* DestroyList() */ 48 : /************************************************************************/ 49 : 50 8 : void DestroyList(Link_t *psList) 51 : 52 : { 53 54 : while (psList != NULL) 54 : { 55 46 : Link_t *psNext = psList->next; 56 : 57 46 : CPLFree(psList); 58 46 : psList = psNext; 59 : } 60 8 : } 61 : 62 : /************************************************************************/ 63 : /* InsertLink() */ 64 : /************************************************************************/ 65 : 66 40 : Link_t *InsertLink(Link_t *psList, Link_t *psLink) 67 : 68 : { 69 40 : psLink->next = psList; 70 : 71 40 : return psLink; 72 : } 73 : 74 : /************************************************************************/ 75 : /* AddLink() */ 76 : /************************************************************************/ 77 : 78 0 : Link_t *AddLink(Link_t *psList, Link_t *psLink) 79 : 80 : { 81 : Link_t *psNode; 82 : 83 0 : if (psList == NULL) 84 0 : return psLink; 85 : 86 0 : for (psNode = psList; psNode->next != NULL; psNode = psNode->next) 87 : { 88 : } 89 : 90 0 : psNode->next = psLink; 91 : 92 0 : return psList; 93 : }