svn commit: r200800 - head/lib/libc/stdio

Xin LI delphij at FreeBSD.org
Mon Dec 21 19:56:03 UTC 2009


Author: delphij
Date: Mon Dec 21 19:56:03 2009
New Revision: 200800
URL: http://svn.freebsd.org/changeset/base/200800

Log:
  Use vsscanf instead of rolling our own.
  
  PR:		bin/140530
  Submitted by:	Jeremy Huddleston <jeremyhu apple.com>
  MFC after:	1 month

Modified:
  head/lib/libc/stdio/sscanf.c

Modified: head/lib/libc/stdio/sscanf.c
==============================================================================
--- head/lib/libc/stdio/sscanf.c	Mon Dec 21 19:55:05 2009	(r200799)
+++ head/lib/libc/stdio/sscanf.c	Mon Dec 21 19:56:03 2009	(r200800)
@@ -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