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