*/
MimeDecEntity * MimeDecAddEntity(MimeDecEntity *parent)
{
- MimeDecEntity *curr, *node = SCMalloc(sizeof(MimeDecEntity));
+ MimeDecEntity *node = SCMalloc(sizeof(MimeDecEntity));
if (unlikely(node == NULL)) {
return NULL;
}
if (parent != NULL) {
if (parent->child == NULL) {
parent->child = node;
+ parent->last_child = node;
} else {
- curr = parent->child;
- while (curr->next != NULL) {
- curr = curr->next;
- }
- curr->next = node;
+ parent->last_child->next = node;
+ parent->last_child = node;
}
}
uint8_t *msg_id; /**< Quick access pointer to message Id */
struct MimeDecEntity *next; /**< Pointer to list of sibling entities */
struct MimeDecEntity *child; /**< Pointer to list of child entities */
+ struct MimeDecEntity *last_child; /**< Pointer to tail of the list of child entities */
} MimeDecEntity;
/**