Code space optimization in uu_lockerr()

This commit is contained in:
Andrey A. Chernov 1997-04-02 03:53:49 +00:00
parent 2875419215
commit 81d9597ce7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24530

View File

@ -122,6 +122,7 @@ int uu_unlock (char *ttyname)
char *uu_lockerr (int uu_lockresult) char *uu_lockerr (int uu_lockresult)
{ {
static char errbuf[512]; static char errbuf[512];
char *fmt;
switch (uu_lockresult) { switch (uu_lockresult) {
case UU_LOCK_INUSE: case UU_LOCK_INUSE:
@ -129,27 +130,23 @@ char *uu_lockerr (int uu_lockresult)
case UU_LOCK_OK: case UU_LOCK_OK:
return ""; return "";
case UU_LOCK_OPEN_ERR: case UU_LOCK_OPEN_ERR:
(void)snprintf(errbuf, sizeof(errbuf), fmt = "open error: %s";
"open error: %s", strerror(errno));
break; break;
case UU_LOCK_READ_ERR: case UU_LOCK_READ_ERR:
(void)snprintf(errbuf, sizeof(errbuf), fmt = "read error: %s";
"read error: %s", strerror(errno));
break; break;
case UU_LOCK_SEEK_ERR: case UU_LOCK_SEEK_ERR:
(void)snprintf(errbuf, sizeof(errbuf), fmt = "seek error: %s";
"seek error: %s", strerror(errno));
break; break;
case UU_LOCK_WRITE_ERR: case UU_LOCK_WRITE_ERR:
(void)snprintf(errbuf, sizeof(errbuf), fmt = "write error: %s";
"write error: %s", strerror(errno));
break; break;
default: default:
(void)snprintf(errbuf, sizeof(errbuf), fmt = "undefined error: %s";
"undefined error: %s", strerror(errno));
break; break;
} }
(void)snprintf(errbuf, sizeof(errbuf), fmt, strerror(errno));
return errbuf; return errbuf;
} }