summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vsscanf.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-04-30 09:25:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-04-30 09:25:18 +0000
commit006b4fb4beb661aede245ab8e1f4f75c37dad597 (patch)
tree97e4bb5acd39a2bc79bd17b982a09eb227504b7c /lib/libc/stdio/vsscanf.c
parent86c423fca9e4df63c5cfd487e548f449d681361f (diff)
Change internals of FILE: reuse the unget buffer field to access an
extended attribute data structure (pimpl idiom). Idea taken from citrus. Much discussion with deraadt@, otto@, millert@... This is the least disruptive way to extend FILE, since its size can't really change without this being a flag day. So the size doesn't change. Actual additions to the structure will come in separate steps, since this change is nasty enough on its own. Tests by otto@ and others, careful reading of code by otto@ and millert@. This is definitely a major bump, and has been checked to not impact a full ports build.
Diffstat (limited to 'lib/libc/stdio/vsscanf.c')
-rw-r--r--lib/libc/stdio/vsscanf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c
index a2c4da98626..34b54cb7dea 100644
--- a/lib/libc/stdio/vsscanf.c
+++ b/lib/libc/stdio/vsscanf.c
@@ -31,11 +31,12 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: vsscanf.c,v 1.6 2004/09/28 18:12:44 otto Exp $";
+static char rcsid[] = "$OpenBSD: vsscanf.c,v 1.7 2005/04/30 09:25:17 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <string.h>
+#include "local.h"
/* ARGSUSED */
static int
@@ -49,12 +50,14 @@ int
vsscanf(const char *str, const char *fmt, _BSD_VA_LIST_ ap)
{
FILE f;
+ struct __sfileext fext;
+ _FILEEXT_SETUP(&f, &fext);
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;
+ _UB(&f)._base = NULL;
f._lb._base = NULL;
return (__svfscanf(&f, fmt, ap));
}