httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [apreq-2] conditionals
Date Sat, 19 Apr 2003 20:47:18 GMT
On Sat, 19 Apr 2003, Randy Kobes wrote:

> For apreq-2, VC++ on Win32 (and perhaps also some other 
> compilers?) doesn't like statements like
>   (some_condition) ? do_something : do_something_else;
> This diff (unfortunately :)
[ .. ]

Bill pointed out a better solution:
=========================================================
Index: apreq_tables.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_tables.c,v
retrieving revision 1.13
diff -u -r1.13 apreq_tables.c
--- apreq_tables.c	19 Apr 2003 16:21:31 -0000	1.13
+++ apreq_tables.c	19 Apr 2003 20:54:35 -0000
@@ -176,7 +176,7 @@
     if (pivot[o].tree[!direction] >= 0)
         pivot[o].tree[!direction][o].tree[PARENT] = pivot;
 
-    (parent >= 0) ? parent[o].tree[LR(pivot)] : *root = child;
+    (parent >= 0) ? parent[o].tree[LR(pivot)] : (*root = child);
 
     child[o].tree[PARENT]      = parent;
     child[o].tree[direction]   = pivot;
@@ -256,7 +256,7 @@
             if (x[o].tree[RIGHT] >= 0)
                 x[o].tree[RIGHT][o].tree[PARENT] = idx;
 
-            (parent >= 0) ? parent[o].tree[LR(x)] : *root = idx;
+            (parent >= 0) ? parent[o].tree[LR(x)] : (*root = idx);
 
             elt->tree[PARENT] = parent;
             elt->tree[RIGHT]  = x[o].tree[RIGHT];
@@ -333,7 +333,7 @@
         y[o].tree[RIGHT]  = idx[o].tree[RIGHT];
         y[o].color        = idx[o].color;
 
-        (x >= 0) ? x[o].tree[LR(idx)] : *root = y;
+        (x >= 0) ? x[o].tree[LR(idx)] : (*root = y);
 
         idx[o].tree[PARENT] = -1;
         idx[o].tree[LEFT]   = -1;
@@ -357,7 +357,7 @@
     x[o].tree[PARENT] = y[o].tree[PARENT];
 
     (y[o].tree[PARENT] >= 0) ?
-        y[o].tree[PARENT][o].tree[LR(y)] : *root = x;
+        y[o].tree[PARENT][o].tree[LR(y)] : (*root = x);
 
     if (y != idx) {     /* swap y[o] with idx[o] */
         y[o].tree[LEFT] = idx[o].tree[LEFT];
@@ -365,7 +365,7 @@
         y[o].tree[PARENT] = idx[o].tree[PARENT];
         
         (y[o].tree[PARENT] >= 0) ?
-            y[o].tree[PARENT][o].tree[LR(y)] : *root = y;
+            y[o].tree[PARENT][o].tree[LR(y)] : (*root = y);
 
         idx[o].tree[LEFT] = -1;
         idx[o].tree[RIGHT] = -1;
================================================================

-- 
best regards,
randy


Mime
View raw message