tools:acrn-crashlog: simplify the logic in sender

Function sender_id need to traverse all senders and then find the
matched id. This patch adds property "id" for each configuration object
and removes function sender_id.

Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Liu, Xiaojing <xiaojing.liu@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu
2019-04-18 15:25:24 +08:00
committed by ACRN System Integration
parent 53b2bd5811
commit 9d22a18659
3 changed files with 17 additions and 49 deletions

View File

@@ -291,22 +291,6 @@ enum event_type_t get_conf_by_wd(int wd, void **private)
}
int sender_id(const struct sender_t *s)
{
int id;
struct sender_t *sender;
for_each_sender(id, sender, conf) {
if (!sender)
continue;
if (s == sender)
return id;
}
return -1;
}
struct sender_t *get_sender_by_name(const char *name)
{
int id;
@@ -724,6 +708,7 @@ static int parse_sender(xmlNodePtr cur, struct sender_t *sender)
} \
memset(mem, 0, sizeof(*mem)); \
conf.mem[id] = mem; \
mem->id = id; \
res = parse_##mem(node, mem); \
if (res) { \
free(mem); \