]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codeseg.c
Move the increment code of a for loop after the loop body.
[cc65] / src / cc65 / codeseg.c
index 89029350bac47e9a757b8d7f03651592c61b67d9..e06c508adcebfc8808ddeeb04be9086bc8c6496a 100644 (file)
@@ -235,7 +235,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
            L = ReadToken (L+1, ",)", Arg, sizeof (Arg));
 
            /* Check for errors */
-           if (*L == '\0') {
+           if (*L == '\0') {
                Error ("ASM code error: syntax error");
                return 0;
            }
@@ -278,7 +278,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
                    AM = AM65_ZP_IND;
                } else {
                    Error ("ASM code error: syntax error");
-                   return 0;
+                   return 0;
                }
            }
            break;
@@ -321,7 +321,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
                            AM = AM65_ABSX;
                        }
                    } else if (Reg == 'Y') {
-                       AM = AM65_ABSY;
+                       AM = AM65_ABSY;
                    } else {
                        Error ("ASM code error: syntax error");
                        return 0;
@@ -402,7 +402,7 @@ CodeSeg* NewCodeSeg (const char* SegName, SymEntry* Func)
 
 
 
-void CS_AddEntry (CodeSeg* S, struct CodeEntry* E, LineInfo* LI)
+void CS_AddEntry (CodeSeg* S, struct CodeEntry* E)
 /* Add an entry to the given code segment */
 {
     /* Transfer the labels if we have any */
@@ -426,7 +426,7 @@ void CS_AddEntry (CodeSeg* S, struct CodeEntry* E, LineInfo* LI)
 
 
 
-void CS_AddEntryLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
+void CS_AddLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
 /* Add a line to the given code segment */
 {
     const char* L;
@@ -465,7 +465,7 @@ void CS_AddEntryLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap)
 
     /* If we have a code entry, transfer the labels and insert it */
     if (E) {
-       CS_AddEntry (S, E, LI);
+       CS_AddEntry (S, E);
     }
 }
 
@@ -545,29 +545,8 @@ void CS_DelEntries (CodeSeg* S, unsigned Start, unsigned Count)
      * memory moving.
      */
     while (Count--) {
-       CS_DelEntry (S, Start + Count);
-    }
-}
-
-
-
-void CS_MoveEntry (CodeSeg* S, unsigned OldPos, unsigned NewPos)
-/* Move an entry from one position to another. OldPos is the current position
- * of the entry, NewPos is the new position of the entry.
- */
-{
-    /* Get the code entry and remove it from the collection */
-    CodeEntry* E = CS_GetEntry (S, OldPos);
-    CollDelete (&S->Entries, OldPos);
-
-    /* Correct NewPos if needed */
-    if (NewPos >= OldPos) {
-       /* Position has changed with removal */
-       --NewPos;
+       CS_DelEntry (S, Start + Count);
     }
-
-    /* Now insert it at the new position */
-    CollInsert (&S->Entries, E, NewPos);
 }
 
 
@@ -578,10 +557,10 @@ struct CodeEntry* CS_GetNextEntry (CodeSeg* S, unsigned Index)
  */
 {
     if (Index >= CollCount (&S->Entries)-1) {
-       /* This is the last entry */
-       return 0;
+       /* This is the last entry */
+       return 0;
     } else {
-       /* Code entries left */
+       /* Code entries left */
                return CollAtUnchecked (&S->Entries, Index+1);
     }
 }