optimise away code for a case that’s almost unlikely to happen; fix pasto(?)
This commit is contained in:
parent
e0e63c65e6
commit
5401a55a98
28
exec.c
28
exec.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.175 2016/06/26 00:44:58 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.176 2016/07/24 23:07:19 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
||||
@ -715,39 +715,33 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap,
|
||||
struct tbl *ftp;
|
||||
|
||||
if (!tp->u.fpath) {
|
||||
fpath_error:
|
||||
rv = (tp->u2.errnov == ENOENT) ? 127 : 126;
|
||||
warningf(true, "%s: %s %s: %s", cp,
|
||||
"can't find", "function definition file",
|
||||
cstrerror(tp->u2.errnov));
|
||||
break;
|
||||
}
|
||||
if (include(tp->u.fpath, 0, NULL, false) < 0) {
|
||||
errno = 0;
|
||||
if (include(tp->u.fpath, 0, NULL, false) < 0 ||
|
||||
!(ftp = findfunc(cp, hash(cp), false)) ||
|
||||
!(ftp->flag & ISSET)) {
|
||||
rv = errno;
|
||||
if (!strcmp(cp, Tcat)) {
|
||||
no_cat_in_FPATH:
|
||||
tp = findcom(Tcat, FC_BI);
|
||||
goto do_call_builtin;
|
||||
}
|
||||
#ifdef MKSH_PRINTF_BUILTIN
|
||||
if (!strcmp(cp, Tprintf)) {
|
||||
no_printf_in_FPATH:
|
||||
tp = findcom(Tprintf, FC_BI);
|
||||
goto do_call_builtin;
|
||||
}
|
||||
#endif
|
||||
warningf(true, "%s: %s %s %s: %s", cp,
|
||||
"can't open", "function definition file",
|
||||
tp->u.fpath, cstrerror(errno));
|
||||
rv = 127;
|
||||
break;
|
||||
if (rv) {
|
||||
tp->u2.errnov = rv;
|
||||
cp = tp->u.fpath;
|
||||
goto fpath_error;
|
||||
}
|
||||
if (!(ftp = findfunc(cp, hash(cp), false)) ||
|
||||
!(ftp->flag & ISSET)) {
|
||||
if (!strcmp(cp, Tcat))
|
||||
goto no_cat_in_FPATH;
|
||||
#ifdef MKSH_PRINTF_BUILTIN
|
||||
if (!strcmp(cp, Tprintf))
|
||||
goto no_printf_in_FPATH;
|
||||
#endif
|
||||
warningf(true, "%s: %s %s", cp,
|
||||
"function not defined by", tp->u.fpath);
|
||||
rv = 127;
|
||||
|
4
shf.c
4
shf.c
@ -25,7 +25,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.74 2016/05/17 15:36:35 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.75 2016/07/24 23:07:19 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@ -457,7 +457,7 @@ shf_read(char *buf, ssize_t bsize, struct shf *shf)
|
||||
(unsigned int)shf->flags);
|
||||
|
||||
if (bsize <= 0)
|
||||
internal_errorf("%s: %s %zd", "shf_write", "bsize", bsize);
|
||||
internal_errorf("%s: %s %zd", "shf_read", "bsize", bsize);
|
||||
|
||||
while (bsize > 0) {
|
||||
if (shf->rnleft == 0 &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user