1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: dmeventd simplify restart message parsing

Since we already check every characted in the message,
skip extra callback to strlen, and do the implicit
message length checking.
This commit is contained in:
Zdenek Kabelac 2014-04-18 15:17:57 +02:00
parent 1f701c7bf6
commit 7a1777302f

View File

@ -1918,7 +1918,6 @@ static void restart(void)
struct dm_event_daemon_message msg = { 0 };
int i, count = 0;
char *message;
int length;
int version;
const char *e;
@ -1943,16 +1942,12 @@ static void restart(void)
if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0))
goto bad;
message = msg.data;
message = strchr(message, ' ');
++ message;
length = strlen(msg.data);
for (i = 0; i < length; ++i) {
message = strchr(msg.data, ' ') + 1;
for (i = 0; msg.data[i]; ++i)
if (msg.data[i] == ';') {
msg.data[i] = 0;
++count;
}
}
if (!(_initial_registrations = dm_malloc(sizeof(char*) * (count + 1)))) {
fprintf(stderr, "Memory allocation registration failed.\n");