efi_loader: remove duplicate function mem2hex()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 18 Jan 2019 17:54:26 +0000 (18:54 +0100)
committerAlexander Graf <agraf@suse.de>
Wed, 13 Feb 2019 08:40:06 +0000 (09:40 +0100)
Replace duplicate function mem2hex() by inline function bin2hex().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_variable.c

index eea7f68b857a3cf982f1b9f42c9fcaaf7807bac1..2ac27731fe57fe440246cdd8da10c6c28ac8e32f 100644 (file)
 
 #define PREFIX_LEN (strlen("efi_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_"))
 
-static char *mem2hex(char *hexstr, const u8 *mem, int count)
-{
-       static const char hexchars[] = "0123456789abcdef";
-
-       while (count-- > 0) {
-               u8 ch = *mem++;
-               *hexstr++ = hexchars[ch >> 4];
-               *hexstr++ = hexchars[ch & 0xf];
-       }
-
-       return hexstr;
-}
-
 static efi_status_t efi_to_native(char **native, const u16 *variable_name,
                                  const efi_guid_t *vendor)
 {
@@ -282,7 +269,7 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 
        /* store payload: */
        s += sprintf(s, "(blob)");
-       s = mem2hex(s, data, data_size);
+       s = bin2hex(s, data, data_size);
        *s = '\0';
 
        debug("%s: setting: %s=%s\n", __func__, native_name, val);