aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-27 15:22:28 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-27 15:22:28 -0400
commitebb5c5ebc85b7f5b3a0a80e8021a80b0aebcedf6 (patch)
tree96402e53013d1c49f1052949405a27a5e85cb463
parentcb7d68b4f8437508cd5643898219b313b401365d (diff)
downloadbw-atari8-tools-ebb5c5ebc85b7f5b3a0a80e8021a80b0aebcedf6.tar.gz
unprotbas: fix and simplify fixline().
-rw-r--r--unprotbas.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/unprotbas.c b/unprotbas.c
index 242ea82..c59a33c 100644
--- a/unprotbas.c
+++ b/unprotbas.c
@@ -166,21 +166,10 @@ void set_header_vars(void) {
*/
int fixline(int linepos) {
/* +3 here to skip the line number + line length */
- int token, done = 0, offset = data[linepos + 3];
+ int offset = data[linepos + 3];
- /* this works for lines with multiple statements (colons): */
- while(!done) {
+ while(data[linepos + offset - 1] == 0x14)
offset = data[linepos + offset];
- token = data[linepos + offset - 1];
- if(token != 0x14)
- done++;
- }
-
- /* otherwise, the first statement being the only statement, use its
- next-statement offset. */
- if(!offset) {
- offset = data[linepos + 3];
- }
data[linepos + 2] = offset;
return offset;