1178476Sjb/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc. 2178476Sjb * All rights reserved. 3178476Sjb * 4178476Sjb * Redistribution and use in source and binary forms, with or without 5178476Sjb * modification, are permitted provided that the following conditions are met: 6178476Sjb * * Redistributions of source code must retain the above copyright 7178476Sjb * notice, this list of conditions and the following disclaimer. 8178476Sjb * * Redistributions in binary form must reproduce the above copyright 9178476Sjb * notice, this list of conditions and the following disclaimer in the 10178476Sjb * documentation and/or other materials provided with the distribution. 11178476Sjb * * Neither the name of Freescale Semiconductor nor the 12178476Sjb * names of its contributors may be used to endorse or promote products 13178476Sjb * derived from this software without specific prior written permission. 14178476Sjb * 15178476Sjb * 16178476Sjb * ALTERNATIVELY, this software may be distributed under the terms of the 17178476Sjb * GNU General Public License ("GPL") as published by the Free Software 18178476Sjb * Foundation, either version 2 of that License or (at your option) any 19178476Sjb * later version. 20178476Sjb * 21178476Sjb * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 22178476Sjb * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23178476Sjb * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24178476Sjb * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 25178476Sjb * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26178476Sjb * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27178476Sjb * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28178476Sjb * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29178476Sjb * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30178476Sjb * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31178476Sjb */ 32178476Sjb 33178476Sjb/**************************************************************************//** 34178476Sjb 35178476Sjb @File list.c 36178476Sjb 37178476Sjb @Description Implementation of list. 38178476Sjb*//***************************************************************************/ 39178476Sjb#include "std_ext.h" 40178476Sjb#include "list_ext.h" 41178476Sjb 42178476Sjb 43178476Sjbvoid NCSW_LIST_Append(t_List *p_NewList, t_List *p_Head) 44178476Sjb{ 45178476Sjb t_List *p_First = NCSW_LIST_FIRST(p_NewList); 46 47 if (p_First != p_NewList) 48 { 49 t_List *p_Last = NCSW_LIST_LAST(p_NewList); 50 t_List *p_Cur = NCSW_LIST_NEXT(p_Head); 51 52 NCSW_LIST_PREV(p_First) = p_Head; 53 NCSW_LIST_FIRST(p_Head) = p_First; 54 NCSW_LIST_NEXT(p_Last) = p_Cur; 55 NCSW_LIST_LAST(p_Cur) = p_Last; 56 } 57} 58 59 60int NCSW_LIST_NumOfObjs(t_List *p_List) 61{ 62 t_List *p_Tmp; 63 int numOfObjs = 0; 64 65 if (!NCSW_LIST_IsEmpty(p_List)) 66 NCSW_LIST_FOR_EACH(p_Tmp, p_List) 67 numOfObjs++; 68 69 return numOfObjs; 70} 71