From: Pali Rohár Date: Mon, 1 May 2017 07:28:22 +0000 (+0200) Subject: libblkid: udf: For better readibility use one snprintf call instead multiple in loop X-Git-Tag: v2.30-rc1~76^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49d84dbedcb9b1babe5e5f93709163452e51f872;p=thirdparty%2Futil-linux.git libblkid: udf: For better readibility use one snprintf call instead multiple in loop --- diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c index fc258cd1ea..efbf7983dd 100644 --- a/libblkid/src/superblocks/udf.c +++ b/libblkid/src/superblocks/udf.c @@ -109,12 +109,13 @@ static inline int gen_uuid_from_volset_id(unsigned char uuid[17], struct dstring } if (binpos < 8) { - for (i = 0; i < 8; ++i) - snprintf((char *) uuid + 2 * i, 3, "%02x", buf[i]); + snprintf((char *) uuid, 17, "%02x%02x%02x%02x%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); } else if (binpos < 16) { memcpy(uuid, buf, 8); - for (i = 0; i < 4; ++i) - snprintf((char *) uuid + 8 + 2 * i, 3, "%02x", buf[8+i]); + snprintf((char *) uuid + 8, 9, "%02x%02x%02x%02x", + buf[8], buf[9], buf[10], buf[11]); } else { memcpy(uuid, buf, 16); uuid[16] = 0;