ReactOS 0.4.16-dev-1028-g8602629
_freebuf.cpp
Go to the documentation of this file.
1//
2// _freebuf.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines __acrt_stdio_free_buffer(), which releaes a buffer from a stream.
7//
9
10
11
12// Releases a buffer from a stream. If the stream is buffered and the buffer
13// was allocated by the CRT, the space is freed. If the buffer was provided by
14// the user, it is not freed (since we do not know how to free it).
15extern "C" void __cdecl __acrt_stdio_free_buffer_nolock(FILE* const public_stream)
16{
17 _ASSERTE(public_stream != nullptr);
18
19 __crt_stdio_stream const stream(public_stream);
20
21 if (!stream.is_in_use())
22 return;
23
24 if (!stream.has_crt_buffer())
25 return;
26
27 _free_crt(stream->_base);
28
30 stream->_base = nullptr;
31 stream->_ptr = nullptr;
32 stream->_cnt = 0;
33}
void __cdecl __acrt_stdio_free_buffer_nolock(FILE *const public_stream)
Definition: _freebuf.cpp:15
#define __cdecl
Definition: accygwin.h:79
@ _IOBUFFER_CRT
@ _IOBUFFER_SETVBUF
#define _ASSERTE(expr)
Definition: crtdbg.h:114
#define _free_crt
Definition: parse.h:23