Fix relative numerical addressing (addr,+N).

As a bonus the patch untangles a bit the logic and makes the code
easier to grasp.

PR:		192108
MFC after:	1 week
This commit is contained in:
Jeremie Le Hen 2014-07-30 14:46:39 +00:00
parent 27c095f49e
commit b38ebc0538
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=269302

View File

@ -288,24 +288,32 @@ applies(struct s_command *cp)
r = 1; r = 1;
else if (cp->a2) else if (cp->a2)
if (cp->startline > 0) { if (cp->startline > 0) {
if (MATCH(cp->a2)) { switch (cp->a2->type) {
cp->startline = 0; case AT_RELLINE:
lastaddr = 1; if (linenum - cp->startline <= cp->a2->u.l)
r = 1; r = 1;
} else if (linenum - cp->startline <= cp->a2->u.l) else {
r = 1; cp->startline = 0;
else if ((cp->a2->type == AT_LINE && r = 0;
linenum > cp->a2->u.l) || }
(cp->a2->type == AT_RELLINE && break;
linenum - cp->startline > cp->a2->u.l)) { default:
/* if (MATCH(cp->a2)) {
* We missed the 2nd address due to a branch, cp->startline = 0;
* so just close the range and return false. lastaddr = 1;
*/ r = 1;
cp->startline = 0; } else if (cp->a2->type == AT_LINE &&
r = 0; linenum > cp->a2->u.l) {
} else /*
r = 1; * We missed the 2nd address due to a
* branch, so just close the range and
* return false.
*/
cp->startline = 0;
r = 0;
} else
r = 1;
}
} else if (MATCH(cp->a1)) { } else if (MATCH(cp->a1)) {
/* /*
* If the second address is a number less than or * If the second address is a number less than or