use less stack storage, prefer .bss storage (saves us a memset() call)
and .data instead of another initialisation; this was prompted by a bug in scan-build (the value can never be NULL, but it doesn’t realise it), although this doesn’t fix it, but less stack usage is always good
This commit is contained in:
parent
7daf3f0b59
commit
9be489ea90
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.230 2008/10/13 23:06:01 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.231 2008/10/15 10:24:59 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -7,7 +7,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R35 2008/10/13
|
||||
@(#)MIRBSD KSH R35 2008/10/15
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
|
8
main.c
8
main.c
@ -13,7 +13,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.102 2008/09/17 19:31:29 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.103 2008/10/15 10:25:01 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -57,6 +57,9 @@ static const char *initcoms[] = {
|
||||
|
||||
static int initio_done;
|
||||
|
||||
static struct env env;
|
||||
struct env *e = &env;
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
@ -65,7 +68,6 @@ main(int argc, const char *argv[])
|
||||
struct block *l;
|
||||
int restricted, errexit;
|
||||
const char **wp;
|
||||
struct env env;
|
||||
pid_t ppid;
|
||||
struct tbl *vp;
|
||||
struct stat s_stdin;
|
||||
@ -88,10 +90,8 @@ main(int argc, const char *argv[])
|
||||
ainit(&aperm); /* initialise permanent Area */
|
||||
|
||||
/* set up base environment */
|
||||
memset(&env, 0, sizeof(env));
|
||||
env.type = E_NONE;
|
||||
ainit(&env.area);
|
||||
e = &env;
|
||||
newblock(); /* set up global l->vars and l->funs */
|
||||
|
||||
/* Do this first so output routines (eg, errorf, shellf) can work */
|
||||
|
6
sh.h
6
sh.h
@ -100,9 +100,9 @@
|
||||
#define __SCCSID(x) __IDSTRING(sccsid,x)
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.240 2008/10/13 23:06:03 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.241 2008/10/15 10:25:01 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R35 2008/10/13"
|
||||
#define MKSH_VERSION "R35 2008/10/15"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
@ -367,7 +367,7 @@ EXTERN Area aperm; /* permanent object space */
|
||||
/*
|
||||
* parsing & execution environment
|
||||
*/
|
||||
EXTERN struct env {
|
||||
extern struct env {
|
||||
Area area; /* temporary allocation area */
|
||||
struct block *loc; /* local variables and functions */
|
||||
short *savefd; /* original redirected fds */
|
||||
|
Loading…
Reference in New Issue
Block a user