sh: Prefer "" to nullstr where possible.

This commit is contained in:
Jilles Tjoelker 2015-02-15 21:47:43 +00:00
parent cec1a873d7
commit 781bfb5a53
8 changed files with 8 additions and 9 deletions

View File

@ -122,7 +122,7 @@ cdcmd(int argc __unused, char **argv __unused)
(dest[0] == '.' && (dest[1] == '/' || dest[1] == '\0')) ||
(dest[0] == '.' && dest[1] == '.' && (dest[2] == '/' || dest[2] == '\0')) ||
(path = bltinlookup("CDPATH", 1)) == NULL)
path = nullstr;
path = "";
while ((p = padvance(&path, dest)) != NULL) {
if (stat(p, &statb) < 0) {
if (errno != ENOENT)

View File

@ -498,7 +498,7 @@ exphere(union node *redir, struct arglist *fn)
struct localvar *savelocalvars;
int need_longjmp = 0;
redir->nhere.expdoc = nullstr;
redir->nhere.expdoc = "";
savelocalvars = localvars;
localvars = NULL;
forcelocal++;

View File

@ -530,8 +530,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc,
error((char *)NULL);
}
error("%.*s: parameter %snot set", (int)(p - str - 1),
str, (varflags & VSNUL) ? "null or "
: nullstr);
str, (varflags & VSNUL) ? "null or " : "");
return 0;
case VSTRIMLEFT:

View File

@ -85,7 +85,7 @@ chkmail(int silent)
setstackmark(&smark);
mpath = mpathset()? mpathval() : mailval();
for (i = 0 ; i < nmboxes ; i++) {
p = padvance(&mpath, nullstr);
p = padvance(&mpath, "");
if (p == NULL)
break;
if (*p == '\0')

View File

@ -265,7 +265,7 @@ readcmd(int argc __unused, char **argv __unused)
/* Set any remaining args to "" */
while (*++ap != NULL)
setvar(*ap, nullstr, 0);
setvar(*ap, "", 0);
return status;
}

View File

@ -138,7 +138,7 @@ NXHERE nhere # fd<<!
fd int # file descriptor being redirected
next nodeptr # next redirection in list
doc nodeptr # input to command (NARG node)
expdoc temp char *expdoc # actual document (for NXHERE)
expdoc temp const char *expdoc # actual document (for NXHERE)
NNOT nnot # ! command (actually pipeline)
type int

View File

@ -1940,7 +1940,7 @@ getprompt(void *unused __unused)
*/
switch (whichprompt) {
case 0:
fmt = nullstr;
fmt = "";
break;
case 1:
fmt = ps1val();

View File

@ -872,7 +872,7 @@ unsetvar(const char *s)
if (vp->flags & VREADONLY)
return (1);
if (vp->text[vp->name_len + 1] != '\0')
setvar(s, nullstr, 0);
setvar(s, "", 0);
if ((vp->flags & VEXPORT) && localevar(vp->text)) {
change_env(s, 0);
setlocale(LC_ALL, "");