Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370621

[PATCH v2 1/8] lib/vsprintf: simplify UUID printing

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/8] lib/vsprintf: simplify UUID printing
Date 2016-04-04 15:40 +0200
Message-ID <rkcTx-3Fi-25@gated-at.bofh.it> (permalink)
References <rkcTw-3Fi-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Since we have hex_byte_pack_upper() we may use it directly and avoid second
loop.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/vsprintf.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index ccb664b..be0e7cf 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1324,7 +1324,10 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	}
 
 	for (i = 0; i < 16; i++) {
-		p = hex_byte_pack(p, addr[index[i]]);
+		if (uc)
+			p = hex_byte_pack_upper(p, addr[index[i]]);
+		else
+			p = hex_byte_pack(p, addr[index[i]]);
 		switch (i) {
 		case 3:
 		case 5:
@@ -1337,13 +1340,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 
 	*p = 0;
 
-	if (uc) {
-		p = uuid;
-		do {
-			*p = toupper(*p);
-		} while (*(++p));
-	}
-
 	return string(buf, end, uuid, spec);
 }
 
-- 
2.8.0.rc3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/8] uuid: convert users to generic UUID API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
  [PATCH v2 1/8] lib/vsprintf: simplify UUID printing Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
  [PATCH v2 2/8] lib/uuid: move generate_random_uuid() to uuid.c Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
  [PATCH v2 4/8] lib/uuid: remove FSF address Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
  [PATCH v2 8/8] efivars: use generic UUID library Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
  [PATCH v2 3/8] lib/uuid: introduce few more generic helpers for UUID Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-04 15:40 +0200
    Re: [PATCH v2 3/8] lib/uuid: introduce few more generic helpers for  UUID Andrew Morton <akpm@linux-foundation.org> - 2016-04-05 01:50 +0200
      Re: [PATCH v2 3/8] lib/uuid: introduce few more generic helpers for  UUID Joe Perches <joe@perches.com> - 2016-04-05 02:00 +0200
      Re: [PATCH v2 3/8] lib/uuid: introduce few more generic helpers for  UUID Stephen Rothwell <sfr@canb.auug.org.au> - 2016-04-05 02:50 +0200
      Re: [PATCH v2 3/8] lib/uuid: introduce few more generic helpers for  UUID Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 13:00 +0200
  Re: [PATCH v2 0/8] uuid: convert users to generic UUID API Andrew Morton <akpm@linux-foundation.org> - 2016-04-05 01:50 +0200
    Re: [PATCH v2 0/8] uuid: convert users to generic UUID API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-05 13:10 +0200
    Re: [PATCH v2 0/8] uuid: convert users to generic UUID API Matt Fleming <matt@codeblueprint.co.uk> - 2016-04-05 16:20 +0200

csiph-web