Thu, 23 Feb 2023 21:09:33 +0100
fix build on macos
1 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
4 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
5 | * | |
6 | * THE BSD LICENSE | |
7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions are met: | |
10 | * | |
11 | * Redistributions of source code must retain the above copyright notice, this | |
12 | * list of conditions and the following disclaimer. | |
13 | * Redistributions in binary form must reproduce the above copyright notice, | |
14 | * this list of conditions and the following disclaimer in the documentation | |
15 | * and/or other materials provided with the distribution. | |
16 | * | |
17 | * Neither the name of the nor the names of its contributors may be | |
18 | * used to endorse or promote products derived from this software without | |
19 | * specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | |
25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | |
33 | ||
34 | #ifndef BASE_POOL_H | |
35 | #define BASE_POOL_H | |
36 | ||
37 | #ifndef NOINTNSAPI | |
38 | #define INTNSAPI | |
39 | #endif /* !NOINTNSAPI */ | |
40 | ||
41 | /* | |
42 | * pool.h | |
43 | * | |
44 | * Module for handling memory allocations. | |
45 | * | |
46 | * Notes: | |
47 | * This module is used instead of the NSPR prarena module because the prarenas | |
48 | * did not fit as cleanly into the existing server. | |
49 | * | |
50 | * Mike Belshe | |
51 | * 10-02-95 | |
52 | * | |
53 | */ | |
54 | ||
91 | 55 | // new |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
56 | #include <cx/string.h> |
91 | 57 | |
1 | 58 | #ifndef NETSITE_H |
59 | //include "netsite.h" | |
14
b8bf95b39952
New source folder layout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
60 | #include "../public/nsapi.h" |
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
61 | //include "nspr.h" |
1 | 62 | #endif /* !NETSITE_H */ |
63 | ||
64 | #ifndef BASE_PBLOCK_H | |
65 | //include "pblock.h" | |
66 | #endif /* !BASE_PBLOCK_H */ | |
67 | ||
68 | #ifndef BASE_SESSION_H | |
69 | //#include "session.h" | |
70 | #endif /* !BASE_SESSION_H */ | |
71 | ||
72 | #ifndef FRAME_REQ_H | |
73 | //include "frame/req.h" | |
74 | #endif /* !FRAME_REQ_H */ | |
75 | ||
76 | /* --- Begin function prototypes --- */ | |
77 | ||
78 | #ifdef INTNSAPI | |
79 | ||
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
80 | #ifdef __cplusplus |
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
81 | extern "C" { |
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
82 | #endif |
1 | 83 | |
84 | NSAPI_PUBLIC int INTpool_init(pblock *pb, Session *sn, Request *rq); | |
85 | ||
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
86 | cxmutstr cx_strdup_pool(pool_handle_t *pool, cxmutstr s); |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
87 | |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
88 | CxAllocator* pool_allocator(pool_handle_t *pool); |
91 | 89 | |
1 | 90 | #ifdef DEBUG_CACHES |
91 | NSAPI_PUBLIC int INTpool_service_debug(pblock *pb, Session *sn, Request *rq); | |
92 | #endif | |
93 | ||
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
94 | /* |
1 | 95 | NSAPI_PUBLIC pool_handle_t *INTpool_create(void); |
96 | ||
97 | NSAPI_PUBLIC void *INTpool_mark(pool_handle_t *pool_handle); | |
98 | ||
99 | NSAPI_PUBLIC void INTpool_recycle(pool_handle_t *pool_handle, void *mark); | |
100 | ||
101 | NSAPI_PUBLIC void INTpool_destroy(pool_handle_t *pool_handle); | |
102 | ||
103 | NSAPI_PUBLIC int INTpool_enabled(void); | |
104 | ||
105 | NSAPI_PUBLIC void *INTpool_malloc(pool_handle_t *pool_handle, size_t size ); | |
106 | ||
107 | NSAPI_PUBLIC void INTpool_free(pool_handle_t *pool_handle, void *ptr ); | |
108 | ||
109 | NSAPI_PUBLIC | |
110 | void *INTpool_calloc(pool_handle_t *pool_handle, size_t nelem, size_t elsize); | |
111 | ||
112 | NSAPI_PUBLIC | |
113 | void *INTpool_realloc(pool_handle_t *pool_handle, void *ptr, size_t size ); | |
114 | ||
115 | NSAPI_PUBLIC | |
116 | char *INTpool_strdup(pool_handle_t *pool_handle, const char *orig_str ); | |
117 | ||
59
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
118 | */ |
ab25c0a231d0
some fixes and new public APIs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
119 | |
1 | 120 | #ifdef DEBUG |
121 | NSAPI_PUBLIC void INTpool_assert(pool_handle_t *pool_handle, const void *ptr); | |
122 | #endif | |
123 | ||
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
124 | #ifdef __cplusplus |
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
125 | } |
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
126 | #endif |
1 | 127 | |
128 | #define pool_init INTpool_init | |
129 | ||
130 | #ifdef DEBUG_CACHES | |
131 | #define pool_service_debug INTpool_service_debug | |
132 | #endif /* DEBUG_CACHES */ | |
133 | ||
134 | #ifdef DEBUG | |
135 | #define POOL_ASSERT(pool, ptr) INTpool_assert(pool, ptr); | |
136 | #else | |
137 | #define POOL_ASSERT(pool, ptr) | |
138 | #endif | |
139 | ||
140 | #endif /* INTNSAPI */ | |
141 | ||
142 | #endif /* !BASE_POOL_H_ */ |