]> git.sur5r.net Git - cc65/blobdiff - src/cc65/casenode.c
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / src / cc65 / casenode.c
index 25121f5e81667d63053196cb7ca20d5e00f4c7c5..0e1b3730536540c9fd2d042533a1170bbbcead4b 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                               casenode.c                                 */
+/*                                casenode.c                                 */
 /*                                                                           */
-/*       Node for the tree that is generated for a switch statement         */
+/*        Node for the tree that is generated for a switch statement         */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
@@ -47,7 +47,7 @@
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -73,7 +73,7 @@ void FreeCaseNode (CaseNode* N)
 /* Delete a case node plus all sub nodes */
 {
     if (N->Nodes) {
-       FreeCaseNodeColl (N->Nodes);
+        FreeCaseNodeColl (N->Nodes);
     }
     xfree (N);
 }
@@ -85,7 +85,7 @@ void FreeCaseNodeColl (Collection* Nodes)
 {
     unsigned I;
     for (I = 0; I < CollCount (Nodes); ++I) {
-       FreeCaseNode (CollAtUnchecked (Nodes, I));
+        FreeCaseNode (CollAtUnchecked (Nodes, I));
     }
     FreeCollection (Nodes);
 }
@@ -106,23 +106,23 @@ int SearchCaseNode (const Collection* Nodes, unsigned char Key, int* Index)
 
     while (First <= Last) {
 
-               /* Set current to mid of range */
-       int Current = (Last + First) / 2;
+        /* Set current to mid of range */
+        int Current = (Last + First) / 2;
 
-       /* Get the entry from this position */
-       const CaseNode* N = CollConstAt (Nodes, Current);
+        /* Get the entry from this position */
+        const CaseNode* N = CollConstAt (Nodes, Current);
 
-       /* Compare the values */
-       if (N->Value < Key) {
-           First = Current + 1;
-       } else {
-           Last = Current - 1;
-           if (N->Value == Key) {
-               /* Found. We cannot have duplicates, so end the search here. */
-               S = 1;
-               First = Current;
-           }
-       }
+        /* Compare the values */
+        if (N->Value < Key) {
+            First = Current + 1;
+        } else {
+            Last = Current - 1;
+            if (N->Value == Key) {
+                /* Found. We cannot have duplicates, so end the search here. */
+                S = 1;
+                First = Current;
+            }
+        }
 
     }
 
@@ -142,41 +142,41 @@ unsigned InsertCaseValue (Collection* Nodes, unsigned long Val, unsigned Depth)
 
     while (Depth--) {
 
-       int Index;
-
-       /* Get the key */
-               unsigned char Key = (Val >> (Depth * CHAR_BIT)) & 0xFF;
-
-       /* Search for the node in the collection */
-       if (SearchCaseNode (Nodes, Key, &Index) == 0) {
-
-           /* Node not found - insert one */
-           N = NewCaseNode (Key);
-           CollInsert (Nodes, N, Index);
-
-           /* If this is not the last round, create the collection for
-            * the subnodes, otherwise get a label for the code.
-            */
-           if (Depth > 0) {
-               N->Nodes = NewCollection ();
-           } else {
-               N->Label = CaseLabel;
-           }
-
-       } else {
-           /* Node found, get it */
-           N = CollAt (Nodes, Index);
-
-           /* If this is the last round and we found a node, we have a
-            * duplicate case label in a switch.
-            */
-           if (Depth == 0) {
-               Error ("Duplicate case label");
-           }
-       }
-
-               /* Get the collection from the node for the next round. */
-       Nodes = N->Nodes;
+        int Index;
+
+        /* Get the key */
+        unsigned char Key = (Val >> (Depth * CHAR_BIT)) & 0xFF;
+
+        /* Search for the node in the collection */
+        if (SearchCaseNode (Nodes, Key, &Index) == 0) {
+
+            /* Node not found - insert one */
+            N = NewCaseNode (Key);
+            CollInsert (Nodes, N, Index);
+
+            /* If this is not the last round, create the collection for
+             * the subnodes, otherwise get a label for the code.
+             */
+            if (Depth > 0) {
+                N->Nodes = NewCollection ();
+            } else {
+                N->Label = CaseLabel;
+            }
+
+        } else {
+            /* Node found, get it */
+            N = CollAt (Nodes, Index);
+
+            /* If this is the last round and we found a node, we have a
+             * duplicate case label in a switch.
+             */
+            if (Depth == 0) {
+                Error ("Duplicate case label");
+            }
+        }
+
+        /* Get the collection from the node for the next round. */
+        Nodes = N->Nodes;
     }
 
     /* Return the label of the node we found/created */