summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ungetwc.c
Commit message (Collapse)AuthorAgeFilesLines
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-251-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* Make stdio deferred cancel-safe.Konstantin Belousov2017-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | If used with fopen(3)/fdopen(3)-ed FILEs, stdio accurately uses non-cancellable internal versions of the functions, i.e. it seems to be fine with regard to cancellation. But if the funopen(3) and f{r,w}open(3) functions were used to open the FILE, and corresponding user functions create cancellation points (they typically have no other choice), then stdio code at least leaks FILE' lock. The change installs cleanup handler which unlocks FILE. Some minimal restructuring of the code was required to make it use common return place to satisfy hand-rolled pthread_cleanup_pop() requirements. Noted by: eugen Reviewed by: eugen, vangyzen Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D11246 Notes: svn path=/head/; revision=320472
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds aDavid Chisnall2011-11-201-4/+17
| | | | | | | | | | | | | | | load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor) Notes: svn path=/head/; revision=227753
* Next stage of stdio cleanup: Retire __sFILEX and merge the fields back intoJohn Baldwin2008-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | __sFILE. This was supposed to be done in 6.0. Some notes: - Where possible I restored the various lines to their pre-__sFILEX state. - Retire INITEXTRA() and just initialize the wchar bits (orientation and mbstate) explicitly instead. The various places that used INITEXTRA didn't need the locking fields or _up initialized. (Some places needed _up to exist and not be off the end of a NULL or garbage pointer, but they didn't require it to be initialized to a specific value.) - For now, stdio.h "knows" that pthread_t is a 'struct pthread *' to avoid namespace pollution of including all the pthread types in stdio.h. Once we remove all the inlines and make __sFILE private it can go back to using pthread_t, etc. - This does not remove any of the inlines currently and does not change any of the public ABI of 'FILE'. MFC after: 1 month Reviewed by: peter Notes: svn path=/head/; revision=178287
* Include <sys/types.h> and <limits.h> ourselves, don't assume they are includedStefan Farfeleder2005-08-201-0/+1
| | | | | | | | | | | | | through <pthread.h>. gen/sem.c: Prerequisite for <_semaphore.h> net/getprotoent.c: USHRT_MAX net/getservent.c: USHRT_MAX stdio/ungetwc.c: MB_LEN_MAX stdio/vfwscanf.c: MB_LEN_MAX Notes: svn path=/head/; revision=149313
* Call __mbrtowc() and __wcrtomb() directly instead of taking detoursTim J. Robbins2004-07-201-1/+2
| | | | | | | through mbrtowc() and wcrtomb(). Notes: svn path=/head/; revision=132442
* Associate a multibyte conversion state object with each stream. Reset itTim J. Robbins2004-05-221-5/+2
| | | | | | | | | | | | to the initial state when a stream is opened or seeked upon. Use the stream's conversion state object instead of a freshly-zeroed one in fgetwc(), fputwc() and ungetwc(). This is only a performance improvement for now, but it would also be required in order to support state-dependent encodings. Notes: svn path=/head/; revision=129583
* Prepare to handle trivial state-dependent encodings. Full support forTim J. Robbins2004-04-071-1/+4
| | | | | | | | state-dependent encodings with locking shifts will come later if there is demand for it. Notes: svn path=/head/; revision=128002
* Pass mbrtowc() and wcrtomb() NULL instead of a pointer to a freshly zeroedTim J. Robbins2003-11-041-3/+1
| | | | | | | | | | mbstate_t object that they ignore. The zeroing is fairly expensive, and it will never be necessary in these functions; when we support state-dependent encodings, we will pass in a pointer to the file's mbstate_t object, and only zero it at the time the file gets opened. Notes: svn path=/head/; revision=122042
* Set the error bit on the stream if an encoding error occurs. ImproveTim J. Robbins2002-10-161-1/+3
| | | | | | | handling of multibyte sequences representing null wide characters. Notes: svn path=/head/; revision=105234
* Add an unlocked version of ungetwc(), __ungetwc(), that __vfwscanf()Tim J. Robbins2002-09-221-9/+21
| | | | | | | will need to use. Notes: svn path=/head/; revision=103782
* Lock and unlock the file once per call and use the unlocked version ofTim J. Robbins2002-09-201-7/+11
| | | | | | | ungetc() instead of having ungetc() recurse on the lock. Notes: svn path=/head/; revision=103677
* Reimplement the functionality of fgetrune(), fputrune(), and fungetrune()Tim J. Robbins2002-09-181-2/+15
| | | | | | | | | here in terms of mbrtowc(), wcrtomb(), and the single-byte I/O functions. The rune I/O functions are about to become deprecated in favour of the ones provided by ISO C90 Amd. 1 and C99. Notes: svn path=/head/; revision=103523
* Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),Tim J. Robbins2002-08-131-0/+46
putwc(), fputwc(), putwchar(), ungetwc(), fwide(). Notes: svn path=/head/; revision=101776