Skip to contentSkip to conversation

dual line backtraces for i386.

DISCUSSION Chuck Ebbert 2 participants 2 messages Jan 5, 2006 – Jan 6, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500 static inline unsigned long print_contex · line 119

Quoted 7 lines · Dave Jones
arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500 renamed from arch/i386/kernel/traps.c~ 2005-12-01 04:25:36.000000000 -0500 +1 -0
@@ -116,6 +116,7 @@ static inline unsigned long print_contex
                              unsigned long *stack, unsigned long ebp)
 {
      unsigned long addr;
+     char space=0;
        char space = 0;

arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500 static inline unsigned long print_contex

Quoted 8 lines
arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500 renamed from arch/i386/kernel/traps.c~ 2005-12-01 04:25:36.000000000 -0500 +7 -1
-                     printk("\n");
+                     if (space == 0) {
+                             printk("    ");
+                             space = 1;
+                     } else {
+                             printk("\n");
+                             space = 0;
+                     }

Why not:

                        printk(space == 0 ? "     " : "\n");
                        space = !space;

arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500

Quoted 2 lines
arch/i386/kernel/traps.c 2005-12-01 04:36:19.000000000 -0500 renamed from arch/i386/kernel/traps.c~ 2005-12-01 04:25:36.000000000 -0500 +2 -0
+     if (space==1)
+             printk("\n");
        if (space == 1)
Signature · 2 lines
Chuck
Currently reading: _Thud!_ by Terry Pratchett
#1 lore raw
Quoted 9 lines · Chuck Ebbert

Review

Quoted 8 lines
(quoted diff) +7 -1
-                     printk("\n");
+                     if (space == 0) {
+                             printk("    ");
+                             space = 1;
+                     } else {
+                             printk("\n");
+                             space = 0;
+                     }
Quoted 4 lines

Why not:

                        printk(space == 0 ? "     " : "\n");
                        space = !space;

readability ?
Personally, I despise the ternary operator, because it makes me stop to try to parse it every time I see it. With the code I wrote it's blindlingly obvious what is going on.

Dave