/src/php-src/ext/uri/uriparser/src/UriVersion.c
Line | Count | Source |
1 | | /* |
2 | | * uriparser - RFC 3986 URI parsing library |
3 | | * |
4 | | * Copyright (C) 2025, Sebastian Pipping <sebastian@pipping.org> |
5 | | * All rights reserved. |
6 | | * |
7 | | * Redistribution and use in source and binary forms, with or without |
8 | | * modification, are permitted provided that the following conditions |
9 | | * are met: |
10 | | * |
11 | | * 1. Redistributions of source code must retain the above |
12 | | * copyright notice, this list of conditions and the following |
13 | | * disclaimer. |
14 | | * |
15 | | * 2. Redistributions in binary form must reproduce the above |
16 | | * copyright notice, this list of conditions and the following |
17 | | * disclaimer in the documentation and/or other materials |
18 | | * provided with the distribution. |
19 | | * |
20 | | * 3. Neither the name of the copyright holder nor the names of |
21 | | * its contributors may be used to endorse or promote products |
22 | | * derived from this software without specific prior written |
23 | | * permission. |
24 | | * |
25 | | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
26 | | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
27 | | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
28 | | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
29 | | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
30 | | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
31 | | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
32 | | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
33 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
34 | | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
35 | | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
36 | | * OF THE POSSIBILITY OF SUCH DAMAGE. |
37 | | */ |
38 | | |
39 | | /** |
40 | | * @file UriVersion.c |
41 | | * Implements a runtime version getter. |
42 | | * NOTE: This source file includes itself twice. |
43 | | */ |
44 | | |
45 | | /* What encodings are enabled? */ |
46 | | #include <uriparser/UriDefsConfig.h> |
47 | | #if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) |
48 | | /* Include SELF twice */ |
49 | | # ifdef URI_ENABLE_ANSI |
50 | | # define URI_PASS_ANSI 1 |
51 | | # include "UriVersion.c" |
52 | | # undef URI_PASS_ANSI |
53 | | # endif |
54 | | # ifdef URI_ENABLE_UNICODE |
55 | | # define URI_PASS_UNICODE 1 |
56 | | # include "UriVersion.c" |
57 | | # undef URI_PASS_UNICODE |
58 | | # endif |
59 | | #else |
60 | | # ifdef URI_PASS_ANSI |
61 | | # include <uriparser/UriDefsAnsi.h> |
62 | | # else |
63 | | # include <uriparser/UriDefsUnicode.h> |
64 | | # include <wchar.h> |
65 | | # endif |
66 | | |
67 | | # ifndef URI_DOXYGEN |
68 | | # include <uriparser/Uri.h> |
69 | | # endif |
70 | | |
71 | 0 | const URI_CHAR * URI_FUNC(BaseRuntimeVersion)(void) { |
72 | | # if defined(URI_PASS_ANSI) |
73 | 0 | return URI_VER_ANSI; |
74 | | # elif defined(URI_PASS_UNICODE) |
75 | 0 | return URI_VER_UNICODE; |
76 | | # else |
77 | | # error Either URI_PASS_ANSI or URI_PASS_UNICODE must be defined |
78 | | # endif |
79 | 0 | } Unexecuted instantiation: uriBaseRuntimeVersionA Unexecuted instantiation: uriBaseRuntimeVersionW |
80 | | |
81 | | #endif |