diff options
author | ache <ache@FreeBSD.org> | 1997-04-02 03:53:49 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-04-02 03:53:49 +0000 |
commit | d3ec62f2fdf843c3ee2ec8bb675f8a2fa84ff734 (patch) | |
tree | 414f8324bec2e8922905160959aa17701c427e22 /lib/libutil/uucplock.c | |
parent | 3c64721fa7494c5d4170f9381313141a91458b8b (diff) | |
download | FreeBSD-src-d3ec62f2fdf843c3ee2ec8bb675f8a2fa84ff734.zip FreeBSD-src-d3ec62f2fdf843c3ee2ec8bb675f8a2fa84ff734.tar.gz |
Code space optimization in uu_lockerr()
Diffstat (limited to 'lib/libutil/uucplock.c')
-rw-r--r-- | lib/libutil/uucplock.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index f6af4d0..6c396f4 100644 --- a/lib/libutil/uucplock.c +++ b/lib/libutil/uucplock.c @@ -122,6 +122,7 @@ int uu_unlock (char *ttyname) char *uu_lockerr (int uu_lockresult) { static char errbuf[512]; + char *fmt; switch (uu_lockresult) { case UU_LOCK_INUSE: @@ -129,27 +130,23 @@ char *uu_lockerr (int uu_lockresult) case UU_LOCK_OK: return ""; case UU_LOCK_OPEN_ERR: - (void)snprintf(errbuf, sizeof(errbuf), - "open error: %s", strerror(errno)); + fmt = "open error: %s"; break; case UU_LOCK_READ_ERR: - (void)snprintf(errbuf, sizeof(errbuf), - "read error: %s", strerror(errno)); + fmt = "read error: %s"; break; case UU_LOCK_SEEK_ERR: - (void)snprintf(errbuf, sizeof(errbuf), - "seek error: %s", strerror(errno)); + fmt = "seek error: %s"; break; case UU_LOCK_WRITE_ERR: - (void)snprintf(errbuf, sizeof(errbuf), - "write error: %s", strerror(errno)); + fmt = "write error: %s"; break; default: - (void)snprintf(errbuf, sizeof(errbuf), - "undefined error: %s", strerror(errno)); + fmt = "undefined error: %s"; break; } + (void)snprintf(errbuf, sizeof(errbuf), fmt, strerror(errno)); return errbuf; } |