- if (thread->parent)
- {
- tmp = thread;
- thread = thread->parent;
-
- if (!thread->sort_key || thread->sort_children)
- {
- /* make sort_key the first or last sibling, as appropriate */
- sort_key = (!(Sort & SORT_LAST) ^ !(Sort & SORT_REVERSE)) ? thread->child : tmp;
-
- /* we just sorted its children */
- thread->sort_children = 0;
-
- oldsort_key = thread->sort_key;
- thread->sort_key = thread->message;
-
- if (Sort & SORT_LAST)
- {
- if (!thread->sort_key
- || ((((Sort & SORT_REVERSE) ? 1 : -1)
- * compare_threads ((void *) &thread,
- (void *) &sort_key))
- > 0))
- thread->sort_key = sort_key->sort_key;
- }
- else if (!thread->sort_key)
- thread->sort_key = sort_key->sort_key;
-
- /* if its sort_key has changed, we need to resort it and siblings */
- if (oldsort_key != thread->sort_key)
- {
- if (thread->parent)
- thread->parent->sort_children = 1;
- else
- sort_top = 1;
- }
- }
+ if (thread->parent) {
+ tmp = thread;
+ thread = thread->parent;
+
+ if (!thread->sort_key || thread->sort_children) {
+ /* make sort_key the first or last sibling, as appropriate */
+ sort_key =
+ (!(Sort & SORT_LAST) ^ !(Sort & SORT_REVERSE)) ? thread->
+ child : tmp;
+
+ /* we just sorted its children */
+ thread->sort_children = 0;
+
+ oldsort_key = thread->sort_key;
+ thread->sort_key = thread->message;
+
+ if (Sort & SORT_LAST) {
+ if (!thread->sort_key || ((((Sort & SORT_REVERSE) ? 1 : -1)
+ * compare_threads ((void *) &thread,
+ (void *) &sort_key))
+ > 0))
+ thread->sort_key = sort_key->sort_key;
+ }
+ else if (!thread->sort_key)
+ thread->sort_key = sort_key->sort_key;
+
+ /* if its sort_key has changed, we need to resort it and siblings */
+ if (oldsort_key != thread->sort_key) {
+ if (thread->parent)
+ thread->parent->sort_children = 1;
+ else
+ sort_top = 1;
+ }
+ }