diff options
author | Sven-Göran Bergh <sgb@systemasis.org> | 2013-01-14 00:50:49 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-01-14 00:52:03 +0100 |
commit | 52185155088d0910d29c7f4fdf5cb3eecaac8965 (patch) | |
tree | c09709e352e3431a0eddb12d5acc7a5c5a7aac63 /util-linux/volume_id/util.c | |
parent | 07b419dbcb34958d0f6050231783bd78f7d0344f (diff) | |
download | busybox-w32-52185155088d0910d29c7f4fdf5cb3eecaac8965.tar.gz busybox-w32-52185155088d0910d29c7f4fdf5cb3eecaac8965.tar.bz2 busybox-w32-52185155088d0910d29c7f4fdf5cb3eecaac8965.zip |
volume_id: uuid_format small code shrink
function old new delta
volume_id_set_uuid 318 300 -18
Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/volume_id/util.c')
-rw-r--r-- | util-linux/volume_id/util.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c index 11ee0d52e..0e2d24be0 100644 --- a/util-linux/volume_id/util.c +++ b/util-linux/volume_id/util.c | |||
@@ -135,23 +135,8 @@ void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enu | |||
135 | void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) | 135 | void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) |
136 | { | 136 | { |
137 | unsigned i; | 137 | unsigned i; |
138 | unsigned count = 0; | 138 | unsigned count = (format == UUID_DCE_STRING ? VOLUME_ID_UUID_SIZE : 4 << format); |
139 | 139 | ||
140 | switch (format) { | ||
141 | case UUID_DOS: | ||
142 | count = 4; | ||
143 | break; | ||
144 | case UUID_NTFS: | ||
145 | count = 8; | ||
146 | break; | ||
147 | case UUID_DCE: | ||
148 | count = 16; | ||
149 | break; | ||
150 | case UUID_DCE_STRING: | ||
151 | /* 36 is ok, id->uuid has one extra byte for NUL */ | ||
152 | count = VOLUME_ID_UUID_SIZE; | ||
153 | break; | ||
154 | } | ||
155 | // memcpy(id->uuid_raw, buf, count); | 140 | // memcpy(id->uuid_raw, buf, count); |
156 | // id->uuid_raw_len = count; | 141 | // id->uuid_raw_len = count; |
157 | 142 | ||