printf-pos.c (113194) | printf-pos.c (113196) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/lib/libc/stdio/vfprintf.c 113194 2003-04-07 01:07:48Z das $"); | 41__FBSDID("$FreeBSD: head/lib/libc/stdio/vfprintf.c 113196 2003-04-07 03:17:39Z ache $"); |
42 43/* 44 * Actual printf innards. 45 * 46 * This code is large and complicated... 47 */ 48 49#include "namespace.h" --- 329 unchanged lines hidden (view full) --- 379 p = wcsarg; 380 memset(&mbs, 0, sizeof(mbs)); 381 while (mbp - convbuf < nbytes) { 382 clen = wcrtomb(mbp, *p++, &mbs); 383 if (clen == 0 || clen == (size_t)-1) 384 break; 385 mbp += clen; 386 } | 42 43/* 44 * Actual printf innards. 45 * 46 * This code is large and complicated... 47 */ 48 49#include "namespace.h" --- 329 unchanged lines hidden (view full) --- 379 p = wcsarg; 380 memset(&mbs, 0, sizeof(mbs)); 381 while (mbp - convbuf < nbytes) { 382 clen = wcrtomb(mbp, *p++, &mbs); 383 if (clen == 0 || clen == (size_t)-1) 384 break; 385 mbp += clen; 386 } |
387 *mbp = '\0'; 388 if (clen == (size_t)-1) | 387 if (clen == (size_t)-1) { 388 free(convbuf); |
389 return (NULL); | 389 return (NULL); |
390 } 391 *mbp = '\0'; |
|
390 391 return (convbuf); 392} 393 394/* 395 * MT-safe version 396 */ 397int --- 1231 unchanged lines hidden --- | 392 393 return (convbuf); 394} 395 396/* 397 * MT-safe version 398 */ 399int --- 1231 unchanged lines hidden --- |