ksh/ksh93-uninitialized.dif
2013-10-18 11:11:03 +00:00

371 lines
11 KiB
Plaintext

--- src/cmd/builtin/pty.c
+++ src/cmd/builtin/pty.c 2013-10-10 11:38:40.722736462 +0000
@@ -503,7 +503,7 @@ masterline(Sfio_t* mp, Sfio_t* lp, char*
char* t;
ssize_t n;
ssize_t a;
- size_t promptlen;
+ size_t promptlen = 0;
ptrdiff_t d;
char promptbuf[64];
@@ -773,6 +773,8 @@ dialogue(Sfio_t* mp, Sfio_t* lp, int del
!(master->buf = vmnewof(vm, 0, char, 2 * SF_BUFSIZE, 0)))
{
error(ERROR_SYSTEM|2, "out of space");
+ id = 0;
+ line = 0;
goto done;
}
master->vm = vm;
--- src/cmd/ksh93/edit/edit.c
+++ src/cmd/ksh93/edit/edit.c 2013-09-16 13:04:37.000000000 +0000
@@ -1414,12 +1414,12 @@ int ed_internal(const char *src, genchar
int ed_external(const genchar *src, char *dest)
{
register genchar wc;
- register int c,size;
register char *dp = dest;
char *dpmax = dp+sizeof(genchar)*MAXLINE-2;
if((char*)src == dp)
{
- char buffer[MAXLINE*sizeof(genchar)];
+ int c;
+ char buffer[MAXLINE*sizeof(genchar)] = "";
c = ed_external(src,buffer);
#ifdef _lib_wcscpy
@@ -1431,6 +1431,7 @@ int ed_external(const genchar *src, char
}
while((wc = *src++) && dp<dpmax)
{
+ ssize_t size;
if((size = mbconv(dp, wc)) < 0)
{
/* copy the character as is */
--- src/cmd/ksh93/sh/init.c
+++ src/cmd/ksh93/sh/init.c 2013-10-10 10:44:39.762735998 +0000
@@ -1264,7 +1264,7 @@ Shell_t *sh_init(register int argc,regis
static int beenhere;
Shell_t *shp;
register int n;
- int type;
+ int type = 0;
static char *login_files[3];
memfatal();
n = strlen(e_version);
@@ -1943,7 +1943,7 @@ static Dt_t *inittree(Shell_t *shp,const
register const struct shtable2 *tp;
register unsigned n = 0;
register Dt_t *treep;
- Dt_t *base_treep, *dict;
+ Dt_t *base_treep, *dict = 0;
for(tp=name_vals;*tp->sh_name;tp++)
n++;
np = (Namval_t*)calloc(n,sizeof(Namval_t));
--- src/cmd/ksh93/sh/macro.c
+++ src/cmd/ksh93/sh/macro.c 2013-10-18 09:26:43.677203216 +0200
@@ -1794,7 +1794,7 @@ retry2:
register int d = (mode=='@'?' ':mp->ifs);
regoff_t match[2*(MATCH_MAX+1)];
int nmatch, nmatch_prev, vsize_last;
- char *vlast;
+ char *vlast=NULL;
while(1)
{
if(!v)
--- src/cmd/ksh93/sh/name.c
+++ src/cmd/ksh93/sh/name.c 2013-10-10 12:41:07.278235928 +0000
@@ -1354,7 +1354,7 @@ Namval_t *nv_open(const char *name, Dt_t
const char *msg = e_varname;
char *fname = 0;
int offset = staktell();
- Dt_t *funroot;
+ Dt_t *funroot = NIL(Dt_t*);
#if NVCACHE
struct Cache_entry *xp;
#endif
@@ -1830,7 +1830,7 @@ void nv_putval(register Namval_t *np, co
else
{
const char *tofree=0;
- int offset,append;
+ int offset=0,append;
#if _lib_pathnative
char buff[PATH_MAX];
#endif /* _lib_pathnative */
--- src/cmd/ksh93/sh/nvdisc.c
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-10 10:28:44.682236529 +0000
@@ -449,7 +449,7 @@ static Sfdouble_t lookupn(Namval_t *np,
char *nv_setdisc(register Namval_t* np,register const char *event,Namval_t *action,register Namfun_t *fp)
{
register struct vardisc *vp = (struct vardisc*)np->nvfun;
- register int type;
+ register int type = -1;
char *empty = "";
while(vp)
{
@@ -505,6 +505,8 @@ char *nv_setdisc(register Namval_t* np,r
}
return(NIL(char*));
}
+ if (type < 0)
+ return(NIL(char*));
/* Handle GET/SET/APPEND/UNSET disc */
if(vp && vp->fun.disc->putval!=assign)
vp = 0;
--- src/cmd/ksh93/sh/nvtree.c
+++ src/cmd/ksh93/sh/nvtree.c 2013-10-10 10:47:16.246316669 +0000
@@ -146,7 +146,7 @@ void *nv_diropen(Namval_t *np,const char
{
const char *last;
char *next;
- size_t c,len=strlen(name);
+ size_t c=0,len=strlen(name);
struct nvdir *save, *dp = new_of(struct nvdir,len+1);
Namval_t *nq=0,fake;
Namfun_t *nfp=0;
@@ -586,7 +586,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
char *fmtq,*ep,*xp;
Namval_t *mp;
Namarr_t *ap = nv_arrayptr(np);
- int scan,tabs=0,c,more,associative = 0;
+ int scan=0,tabs=0,c,more,associative = 0;
int saveI = Indent;
Indent = indent;
if(ap)
@@ -699,7 +699,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
static void outval(char *name, const char *vname, struct Walk *wp)
{
- register Namval_t *np, *nq, *last_table=wp->shp->last_table;
+ register Namval_t *np, *nq=0, *last_table=wp->shp->last_table;
register Namfun_t *fp;
int isarray=0, special=0,mode=0;
if(*name!='.' || vname[strlen(vname)-1]==']')
--- src/cmd/ksh93/sh/nvtype.c
+++ src/cmd/ksh93/sh/nvtype.c 2013-10-10 12:33:08.394735609 +0000
@@ -854,9 +854,10 @@ void nv_newtype(Namval_t *mp)
Namval_t *nv_mktype(Namval_t **nodes, int numnodes)
{
Namval_t *mp=nodes[0], *bp=0, *np, *nq, **mnodes=nodes;
- int i,j,k,m,n,nd=0,nref=0,iref=0,inherit=0;
+ int i,j,k,nd=0,nref=0,iref=0,inherit=0;
int size=sizeof(NV_DATA), dsize=0, nnodes;
- size_t offset=0;
+ size_t offset=0,m;
+ ssize_t n;
char *name=0, *cp, *sp, **help;
Namtype_t *pp,*qp=0,*dp,*tp;
Dt_t *root = nv_dict(mp);
@@ -869,6 +870,7 @@ Namval_t *nv_mktype(Namval_t **nodes, in
_nv_unset(nodes[0],NV_RDONLY);
errormsg(SH_DICT,ERROR_exit(1),e_badtypedef,cp);
}
+ n=strlen(nodes[1]->nvname);
for(nnodes=1,i=1; i <numnodes; i++)
{
np=nodes[i];
@@ -1101,7 +1102,6 @@ Namval_t *nv_mktype(Namval_t **nodes, in
nv_disc(nq, &pp->childfun.fun, NV_LAST);
if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc))
tp->strsize = -tp->strsize;
-else sfprintf(sfstderr,"tp==NULL\n");
for(r=0; r < dp->numnodes; r++)
{
Namval_t *nr = nv_namptr(dp->nodes,r);
--- src/cmd/ksh93/sh/parse.c
+++ src/cmd/ksh93/sh/parse.c 2013-10-10 12:48:37.786235751 +0000
@@ -301,7 +301,7 @@ static Shnode_t *getanode(Lex_t *lp, str
*/
static Shnode_t *makelist(Lex_t *lexp, int type, Shnode_t *l, Shnode_t *r)
{
- register Shnode_t *t;
+ register Shnode_t *t = NIL(Shnode_t*);
if(!l || !r)
sh_syntax(lexp);
else
@@ -742,7 +742,7 @@ static Shnode_t *funct(Lex_t *lexp)
register Shnode_t *t;
register int flag;
struct slnod *volatile slp=0;
- Stak_t *savstak;
+ Stak_t *savstak = NIL(Stak_t*);
Sfoff_t first, last;
struct functnod *volatile fp;
Sfio_t *iop;
@@ -815,7 +815,7 @@ static Shnode_t *funct(Lex_t *lexp)
{
struct comnod *ac;
char *cp, **argv, **argv0;
- int c;
+ int c=-1;
t->funct.functargs = ac = (struct comnod*)simple(lexp,SH_NOIO|SH_FUNDEF,NIL(struct ionod*));
if(ac->comset || (ac->comtyp&COMSCAN))
errormsg(SH_DICT,ERROR_exit(3),e_lexsyntax4,lexp->sh->inlineno);
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2013-10-10 11:14:41.530735559 +0000
@@ -1505,7 +1505,7 @@ int sh_exec(register const Shnode_t *t,
Namval_t node;
#endif /* SHOPT_NAMESPACE */
struct Namref nr;
- long mode;
+ long mode = 0;
register struct slnod *slp;
if(!np->nvalue.ip)
{
@@ -1910,8 +1910,8 @@ int sh_exec(register const Shnode_t *t,
* don't create a new process, just
* save and restore io-streams
*/
- pid_t pid;
- int jmpval, waitall;
+ pid_t pid = 0;
+ int jmpval, waitall = 0;
int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM;
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
#if SHOPT_COSHELL
@@ -2403,7 +2403,7 @@ int sh_exec(register const Shnode_t *t,
Shnode_t *tt = t->wh.whtre;
#if SHOPT_FILESCAN
Sfio_t *iop=0;
- int savein;
+ int savein=-1;
#endif /*SHOPT_FILESCAN*/
#if SHOPT_OPTIMIZE
int jmpval = ((struct checkpt*)shp->jmplist)->mode;
@@ -2872,7 +2872,7 @@ int sh_exec(register const Shnode_t *t,
else
{
register int traceon=0;
- register char *right;
+ register char *right = 0;
register char *trap;
char *argv[6];
n = type>>TSHIFT;
@@ -2906,7 +2906,7 @@ int sh_exec(register const Shnode_t *t,
}
else if(type&TBINARY)
{
- char *op;
+ char *op = 0;
int pattern = 0;
if(trap || traceon)
op = (char*)(shtab_testops+(n&037)-1)->sh_name;
@@ -3371,7 +3371,7 @@ int sh_funscope(int argn, char *argv[],i
int jmpval;
volatile int r = 0;
int n;
- char *savstak;
+ char *savstak = 0;
struct funenv *fp = 0;
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
Namval_t *nspace = shp->namespace;
@@ -3487,10 +3487,10 @@ int sh_funscope(int argn, char *argv[],i
shp->st = *prevscope;
shp->topscope = (Shscope_t*)prevscope;
nv_getval(sh_scoped(shp,IFSNOD));
- if(nsig)
+ if(nsig && savstak)
memcpy((char*)&shp->st.trapcom[0],savstak,nsig);
shp->trapnote=0;
- if(nsig)
+ if(nsig && savstak)
stakset(savstak,0);
shp->options = options;
shp->last_root = last_root;
@@ -3579,11 +3579,11 @@ static void sh_funct(Shell_t *shp,Namval
int sh_fun(Namval_t *np, Namval_t *nq, char *argv[])
{
Shell_t *shp = sh_getinterp();
- register int offset;
+ register int offset = 0;
register char *base;
Namval_t node;
struct Namref nr;
- long mode;
+ long mode = 0;
char *prefix = shp->prefix;
int n=0;
char *av[3];
--- src/lib/libast/sfio/sfstrtof.h
+++ src/lib/libast/sfio/sfstrtof.h 2013-10-10 10:03:43.826235847 +0000
@@ -211,8 +211,8 @@ S2F_function(str, end) char* str; char**
int decimal = 0;
int thousand = 0;
int part = 0;
- int back_part;
- S2F_batch back_n;
+ int back_part = 0;
+ S2F_batch back_n = 0;
S2F_number v;
S2F_number p;
S2F_part_t parts[16];
--- src/lib/libast/sfio/sftable.c
+++ src/lib/libast/sfio/sftable.c 2013-10-10 10:08:26.026235628 +0000
@@ -53,7 +53,7 @@ int type; /* >0: scanf, =0: printf, -1:
#endif
{
int base, fmt, flags, dot, width, precis;
- ssize_t n_str, size;
+ ssize_t n_str, size = 0;
char *t_str, *sp;
int v, n, skip, dollar, decimal, thousand;
Sffmt_t savft;
--- src/lib/libast/sfio/sfvprintf.c
+++ src/lib/libast/sfio/sfvprintf.c 2013-10-10 10:12:04.314277467 +0000
@@ -101,7 +101,7 @@ char* form; /* format to use */
va_list args; /* arg list if !argf */
#endif
{
- int n, v, w, k, n_s, base, fmt, flags;
+ int n, v=0, w, k, n_s, base, fmt, flags;
Sflong_t lv;
char *sp, *ssp, *endsp, *ep, *endep;
int dot, width, precis, sign, decpt;
@@ -129,7 +129,7 @@ va_list args; /* arg list if !argf */
int decimal = 0, thousand = 0;
#if _has_multibyte
- wchar_t* wsp;
+ wchar_t* wsp = 0;
SFMBDCL(fmbs) /* state of format string */
SFMBDCL(mbs) /* state of some string */
#ifdef mbwidth
--- src/lib/libast/string/stropt.c
+++ src/lib/libast/string/stropt.c 2013-10-10 10:01:38.546735312 +0000
@@ -60,13 +60,13 @@ stropt(const char* as, const void* tab,
register char* v;
register char* t;
char** p;
- char* u;
+ char* u = 0;
char* x;
char* e;
int n;
int ql;
int qr;
- int qc;
+ int qc = 0;
if (!as) n = 0;
else if (!(x = s = strdup(as))) n = -1;
--- src/lib/libast/string/strtoi.h
+++ src/lib/libast/string/strtoi.h 2013-10-10 10:06:02.038735810 +0000
@@ -230,13 +230,13 @@ S2I_function(a, e, base) const char* a;
#endif
register S2I_unumber n;
register S2I_unumber x;
- register int c;
+ register int c = 0;
register int shift;
register unsigned char* p;
register unsigned char* cv;
unsigned char* b;
unsigned char* k;
- S2I_unumber v;
+ S2I_unumber v = 0;
#if S2I_multiplier
register int base;
#endif