Commit 5b19d09f authored by François Grisez's avatar François Grisez

Fix msg_dup()

parent bc545c26
......@@ -2532,8 +2532,6 @@ int msg_header_prepend(msg_t *msg,
msg_header_t **
msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
{
volatile int i; // workaround to avoid bad optimization of gcc>=4.9.x
assert(mc && hc);
if (mc == NULL || hc == NULL)
......@@ -2545,12 +2543,16 @@ msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
if (mc->mc_hash[j].hr_class == hc) {
return (msg_header_t **)((char *)mo + mc->mc_hash[j].hr_offset);
}
}
else
} else {
/* Header has no name. */
for (i = 0; i <= 6; i++)
if (hc->hc_hash == mc->mc_request[i].hr_class->hc_hash)
return (msg_header_t **)((char *)mo + mc->mc_request[i].hr_offset);
if (hc->hc_hash == mc->mc_request[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_request[0].hr_offset);
if (hc->hc_hash == mc->mc_status[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_status[0].hr_offset);
if (hc->hc_hash == mc->mc_separator[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_separator[0].hr_offset);
if (hc->hc_hash == mc->mc_payload[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_payload[0].hr_offset);
if (hc->hc_hash == mc->mc_unknown[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_unknown[0].hr_offset);
if (hc->hc_hash == mc->mc_error[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_error[0].hr_offset);
if (hc->hc_hash == mc->mc_multipart[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_multipart[0].hr_offset);
}
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment