Skip to content

Commit

Permalink
Promote efi_guid_cmp() and friends to not be inlined.
Browse files Browse the repository at this point in the history
Some compilers seem to get confused with the current efi_guid_cmp()
invocation, so just make it real API.

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Jun 30, 2016
1 parent 199fbf8 commit 4af5b56
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
22 changes: 22 additions & 0 deletions src/guid.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@

#define GUID_LENGTH_WITH_NUL 37

int
__attribute__((__nonnull__ (1, 2)))
__attribute__((__visibility__ ("default")))
efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
{
return memcmp(a, b, sizeof (efi_guid_t));
}

int
__attribute__((__nonnull__ (1)))
__attribute__((__visibility__ ("default")))
efi_guid_is_zero(const efi_guid_t *guid)
{
return !efi_guid_cmp(guid,&efi_guid_zero);
}

int
efi_guid_is_empty(const efi_guid_t *guid)
__attribute__((__nonnull__ (1)))
__attribute__((__visibility__ ("default")))
__attribute__ ((weak, alias ("efi_guid_is_zero")));

int
__attribute__((__nonnull__ (1, 2)))
__attribute__((__visibility__ ("default")))
Expand Down
24 changes: 3 additions & 21 deletions src/include/efivar/efivar.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,11 @@ extern int efi_id_guid_to_guid(const char *name, efi_guid_t *guid)
extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
__attribute__((__nonnull__ (1, 2)));

static inline int
__attribute__ ((unused))
__attribute__((__nonnull__ (1, 2)))
efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
{
return memcmp(a, b, sizeof (efi_guid_t));
}

extern const efi_guid_t efi_guid_zero;

inline int
__attribute__ ((unused))
__attribute__((__nonnull__ (1)))
efi_guid_is_zero(const efi_guid_t *guid)
{
return !efi_guid_cmp(guid,&efi_guid_zero);
}
extern int
efi_guid_is_empty(const efi_guid_t *guid)
__attribute__ ((unused))
__attribute__((__nonnull__ (1)))
__attribute__((__visibility__ ("default")))
__attribute__ ((weak, alias ("efi_guid_is_zero")));
extern int efi_guid_is_zero(const efi_guid_t *guid);
extern int efi_guid_is_empty(const efi_guid_t *guid);
extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);

/* import / export functions */
typedef struct efi_variable efi_variable_t;
Expand Down
1 change: 1 addition & 0 deletions src/libefivar.map
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ LIBEFIVAR_0.0 {

LIBEFIVAR_0.24 {
global: efi_set_variable;
efi_guid_cmp;
} LIBEFIVAR_0.0;

0 comments on commit 4af5b56

Please sign in to comment.