null pointer checks (from ralph)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 27 Jul 1985 07:15:00 +0000 (23:15 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 27 Jul 1985 07:15:00 +0000 (23:15 -0800)
SCCS-vsn: usr.bin/pascal/src/call.c 5.2
SCCS-vsn: usr.bin/pascal/src/fhdr.c 5.2
SCCS-vsn: usr.bin/pascal/src/lval.c 5.2
SCCS-vsn: usr.bin/pascal/src/var.c 5.2

usr/src/usr.bin/pascal/src/call.c
usr/src/usr.bin/pascal/src/fhdr.c
usr/src/usr.bin/pascal/src/lval.c
usr/src/usr.bin/pascal/src/var.c

index 01e7521..9f917ec 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)call.c     5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)call.c     5.2 (Berkeley) %G%";
 #endif not lint
 
 #include "whoami.h"
 #endif not lint
 
 #include "whoami.h"
@@ -227,7 +227,7 @@ call(p, argv_node, porf, psbn)
                                break;
                        }
                        p2 = p1->type;
                                break;
                        }
                        p2 = p1->type;
-                       if (p2 == NLNIL || p2->chain->class != CRANGE) {
+                       if (p2 == NLNIL || p2->chain == NLNIL || p2->chain->class != CRANGE) {
                            if (q != p2) {
                                error("Parameter type not identical to type of var parameter %s of %s", p1->symbol, p->symbol);
                                chk = FALSE;
                            if (q != p2) {
                                error("Parameter type not identical to type of var parameter %s of %s", p1->symbol, p->symbol);
                                chk = FALSE;
index 44e989a..507e107 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)fhdr.c     5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)fhdr.c     5.2 (Berkeley) %G%";
 #endif not lint
 
 #include "whoami.h"
 #endif not lint
 
 #include "whoami.h"
@@ -336,7 +336,6 @@ params(p, formalist)
 #      endif PC
        for (formalp = formalist; formalp != TR_NIL;
                        formalp = formalp->list_node.next) {
 #      endif PC
        for (formalp = formalist; formalp != TR_NIL;
                        formalp = formalp->list_node.next) {
-               p = NLNIL;
                formal = formalp->list_node.list;
                if (formal == TR_NIL)
                        continue;
                formal = formalp->list_node.list;
                if (formal == TR_NIL)
                        continue;
@@ -345,15 +344,14 @@ params(p, formalist)
                 * don't have types !?!
                 */
                typ = formal->pfunc_node.type;
                 * don't have types !?!
                 */
                typ = formal->pfunc_node.type;
+               p = NLNIL;
                if ( typ == TR_NIL ) {
                    if ( formal->tag != T_PPROC ) {
                        error("Types must be specified for arguments");
                if ( typ == TR_NIL ) {
                    if ( formal->tag != T_PPROC ) {
                        error("Types must be specified for arguments");
-                       p = NLNIL;
                    }
                } else {
                    if ( formal->tag == T_PPROC ) {
                        error("Procedures cannot have types");
                    }
                } else {
                    if ( formal->tag == T_PPROC ) {
                        error("Procedures cannot have types");
-                       p = NLNIL;
                    } else {
                        p = gtype(typ);
                    }
                    } else {
                        p = gtype(typ);
                    }
@@ -453,7 +451,7 @@ params(p, formalist)
                                chainp = dp;
                        }
                }
                                chainp = dp;
                        }
                }
-               if (typ->tag == T_TYCARY) {
+               if (typ != TR_NIL && typ->tag == T_TYCARY) {
 #                  ifdef OBJ
                        w = -even(lwidth(p->chain));
 #                      ifndef DEC11
 #                  ifdef OBJ
                        w = -even(lwidth(p->chain));
 #                      ifndef DEC11
index 90795c7..ed9ef12 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)lval.c     5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)lval.c     5.2 (Berkeley) %G%";
 #endif not lint
 
 #include "whoami.h"
 #endif not lint
 
 #include "whoami.h"
@@ -387,6 +387,8 @@ int arycod(np, el, n)
                        return (i-1);
                }
                p = p->chain;
                        return (i-1);
                }
                p = p->chain;
+               if (p == NLNIL)
+                       return (0);
                if ((p->class != CRANGE) &&
                        (constsub = constval(el->list_node.list))) {
                    ap = con.ctype;
                if ((p->class != CRANGE) &&
                        (constsub = constval(el->list_node.list))) {
                    ap = con.ctype;
index b785b69..018fa56 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)var.c      5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)var.c      5.2 (Berkeley) %G%";
 #endif not lint
 
 #include "whoami.h"
 #endif not lint
 
 #include "whoami.h"
@@ -142,7 +142,7 @@ var(vline, vidl, vtype)
 #              else
                (void) enter(defnl((char *) vidl->list_node.list, VAR, np, o2));
 #              endif
 #              else
                (void) enter(defnl((char *) vidl->list_node.list, VAR, np, o2));
 #              endif
-               if ( np -> nl_flags & NFILES ) {
+               if ( np != NLNIL && (np -> nl_flags & NFILES) ) {
                    dfiles[ cbn ] = TRUE;
                }
 #              ifdef PC
                    dfiles[ cbn ] = TRUE;
                }
 #              ifdef PC