VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.10.0/Xprintf.h@ 68495

Last change on this file since 68495 was 36308, checked in by vboxsync, 14 years ago

fix OSE

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef XPRINTF_H
25#define XPRINTF_H
26
27#include <stdio.h>
28#include <stdarg.h>
29#include <X11/Xfuncproto.h>
30
31#ifndef _X_RESTRICT_KYWD
32# if defined(restrict) /* assume autoconf set it correctly */ || \
33 (defined(__STDC__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */
34# define _X_RESTRICT_KYWD restrict
35# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
36# define _X_RESTRICT_KYWD __restrict__
37# else
38# define _X_RESTRICT_KYWD
39# endif
40#endif
41
42/*
43 * These functions provide a portable implementation of the common (but not
44 * yet universal) asprintf & vasprintf routines to allocate a buffer big
45 * enough to sprintf the arguments to. The XNF variants terminate the server
46 * if the allocation fails.
47 * The buffer allocated is returned in the pointer provided in the first
48 * argument. The return value is the size of the allocated buffer, or -1
49 * on failure.
50 */
51extern _X_EXPORT int Xasprintf (char **ret,
52 const char * _X_RESTRICT_KYWD fmt,
53 ...) _X_ATTRIBUTE_PRINTF(2,3);
54extern _X_EXPORT int Xvasprintf (char **ret,
55 const char * _X_RESTRICT_KYWD fmt,
56 va_list va) _X_ATTRIBUTE_PRINTF(2,0);
57extern _X_EXPORT int XNFasprintf (char **ret,
58 const char * _X_RESTRICT_KYWD fmt,
59 ...) _X_ATTRIBUTE_PRINTF(2,3);
60extern _X_EXPORT int XNFvasprintf (char **ret,
61 const char * _X_RESTRICT_KYWD fmt,
62 va_list va) _X_ATTRIBUTE_PRINTF(2,0);
63
64#if !defined(HAVE_ASPRINTF) && !defined(HAVE_VASPRINTF)
65# define asprintf Xasprintf
66# define vasprintf Xvasprintf
67#endif
68
69#endif /* XPRINTF_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette