Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / memory / build / FdPrintf.h
blobad333c77fd75eb04ba6839f22e4addc8f10f1f51
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef __FdPrintf_h__
8 #define __FdPrintf_h__
10 #ifdef _WIN32
11 typedef void* platform_handle_t;
12 #else
13 typedef int platform_handle_t;
14 #endif
16 /* We can't use libc's (f)printf because it would reenter in replace_malloc,
17 * So use a custom and simplified version. Only %p, %zu, %s and %% are
18 * supported, %zu, %s, support width specifiers.
20 * /!\ This function used a fixed-size internal buffer. The caller is
21 * expected to not use a format string that may overflow.
22 * The aFd argument is a file descriptor on UNIX and a native win32 file
23 * handle on Windows (from CreateFile). We can't use the windows POSIX
24 * APIs is that they don't support O_APPEND in a multi-process-safe way,
25 * while CreateFile does.
27 void FdPrintf(platform_handle_t aFd, const char* aFormat, ...)
28 #ifdef __GNUC__
29 __attribute__((format(printf, 2, 3)))
30 #endif
33 #endif /* __FdPrintf_h__ */