Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 2009 19:56:03 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200800 - head/lib/libc/stdio
Message-ID:  <200912211956.nBLJu3U2038849@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912211956.nBLJu3U2038849>