pptok.c: handle holes in the pp_directives array
authorH. Peter Anvin <hpa@zytor.com>
Wed, 12 Sep 2007 05:18:20 +0000 (05:18 +0000)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 12 Sep 2007 05:18:20 +0000 (05:18 +0000)
We need to fail if we land in a hole in the pp_directives array, since
we have a noncontiguous enum preproc_token now.

pptok.pl

index 9a00ea2..99efc38 100755 (executable)
--- a/pptok.pl
+++ b/pptok.pl
@@ -194,7 +194,7 @@ if ($what eq 'c') {
     print OUT  "        return PP_INVALID;\n";
     print OUT  "\n";
 
-    print OUT  "    if (nasm_stricmp(pp_directives[ix], token))\n";
+    print OUT  "    if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))\n";
     print OUT  "        return PP_INVALID;\n";
     print OUT  "\n";
     print OUT  "    return ix;\n";