static int container_cmp (MuContainer *a, MuContainer *b, MuMsgFieldId mfid) { if (a == b) return 0; else if (!a->msg) return -1; else if (!b->msg) return 1; return mu_msg_cmp (a->msg, b->msg, mfid); }
static int sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data) { MuContainer *a1, *b1; /* use the first non-empty 'left child' message if this one * is */ for (a1 = a; a1->msg == NULL && a1->child != NULL; a1 = a1->child); for (b1 = b; b1->msg == NULL && b1->child != NULL; b1 = b1->child); if (a1 == b1) return 0; else if (!a1->msg) return 1; else if (!b1->msg) return -1; if (data->descending) return mu_msg_cmp (b1->msg, a1->msg, data->mfid); else return mu_msg_cmp (a1->msg, b1->msg, data->mfid); }