=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/lex.c,v retrieving revision 1.26 retrieving revision 1.27 diff -c -r1.26 -r1.27 *** src/usr.bin/awk/lex.c 2020/08/28 16:29:16 1.26 --- src/usr.bin/awk/lex.c 2020/12/09 20:00:11 1.27 *************** *** 1,4 **** ! /* $OpenBSD: lex.c,v 1.26 2020/08/28 16:29:16 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved --- 1,4 ---- ! /* $OpenBSD: lex.c,v 1.27 2020/12/09 20:00:11 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved *************** *** 184,190 **** static char *buf = NULL; static int bufsize = 5; /* BUG: setting this small causes core dump! */ ! if (buf == NULL && (buf = malloc(bufsize)) == NULL) FATAL( "out of space in yylex" ); if (sc) { sc = false; --- 184,190 ---- static char *buf = NULL; static int bufsize = 5; /* BUG: setting this small causes core dump! */ ! if (buf == NULL && (buf = (char *) malloc(bufsize)) == NULL) FATAL( "out of space in yylex" ); if (sc) { sc = false; *************** *** 202,208 **** return word(buf); if (isdigit(c)) { char *cp = tostring(buf); ! yylval.cp = setsymtab(buf, cp, atof(buf), CON|NUM, symtab); free(cp); /* should this also have STR set? */ RET(NUMBER); --- 202,213 ---- return word(buf); if (isdigit(c)) { char *cp = tostring(buf); ! double result; ! ! if (is_number(cp, & result)) ! yylval.cp = setsymtab(buf, cp, result, CON|NUM, symtab); ! else ! yylval.cp = setsymtab(buf, cp, 0.0, STR, symtab); free(cp); /* should this also have STR set? */ RET(NUMBER); *************** *** 381,387 **** static char *buf = NULL; static int bufsz = 500; ! if (buf == NULL && (buf = malloc(bufsz)) == NULL) FATAL("out of space for strings"); for (bp = buf; (c = input()) != '"'; ) { if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, "string")) --- 386,392 ---- static char *buf = NULL; static int bufsz = 500; ! if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for strings"); for (bp = buf; (c = input()) != '"'; ) { if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, "string")) *************** *** 530,536 **** static int bufsz = 500; char *bp, *cstart; ! if (buf == NULL && (buf = malloc(bufsz)) == NULL) FATAL("out of space for rex expr"); bp = buf; for ( ; ((c = input()) != '/' || openclass > 0) && c != 0; ) { --- 535,541 ---- static int bufsz = 500; char *bp, *cstart; ! if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for rex expr"); bp = buf; for ( ; ((c = input()) != '/' || openclass > 0) && c != 0; ) {