virBitmapCopy has a failure condition, which is impossible to meet when
creating a new copy. Copy the contents directly to make it obvious that
virBitmapNewCopy can't fail.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
* virBitmapNewCopy:
* @src: the source bitmap.
*
- * Makes a copy of bitmap @src.
- *
- * returns the copied bitmap on success, or NULL otherwise. Caller
- * should call virBitmapFree to free the returned bitmap.
+ * Returns a copy of bitmap @src.
*/
virBitmapPtr
virBitmapNewCopy(virBitmapPtr src)
{
virBitmapPtr dst = virBitmapNew(src->nbits);
- if (virBitmapCopy(dst, src) != 0) {
- virBitmapFree(dst);
- return NULL;
- }
+ memcpy(dst->map, src->map, src->map_len * sizeof(src->map[0]));
return dst;
}