ACK: [PATCH 1/2] lib: fwts_guid: add a compare function
ivanhu
ivan.hu at canonical.com
Wed Aug 31 08:22:46 UTC 2016
On 2016年08月29日 17:06, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
> src/lib/include/fwts_guid.h | 3 ++-
> src/lib/src/fwts_guid.c | 15 +++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_guid.h b/src/lib/include/fwts_guid.h
> index 5d88984..21e6987 100644
> --- a/src/lib/include/fwts_guid.h
> +++ b/src/lib/include/fwts_guid.h
> @@ -18,12 +18,13 @@
> */
>
> #ifndef __FWTS_GUID_H__
> -#define __FWTS_GUID_H__
> +#define __FWTS_GUID_H__
>
> #include <stdlib.h>
> #include <stdint.h>
>
> void fwts_guid_buf_to_str(const uint8_t *guid, char *guid_str, const size_t guid_str_len);
> void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, const size_t guid_len);
> +bool fwts_guid_match(const uint8_t *guid, const uint8_t *guid2, const size_t guid_size);
>
> #endif
> diff --git a/src/lib/src/fwts_guid.c b/src/lib/src/fwts_guid.c
> index e3b05b4..7cd5281 100644
> --- a/src/lib/src/fwts_guid.c
> +++ b/src/lib/src/fwts_guid.c
> @@ -49,3 +49,18 @@ void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, const size_t guid
> &guid[8], &guid[9], &guid[10], &guid[11], &guid[12], &guid[13], &guid[14], &guid[15]);
> }
> }
> +/*
> + * fwts_guid_match()
> + * compare whether two GUIDs are the same
> + */
> +bool fwts_guid_match(const uint8_t *guid, const uint8_t *guid2, const size_t guid_size)
> +{
> + size_t i;
> +
> + for (i = 0; i < guid_size; i++) {
> + if (guid[i] != guid2[i])
> + return false;
> + }
> +
> + return true;
> +}
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list