Date: Wed, 20 Jan 2010 00:53:03 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r202665 - stable/8/lib/libc/stdio Message-ID: <201001200053.o0K0r30I057648@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed Jan 20 00:53:03 2010 New Revision: 202665 URL: http://svn.freebsd.org/changeset/base/202665 Log: MFC r200800: Use vsscanf instead of rolling our own. PR: bin/140530 Submitted by: Jeremy Huddleston <jeremyhu apple.com> Modified: stable/8/lib/libc/stdio/sscanf.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/stdio/sscanf.c ============================================================================== --- stable/8/lib/libc/stdio/sscanf.c Wed Jan 20 00:52:24 2010 (r202664) +++ stable/8/lib/libc/stdio/sscanf.c Wed Jan 20 00:53:03 2010 (r202665) @@ -41,37 +41,14 @@ __FBSDID("$FreeBSD$"); #include <stdarg.h> #include "local.h" -static int eofread(void *, char *, int); - -/* ARGSUSED */ -static int -eofread(cookie, buf, len) - void *cookie; - char *buf; - int len; -{ - - return (0); -} - int sscanf(const char * __restrict str, char const * __restrict fmt, ...) { int ret; va_list ap; - FILE f; - f._file = -1; - f._flags = __SRD; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._r = strlen(str); - f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); va_start(ap, fmt); - ret = __svfscanf(&f, fmt, ap); + ret = vsscanf(str, fmt, ap); va_end(ap); return (ret); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001200053.o0K0r30I057648>