uuidd: reorder bulk time and random generation code
Write the data and response length values in same close to order they appear in protocol. This should make code a little easier to read. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
2049075a79
commit
ea9416925c
|
@ -529,18 +529,19 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
|
|||
num = (sizeof(reply_buf) - sizeof(num)) / UUID_LEN;
|
||||
__uuid_generate_random((unsigned char *) reply_buf +
|
||||
sizeof(num), &num);
|
||||
reply_len = sizeof(num) + (UUID_LEN * num);
|
||||
memcpy(reply_buf, &num, sizeof(num));
|
||||
if (uuidd_cxt->debug) {
|
||||
fprintf(stderr, P_("Generated %d UUID:\n",
|
||||
"Generated %d UUIDs:\n", num), num);
|
||||
for (i = 0, cp = reply_buf + sizeof(num);
|
||||
i < num;
|
||||
i++, cp += UUID_LEN) {
|
||||
|
||||
cp = reply_buf + sizeof(num)
|
||||
for (i = 0; i < num; i++) {
|
||||
uuid_unparse((unsigned char *)cp, str);
|
||||
fprintf(stderr, "\t%s\n", str);
|
||||
cp += UUID_LEN;
|
||||
}
|
||||
}
|
||||
reply_len = (num * UUID_LEN) + sizeof(num);
|
||||
memcpy(reply_buf, &num, sizeof(num));
|
||||
break;
|
||||
default:
|
||||
if (uuidd_cxt->debug)
|
||||
|
|
Loading…
Reference in New Issue