diff options
author | Pali Rohár | 2017-05-01 09:28:22 +0200 |
---|---|---|
committer | Pali Rohár | 2017-05-01 09:28:22 +0200 |
commit | 49d84dbedcb9b1babe5e5f93709163452e51f872 (patch) | |
tree | d9d3af94bf13d3a42bc56e27c90b6045cef00b9f /libblkid | |
parent | lib/timer: add comment (diff) | |
download | kernel-qcow2-util-linux-49d84dbedcb9b1babe5e5f93709163452e51f872.tar.gz kernel-qcow2-util-linux-49d84dbedcb9b1babe5e5f93709163452e51f872.tar.xz kernel-qcow2-util-linux-49d84dbedcb9b1babe5e5f93709163452e51f872.zip |
libblkid: udf: For better readibility use one snprintf call instead multiple in loop
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/superblocks/udf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c index fc258cd1e..efbf7983d 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; |