From: Jan Dubois Date: Mon, 24 Dec 2007 14:58:20 +0000 (-0800) Subject: Remove Nullch etc. from x2p X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d34ed59f585350f3dfb4fdf7eca3266cdce428a1;p=p5sagit%2Fp5-mst-13.2.git Remove Nullch etc. from x2p From: "Jan Dubois" Message-ID: <0cca01c84680$7afc9170$70f5b450$@com> p4raw-id: //depot/perl@32721 --- diff --git a/x2p/a2p.h b/x2p/a2p.h index e38e2d2..750e153 100644 --- a/x2p/a2p.h +++ b/x2p/a2p.h @@ -157,9 +157,6 @@ char *strcpy(), *strcat(); # include "../handy.h" #endif -#undef Nullfp -#define Nullfp Null(FILE*) - #define Nullop 0 #define OPROG 1 @@ -407,7 +404,7 @@ EXT FILE *rsfp; EXT char buf[2048]; EXT char *bufptr INIT(buf); -EXT STR *linestr INIT(Nullstr); +EXT STR *linestr INIT(NULL); EXT char tokenbuf[2048]; EXT int expectterm INIT(TRUE); @@ -423,7 +420,7 @@ extern int yydebug; # endif #endif -EXT STR *freestrroot INIT(Nullstr); +EXT STR *freestrroot INIT(NULL); EXT STR str_no; EXT STR str_yes; @@ -447,7 +444,7 @@ EXT bool saw_altinput INIT(FALSE); EXT bool nomemok INIT(FALSE); EXT char const_FS INIT(0); -EXT char *namelist INIT(Nullch); +EXT char *namelist INIT(NULL); EXT char fswitch INIT(0); EXT bool old_awk INIT(0); diff --git a/x2p/a2py.c b/x2p/a2py.c index b6497af..84fdc48 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -117,7 +117,7 @@ main(register int argc, register const char **argv, register const char **env) /* open script */ - if (argv[0] == Nullch) { + if (argv[0] == NULL) { #if defined(OS2) || defined(WIN32) || defined(NETWARE) if ( isatty(fileno(stdin)) ) usage(); @@ -132,7 +132,7 @@ main(register int argc, register const char **argv, register const char **env) rsfp = stdin; else rsfp = fopen(argv[0],"r"); - if (rsfp == Nullfp) + if (rsfp == NULL) fatal("Awk script \"%s\" doesn't seem to exist.\n",filename); /* init tokener */ @@ -253,10 +253,10 @@ yylex(void) if (!rsfp) RETURN(0); line++; - if ((s = str_gets(linestr, rsfp)) == Nullch) { + if ((s = str_gets(linestr, rsfp)) == NULL) { if (rsfp != stdin) fclose(rsfp); - rsfp = Nullfp; + rsfp = NULL; s = str_get(linestr); RETURN(0); } diff --git a/x2p/str.c b/x2p/str.c index 3909f5b..58798c0 100644 --- a/x2p/str.c +++ b/x2p/str.c @@ -185,7 +185,7 @@ str_gets(register STR *str, register FILE *fp) * buffer, so we getc() it back out and stuff it in the buffer. */ i = getc(fp); - if (i == EOF) return Nullch; + if (i == EOF) return NULL; *(--((*fp)->_ptr)) = (unsigned char) i; (*fp)->_cnt++; #endif @@ -239,14 +239,14 @@ thats_all_folks: static char buf[4192]; - if (fgets(buf, sizeof buf, fp) != Nullch) + if (fgets(buf, sizeof buf, fp) != NULL) str_set(str, buf); else str_set(str, No); #endif /* USE_STDIO_PTR && STDIO_PTR_LVALUE && STDIO_CNT_LVALUE */ - return str->str_cur ? str->str_ptr : Nullch; + return str->str_cur ? str->str_ptr : NULL; } STR * diff --git a/x2p/str.h b/x2p/str.h index 98e354c..7fc8e1e 100644 --- a/x2p/str.h +++ b/x2p/str.h @@ -19,8 +19,6 @@ struct string { char str_nok; /* state of str_nval */ }; -#define Nullstr Null(STR*) - /* the following macro updates any magic values this str is associated with */ #define STABSET(x) (x->str_link.str_magic && stabset(x->str_link.str_magic,x)) diff --git a/x2p/util.c b/x2p/util.c index aff3f00..464dd8f 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -32,7 +32,7 @@ safemalloc(MEM_SIZE size) fprintf(stderr,"0x%lx: (%05d) malloc %ld bytes\n",(unsigned long)ptr, an++,(long)size); #endif - if (ptr != Nullch) + if (ptr != NULL) return ptr; else { fputs(nomem,stdout) FLUSH; @@ -57,7 +57,7 @@ saferealloc(Malloc_t where, MEM_SIZE size) fprintf(stderr,"0x%lx: (%05d) realloc %ld bytes\n",(unsigned long)ptr,an++,(long)size); } #endif - if (ptr != Nullch) + if (ptr != NULL) return ptr; else { fputs(nomem,stdout) FLUSH; @@ -127,14 +127,14 @@ instr(char *big, const char *little) for (t = big; *t; t++) { for (x=t,s=little; *s; x++,s++) { if (!*x) - return Nullch; + return NULL; if (*s != *x) break; } if (!*s) return t; } - return Nullch; + return NULL; } /* copy a string to a safe spot */ diff --git a/x2p/walk.c b/x2p/walk.c index cc9f8ac..ef754c5 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -23,7 +23,7 @@ const char *lparen; const char *rparen; const char *limit; STR *subs; -STR *curargs = Nullstr; +STR *curargs = NULL; static void addsemi ( STR *str ); static void emit_split ( STR *str, int level ); @@ -741,10 +741,10 @@ sub Pick {\n\ str_cat(curargs,","); tmp2str=walk(1,level,ops[node+5].ival,&numarg,P_MIN); str_free(curargs); - curargs = Nullstr; + curargs = NULL; level--; subretnum |= numarg; - s = Nullch; + s = NULL; t = tmp2str->str_ptr; while ((t = instr(t,"return "))) s = t++; @@ -1516,7 +1516,7 @@ sub Pick {\n\ } } else { - str = Nullstr; + str = NULL; } break; }