OSDN Git Service

Don't attempt to resolve dependencies for unidentified packages.
[mingw/mingw-get.git] / src / argwrap.h
1 #ifndef ARGWRAP_H
2 /*
3  * argwrap.h
4  *
5  * $Id$
6  *
7  * This private header provides declarations which are to be shared by
8  * the argwrap.c and argvwrap.c implementations.
9  *
10  *
11  * Written by Keith Marshall  <keithmarshall@users.sourceforge.net>
12  * Copyright (C) 2013, MinGW.org Project  <http://mingw.org>
13  *
14  *
15  * Permission is hereby granted, free of charge, to any person obtaining a
16  * copy of this software and associated documentation files (the "Software"),
17  * to deal in the Software without restriction, including without limitation
18  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19  * and/or sell copies of the Software, and to permit persons to whom the
20  * Software is furnished to do so, subject to the following conditions:
21  *
22  *  The above copyright notice and this permission notice shall be
23  *  included in all copies or substantial portions of the Software.
24  *
25  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28  *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29  *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30  *  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31  *  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32  *
33  *  Except as contained in this notice, the name(s) of the above copyright
34  *  holders and contributors shall not be used in advertising or otherwise
35  *  to promote the sale, use or other dealings in this Software without
36  *  prior written authorization.
37  *
38  */
39 #define ARGWRAP_H  1
40
41 #include <stdlib.h>
42 #include <errno.h>
43
44 #undef BEGIN_C_DECLS
45 #undef END_C_DECLS
46
47 #ifdef __cplusplus
48 # define BEGIN_C_DECLS  extern "C" {
49 # define END_C_DECLS    }
50 #else
51 # define BEGIN_C_DECLS
52 # define END_C_DECLS
53 #endif
54
55 BEGIN_C_DECLS
56
57 static __inline__
58 void __attribute__((__always_inline__)) *inline_malloc( size_t request )
59 {
60   /* In some, if not all versions of MSVCRT, Microsoft's implementation of
61    * malloc() neglects to set errno appropriately on failure; this locally
62    * implemented wrapper works around this deficiency.
63    */
64   void *allotted;
65   if( (allotted = malloc( request )) == NULL )
66     errno = ENOMEM;
67   return allotted;
68 }
69 #define malloc( request ) inline_malloc( request )
70
71 extern const char *argwrap( char *, const char *, size_t );
72
73 END_C_DECLS
74
75 #endif /* !defined ARGWRAP_H: $RCSfile$: end of file */