diff options
author | Mike Waychison <mikew@google.com> | 2011-07-21 16:57:58 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2011-07-22 16:15:31 -0700 |
commit | 828aa1f00ec3508a4d813bd60d210de82929ac97 (patch) | |
tree | 2772ba015552aa2eb12f7d137d55ea0c26421f9c /drivers | |
parent | a2940908391f3cee72e38769b30e829b22742b5b (diff) | |
download | linux-3.10-828aa1f00ec3508a4d813bd60d210de82929ac97.tar.gz linux-3.10-828aa1f00ec3508a4d813bd60d210de82929ac97.tar.bz2 linux-3.10-828aa1f00ec3508a4d813bd60d210de82929ac97.zip |
efivars: introduce utf16_strncmp
Introduce utf16_strncmp which is used in the next patch. Semantics
should be the same as the strncmp C function.
Signed-off-by: Mike Waychison <mikew@google.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firmware/efivars.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 4202a317046..15b9a01b6c6 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -169,6 +169,24 @@ utf16_strsize(efi_char16_t *data, unsigned long maxlength) return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t); } +static inline int +utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) +{ + while (1) { + if (len == 0) + return 0; + if (*a < *b) + return -1; + if (*a > *b) + return 1; + if (*a == 0) /* implies *b == 0 */ + return 0; + a++; + b++; + len--; + } +} + static efi_status_t get_var_data_locked(struct efivars *efivars, struct efi_variable *var) { |