On 09.05.2016 17:52, Alberto Garcia wrote:
> On Wed 13 Apr 2016 10:33:08 AM CEST, Changlong Xie wrote:

[...]

>> +    /* We can safely remove this child now */
>> +    memmove(&s->children[i], &s->children[i + 1],
>> +            (s->num_children - i - 1) * sizeof(BdrvChild *));
>> +    s->children = g_renew(BdrvChild *, s->children, --s->num_children);
>> +    bdrv_unref_child(bs, child);
> 
> Question: do we want to decrement last_index if 'i' is the last
> children? Something like:

I think it's better to keep it consistent. It probably wouldn't hurt to
do this, but I don't see any real benefit and on the other hand it looks
a bit strange (to the user) to special-case replacement of the last child.

Max

> if (i == s->num_children - 1) {
>    s->last_index--;
> } else {
>    memmove(...)
> }
> s->children = g_renew(...)
> 
> Berto
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to