-#include "../common/filepos.h"
+/* common */
+#include "check.h"
+#include "filepos.h"
+#include "xmalloc.h"
+/* ca65 */
#include "error.h"
#include "expr.h"
-#include "mem.h"
#include "scanner.h"
#include "ulabel.h"
/* 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 */
*/
{
/* Allocate memory for the ULabel structure */
- ULabel* L = Xmalloc (sizeof (ULabel));
+ ULabel* L = xmalloc (sizeof (ULabel));
/* Initialize the fields */
L->Pos = CurPos;
} 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);
}
}
*/
if (ULabCount) {
unsigned I = 0;
- ULabList = Xmalloc (ULabCount * sizeof (ULabel*));
+ ULabList = xmalloc (ULabCount * sizeof (ULabel*));
L = ULabRoot;
while (L) {
ULabList[I] = L;