提交 ac5f3f29 编写于 作者: M Michal Privoznik

qemuDomainCleanupRemove: s/memmove/VIR_DELETE_ELEMENT_INPLACE/

The last argument of memmove is the amount of bytes to be moved. The
amount is in Bytes. We are moving some void pointers around. However,
since sizeof(void *) is not Byte on any architecture, we've got the
arithmetic wrong.
上级 aa0f0992
......@@ -2235,12 +2235,9 @@ qemuDomainCleanupRemove(virDomainObjPtr vm,
VIR_DEBUG("vm=%s, cb=%p", vm->def->name, cb);
for (i = 0; i < priv->ncleanupCallbacks; i++) {
if (priv->cleanupCallbacks[i] == cb) {
memmove(priv->cleanupCallbacks + i,
priv->cleanupCallbacks + i + 1,
priv->ncleanupCallbacks - i - 1);
priv->ncleanupCallbacks--;
}
if (priv->cleanupCallbacks[i] == cb)
VIR_DELETE_ELEMENT_INPLACE(priv->cleanupCallbacks,
i, priv->ncleanupCallbacks);
}
VIR_SHRINK_N(priv->cleanupCallbacks,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册