svn commit: r202665 - stable/8/lib/libc/stdio

Xin LI delphij at FreeBSD.org
Wed Jan 20 00:53:04 UTC 2010


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);
 }


More information about the svn-src-all mailing list