summaryrefslogtreecommitdiff
path: root/libc/stdio/_scanf.c
AgeCommit message (Collapse)Author
2015-12-17libc/stdio: Rework custom streams interface similar to glibc.Waldemar Brodkorb
Save 20 bytes per FILE structure, avoid indirect call for read/write/seek/close operations for normal streams. Additionally, custom streams has fileno = -2 now, like in glibc. bloat-o-meter report (UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y): function old new delta fopencookie 69 131 +62 ftello64 233 260 +27 fseeko64 298 319 +21 fclose 423 442 +19 .rodata 16696 16708 +12 fileno_unlocked 53 45 -8 __ns_name_pack 859 851 -8 vswscanf 184 144 -40 vdprintf 231 187 -44 vsscanf 210 151 -59 vswprintf 269 201 -68 vsnprintf 249 181 -68 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/7 up/down: 141/-295) Total: -154 bytes Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2015-06-10_scanf.c: Implement 'm' modifier for 'c' and '[' conversions.Will Newton
The current code implements the 'm' modifier only for 's' conversions and would cause a segfault if it was used for 'c' or '[' conversions. This patch extends the code to cover these cases too. The original version could write scanned data outside the passed buffer because index i used in the '[' conversion handling block was clobbered. Signed-off-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-01I think this is what you meanThorsten Glaser
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
2015-01-01silence GCCThorsten Glaser
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
2013-03-29Revert "_scanf.c: Implement 'm' modifier for 'c' and '[' conversions."Bernhard Reutner-Fischer
This reverts commit e567c399ff86d007d8c4586f0dd5e0ca61e283ca. since it breaks badly (e.g. busybox netstat) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-22Fix a problem with scanning wide chars.Nathan Sidwell
We found that the testcase int main (void) { wchar_t s[10]; memset (s, 0, sizeof (s)); int r = sscanf ("s", "%ls", s); printf ("%d\n", r); printf ("%ls\n", s); return 0; } printed 0 <blankline> rather than the expected 1 s The problem was the enum in _scanf.c, which has had a 'CONV_m' value inserted. The attached patch fixes the problem in __psfs_parse_spec by not presuming a particular displacement between the two sets of char-like conversion values. With this patch the above program produces the expected output. Signed-off-by: Nathan Sidwell <nathan@codesourcery.com> Signed-off-by: Bernd Schmidt <bernds@codesourcery.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-10-31_scanf.c: Implement 'm' modifier for 'c' and '[' conversions.Will Newton
The current code implements the 'm' modifier only for 's' conversions and would cause a segfault if it was used for 'c' or '[' conversions. This patch extends the code to cover these cases too. Signed-off-by: Will Newton <will.newton@imgtec.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15_scanf.c: fix to signedness warningsPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15_stdio.h: move _load_inttype.h and _store_inttype.h prototypes herePeter S. Mazinger
Use one common prototype for consistency. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15do not define _ISOC99_SOURCE in specific filesPeter S. Mazinger
This should come properly from features.h or the build. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-05-21stdio: implement assignment-allocation "m" characterMike Frysinger
The latest POSIX spec introduces a "m" character to allocate buffers for the user when using scanf type functions. This is like the old glibc "a" flag, but now standardized. With packages starting to use these, we need to implement it. for example: char *s; sscanf("foo", "%ms", &s); printf("%s\n", s); free(s); This will automatically allocate storage for "s", read in "foo" to it, and then display it. I'm not terribly familiar with the stdio layer, so this could be wrong. But it seems to work for me. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-09remove unused hidden functionsPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-01-21stdio: fix diagnostic messageBernhard Reutner-Fischer
harmless copy'n paste error in #error Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-01-11__psfs_parse_spec: always use long int for %pBernhard Reutner-Fischer
closes bug #3037 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-17rework internal uClibc mutexes to support futex locking, and nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-09-18convert // comments to /**/; remove empty #if/#endif pairs. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-18trim Experimentally off and uncommented hiddenBernhard Reutner-Fischer
sed -i -e '/Experimentally off - /d' $(grep -rl "Experimentally off - " *) sed -i -e '/^\/\*[[:space:]]*libc_hidden_proto(/d' $(grep -rl "libc_hidden_proto" *) should be a nop Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-01-21*: remove __UCLIBC_CURLOCALE_DATA, __UCLIBC_CURLOCALE_DATA.xDenis Vlasenko
is always equivalent to __UCLIBC_CURLOCALE->x. remove typedef __uclibc_locale_t, it used only in a few places, it is lees confusing to use struct __uclibc_locale_struct everywhere. xlocale.h: hide __global_locale back under _LIBC, bug 53 is wrong in claiming it should be exported. Also hide under _LIBC: extern __locale_t __curlocale_var; extern __locale_t __curlocale(void); extern __locale_t __curlocale_set(__locale_t newloc); # define __UCLIBC_CURLOCALE # define __XL_NPP(N) # define __LOCALE_PARAM # define __LOCALE_ARG # define __LOCALE_PTR
2008-12-21more of warning fixes, mostly pointer signedness mismatchesDenis Vlasenko
2008-12-20libc/stdio/_scanf.c: heed lots of warnings about signed/unsigned charsDenis Vlasenko
and such; remove two unneeded static string (inline "str" works better code-size wise).
2008-11-20Last portion of libc_hidden_proto removal.Denis Vlasenko
Appears to build fine (several .configs tried)
2008-11-18libc_hidden_proto removal, a few more functionsDenis Vlasenko
2008-09-09Fix some locale multibyte tests failures ad below:Carmelo Amoroso
libc/stdlib/_strtod.c -> tst_wcstod; libc/stdlib/stdlib.c -> tst_mblen, tst_mbtowc, tst_wctomb; libc/stdio/_scanf.c -> tst_swscanf; libc/string/strncmp.c -> tst_wcsncmp; libc/misc/wchar/wchar.c -> tst_mbrlen, tst_mbrtowc, tst_wcswidth. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2008-05-30- Avoid warning about undefined preprocessor token. No obj-code changes.Bernhard Reutner-Fischer
2008-05-23- avoid warning about cast from pointer to integer of different sizeBernhard Reutner-Fischer
2008-05-19Moving libc_hidden_proto's into #ifdef UCLIBC_INTERNAL blockDenis Vlasenko
in string.h and strings.h. This caught unguarded string ops in libc/inet/ethers.c __ether_line_w() function. I will wait for fallout reports for a week or so, then continue converting more libc_hidden_proto's.
2008-01-05patch from Hans-Christian Egtvedt to silence some spurious signed warningsMike Frysinger
2007-01-20- Trim superfluous trailing whitespace. No obj-code changes.Bernhard Reutner-Fischer
2006-03-22Correct build if UCLIBC_HAS_CTYPE_TABLES is not definedPeter S. Mazinger
2006-03-10Remove all non-constant libc_hidden_data_def(), it is too unreliable, sorry, ↵Peter S. Mazinger
most of global data relocations are back
2006-02-13More renames for IMAPeter S. Mazinger