diff --git a/Array.h b/Array.h index 85e09a4..d693ef3 100644 --- a/Array.h +++ b/Array.h @@ -96,24 +96,16 @@ void Array_delete_pos(struct Array *a, int pos, void (*rel_)(void *)){ } a->size--; } -/*删除node所指向的Array节点*/ +/*删除node所指向的Array节点的下一个*/ void Array_delete_p(struct Array *a, struct Array_ *node, void (*rel_)(void *)){ assert("Array_delete_p" && node != a->back); struct Array_ *freeNode; - if(node == a->front){ - freeNode = a->front; - a->front = a->front->next; - rel_(freeNode->p); - free(freeNode); - }else{ - freeNode = node->next; - node->next = node->next->next; - rel_(freeNode->p); - free(freeNode); - } + freeNode = node->next; + node->next = node->next->next; + rel_(freeNode->p); + free(freeNode); a->size--; -} -/*交换内容,即p指针*/ +}p指针*/ void Array__swap(struct Array_ *a, struct Array_ *b){ void *t = b->p; b->p = a->p;