gcc sparc-sun-solaris2.8/3.4.3 warns about uninitialised usee of p
This commit is contained in:
parent
252a4b13cc
commit
d318187454
10
eval.c
10
eval.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.39 2008/02/27 12:49:53 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.40 2008/02/29 11:41:01 tg Exp $");
|
||||||
|
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
#define MKSH_NOPWNAM
|
#define MKSH_NOPWNAM
|
||||||
@ -1015,10 +1015,10 @@ trimsub(char *str, char *pat, int how)
|
|||||||
case '/'|0x80: /* replace all - SLOWER! */
|
case '/'|0x80: /* replace all - SLOWER! */
|
||||||
{
|
{
|
||||||
char *rpat, *rrep, *tpat1, *tpat2, *tpat0, *sbeg, *s, *d;
|
char *rpat, *rrep, *tpat1, *tpat2, *tpat0, *sbeg, *s, *d;
|
||||||
bool gotmatch = false;
|
|
||||||
|
|
||||||
/* separate search pattern and replacement string */
|
/* separate search pattern and replacement string */
|
||||||
s = d = rpat = str_save(pat, ATEMP);
|
s = d = rpat = str_save(pat, ATEMP);
|
||||||
|
rrep = null;
|
||||||
while ((c = *s++))
|
while ((c = *s++))
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
if (s[0] == '\\' && s[1] != '/')
|
if (s[0] == '\\' && s[1] != '/')
|
||||||
@ -1027,12 +1027,10 @@ trimsub(char *str, char *pat, int how)
|
|||||||
break;
|
break;
|
||||||
} else if (c == '/') {
|
} else if (c == '/') {
|
||||||
*d++ = '\0';
|
*d++ = '\0';
|
||||||
p = s;
|
rrep = s;
|
||||||
gotmatch = true;
|
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
*d++ = c;
|
*d++ = c;
|
||||||
rrep = gotmatch ? p : null;
|
|
||||||
/* do not accept empty pattern */
|
/* do not accept empty pattern */
|
||||||
if (!*rpat) {
|
if (!*rpat) {
|
||||||
afree(rpat, ATEMP);
|
afree(rpat, ATEMP);
|
||||||
@ -1078,6 +1076,8 @@ trimsub(char *str, char *pat, int how)
|
|||||||
p = end;
|
p = end;
|
||||||
if (*pat != '%')
|
if (*pat != '%')
|
||||||
while (p >= sbeg) {
|
while (p >= sbeg) {
|
||||||
|
bool gotmatch;
|
||||||
|
|
||||||
c = *p; *p = '\0';
|
c = *p; *p = '\0';
|
||||||
gotmatch = gmatchx(sbeg, tpat0, false);
|
gotmatch = gmatchx(sbeg, tpat0, false);
|
||||||
*p = c;
|
*p = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user