📄 list_move.c
字号:
/* * List_Move.c -- * * Source code for the List_Move library procedure. * * Copyright 1988 Regents of the University of California * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. */#ifndef lintstatic char rcsid[] = "$Header: /hive/cvsroot/simulation/apps/unix/ethersim/common/List_Move.c,v 1.1 1996/08/27 18:49:41 verghese Exp $ SPRITE (Berkeley)";#endif not lint#include <stdio.h>#include "list.h"/* * ---------------------------------------------------------------------------- * * List_Move -- * * Move the list element referenced by itemPtr to follow destPtr. * * Results: * None. * * Side effects: * List ordering is modified. * * ---------------------------------------------------------------------------- */voidList_Move( register List_Links *itemPtr, /* list element to be moved */ register List_Links *destPtr /* element after which it is to be placed */){ if (itemPtr == (List_Links *) NIL || destPtr == (List_Links *) NIL || !itemPtr || !destPtr) { panic("List_Move: One of the list items is NIL.\n"); } /* * It is conceivable that someone will try to move a list element to * be after itself. */ if (itemPtr != destPtr) { /* * Remove the item. */ itemPtr->prevPtr->nextPtr = itemPtr->nextPtr; itemPtr->nextPtr->prevPtr = itemPtr->prevPtr; /* * Insert the item at its new place. */ itemPtr->nextPtr = destPtr->nextPtr; itemPtr->prevPtr = destPtr; destPtr->nextPtr->prevPtr = itemPtr; destPtr->nextPtr = itemPtr; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -