[PATCH v2 01/27] viruuid: Rework virUUIDIsValid()
Peter Krempa
pkrempa at redhat.com
Fri Dec 4 06:38:25 UTC 2020
On Thu, Dec 03, 2020 at 13:36:04 +0100, Michal Privoznik wrote:
> The only test we do when checking for UUID validity is that
> whether all bytes are the same (invalid UUID) or not (valid
> UUID). The algorithm we use is needlessly complicated.
>
> Also, the checked UUID is not modified and hence the argument can
> be of 'const' type.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/util/viruuid.c | 17 +++++++----------
> src/util/viruuid.h | 2 +-
> 2 files changed, 8 insertions(+), 11 deletions(-)
I've briefly thought whether we could replace the internals by a memset
of a temp array and then memcmp, but that doesn't seem to be worth.
Reviewed-by: Peter Krempa <pkrempa at redhat.com>
More information about the libvir-list
mailing list