]> Shamusworld >> Repos - rmac/blobdiff - sect.c
Fixed error reporting wrong file, off-by-one error in file record system.
[rmac] / sect.c
diff --git a/sect.c b/sect.c
index 3fd627a409560ea80ad3c38f5fc47ac1db93ffa1..66219b6833bac65d9fd489b640076bb3900df352 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -71,9 +71,7 @@ static char fusizoffs[] = {
 //
 void mksect(int sno, WORD attr)
 {
-       SECT * p;                                                 // Section pointer
-
-       p = &sect[sno];
+       SECT * p = &sect[sno];
        p->scattr = attr;
        p->sloc = 0;
        p->scode = p->sfcode = NULL;
@@ -125,13 +123,13 @@ void savsect(void)
 {
        SECT * p = &sect[cursect];
 
-       p->scattr = scattr;                                      // Bailout section vars
+       p->scattr = scattr;                                             // Bailout section vars
        p->sloc = sloc;
 
-       if (scode != NULL)                                        // Bailout code chunk
+       if (scode != NULL)                                              // Bailout code chunk
                scode->ch_size = ch_size;
 
-       if (sfix != NULL)                                         // Bailout fixup chunk
+       if (sfix != NULL)                                               // Bailout fixup chunk
                sfix->ch_size = fchsize;
 }
 
@@ -212,6 +210,7 @@ int fixtest(int sno, LONG loc)
 //
 int chcheck(LONG amt)
 {
+       DEBUG { printf("chcheck(%u)\n", amt); }
        // If in BSS section, no allocation required
        if (scattr & SBSS)
                return 0;
@@ -219,12 +218,14 @@ int chcheck(LONG amt)
        if (!amt)
                amt = CH_THRESHOLD;
 
+       DEBUG { printf("    challoc=%i, ch_size=%i, diff=%i\n", challoc, ch_size, challoc-ch_size); }
        if ((int)(challoc - ch_size) >= (int)amt) 
                return 0;
 
        if (amt < CH_CODE_SIZE)
                amt = CH_CODE_SIZE;
 
+       DEBUG { printf("    amt (adjusted)=%u\n", amt); }
        SECT * p = &sect[cursect];
        CHUNK * cp = malloc(sizeof(CHUNK) + amt);
 
@@ -453,6 +454,7 @@ int ResolveFixups(int sno)
                        loc = *fup.lp++;
                        cfileno = *fup.wp++;
                        curlineno = (int)*fup.wp++;
+DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
 
                        esym = NULL;