static void LCUIDisplay_CleanSurfaces( void ) { SurfaceRecord *sr; LinkedListNode *node; for( LinkedList_Each( node, &display.surfaces ) ) { sr = node->data; Surface_Delete( sr->surface ); LinkedList_DeleteNode( &display.surfaces, node ); } }
/** 解除 widget 与 sruface 的绑定 */ static void LCUIDisplay_UnbindSurface( LCUI_Widget widget ) { SurfaceRecord *sr; LinkedListNode *node; for( LinkedList_Each( node, &display.surfaces ) ) { sr = node->data; if( sr && sr->widget == widget ) { Surface_Delete( sr->surface ); LinkedList_DeleteNode( &display.surfaces, node ); break; } } }
void LinkedListSuite_TestDelete( LinkedListSuiteData* data ) { Index ii = 0; LinkedListNode* currNode=NULL; for(ii=0; ii<NUM_DATA; ii++){ LinkedList_InsertNode(data->numList, data->array[ii], sizeof(int)); } /* \nDeleting half the nodes previously inserted into the list\n */ for(ii=0; ii<NUM_DATA/2; ii++){ LinkedList_DeleteNode(data->numList, data->array[ii]); } pcu_check_true( data->numList->nodeCount == NUM_DATA/2 ); currNode = data->numList->head; /* Since they end up in reverse order, the deleted notes should be the 2nd half of the list, so the first half * should have remained unchanged */ for(ii=0; ii<NUM_DATA/2; ii++){ pcu_check_true( *((int*)currNode->data) == (NUM_DATA-1 - *data->array[ii]) ); currNode = currNode->next; } }
void LinkedList_Delete( LinkedList *list, size_t pos ) { LinkedListNode *node = LinkedList_GetNode( list, pos ); LinkedList_DeleteNode( list, node ); }