Date: Wed, 24 Dec 1997 12:24:10 -0800 (PST) From: "Andrey A. Chernov" <ache@FreeBSD.ORG> To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-lib@FreeBSD.ORG Subject: cvs commit: src/lib/libc/stdio snprintf.c vsnprintf.c Message-ID: <199712242024.MAA07753@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
ache 1997/12/24 12:24:10 PST Modified files: lib/libc/stdio snprintf.c vsnprintf.c Log: 1) Oops! Insert again if (n == 0) return 0. Final word is Bruce's quote: C9x specifies the BSD4.4-Lite behaviour: [#3] ... Thus, the null-terminated output has been completely written if and only if the returned value is less than n. It means that if we not have any null-terminated output as for n == 0 we can't return value less than n, so we forced to return value equal to n i.e. 0 The next good thing is glibc compatibility, of course. 2) Do check for too big n in machine-independent way. 3) Minor optimization assuming EOF is < 0 Revision Changes Path 1.8 +5 -5 src/lib/libc/stdio/snprintf.c 1.8 +5 -5 src/lib/libc/stdio/vsnprintf.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712242024.MAA07753>