]> git.sur5r.net Git - cc65/blobdiff - src/ca65/ulabel.c
Error message for negative array sizes.
[cc65] / src / ca65 / ulabel.c
index 1618afb73f39ee2d8111b61246e44fc6050bd3f4..7748f23dca30d72265e8f8d1b0ed4ed806fc1924 100644 (file)
 
 
 
-#include "../common/filepos.h"
-#include "../common/xmalloc.h"
+/* common */
+#include "check.h"
+#include "filepos.h"
+#include "xmalloc.h"
 
+/* ca65 */
 #include "error.h"
 #include "expr.h"
 #include "scanner.h"
@@ -50,8 +53,8 @@
 
 
 /* Struct that describes an unnamed label */
-typedef struct ULabel_ ULabel;
-struct ULabel_ {
+typedef struct ULabel ULabel;
+struct ULabel {
     ULabel*            Prev;                   /* Pointer to previous node in list */
     ULabel*            Next;                   /* Pointer to next node in list */
     FilePos    Pos;                    /* Position of the label in the source */
@@ -142,14 +145,11 @@ ExprNode* ULabRef (int Which)
     } else {
        /* Forward reference. Create labels as needed */
        unsigned LabelNum = ULabDefCount + Which - 1;
-       while (Which > 0) {
-           if (L->Next == 0) {
-               NewULabel (0);
-           }
-           L = L->Next;
-           --Which;
-       }
-       /* Return an unnamed label expression */
+       while (LabelNum < ULabCount) {
+                   NewULabel (0);
+       }
+
+       /* Return an unnamed label expression */
                return ULabelExpr (LabelNum);
     }
 }