mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-01 06:42:22 +00:00
virBitmapFormat: Clarify returned values
NULL can't be returned; don't mention it in the docs. Avoid extra cofusing variable when returning copy of empty string. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3c6d78aff7
commit
13c54c8945
@ -327,8 +327,8 @@ virBitmapToString(virBitmap *bitmap)
|
|||||||
*
|
*
|
||||||
* If bitmap is NULL or it has no bits set, an empty string is returned.
|
* If bitmap is NULL or it has no bits set, an empty string is returned.
|
||||||
*
|
*
|
||||||
* Returns the string on success or NULL otherwise. Caller should call
|
* Returns the formatted string. Caller is responsible for freeing the returned
|
||||||
* VIR_FREE to free the string.
|
* string.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
virBitmapFormat(virBitmap *bitmap)
|
virBitmapFormat(virBitmap *bitmap)
|
||||||
@ -337,11 +337,8 @@ virBitmapFormat(virBitmap *bitmap)
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
int start, cur, prev;
|
int start, cur, prev;
|
||||||
|
|
||||||
if (!bitmap || (cur = virBitmapNextSetBit(bitmap, -1)) < 0) {
|
if (!bitmap || (cur = virBitmapNextSetBit(bitmap, -1)) < 0)
|
||||||
char *ret;
|
return g_strdup("");
|
||||||
ret = g_strdup("");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
start = prev = cur;
|
start = prev = cur;
|
||||||
while (prev >= 0) {
|
while (prev >= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user