]> git.sur5r.net Git - cc65/commitdiff
Small code changes for more safety (and to be compatible with the new shift
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 6 Jul 2012 19:59:29 +0000 (19:59 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 6 Jul 2012 19:59:29 +0000 (19:59 +0000)
routines that don't use the stack).

git-svn-id: svn://svn.cc65.org/cc65/trunk@5762 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/coptptrstore.c

index 95689b4ac9658b4d5eef633e3d9c40dc22468893..754388de83f29d73ed2832613689917e303615c1 100644 (file)
@@ -36,6 +36,7 @@
 #include <string.h>
 
 /* common */
+#include "chartype.h"
 #include "strbuf.h"
 #include "xmalloc.h"
 #include "xsprintf.h"
@@ -65,8 +66,11 @@ static unsigned OptPtrStore1Sub (CodeSeg* S, unsigned I, CodeEntry** const L)
     if (L[0]->OPC == OP65_AND                                           ||
        L[0]->OPC == OP65_EOR                                           ||
        L[0]->OPC == OP65_ORA                                           ||
-       (L[0]->OPC == OP65_JSR && strncmp (L[0]->Arg, "shlax", 5) == 0) ||
-               (L[0]->OPC == OP65_JSR && strncmp (L[0]->Arg, "shrax", 5) == 0)) {
+       (L[0]->OPC == OP65_JSR                          &&
+         (strncmp (L[0]->Arg, "shlax", 5) == 0  ||
+          strncmp (L[0]->Arg, "shrax", 5) == 0)         &&
+         strlen (L[0]->Arg) == 6                        &&
+         IsDigit (L[0]->Arg[5]))) {
 
        /* One insn */
        return 1;