]>
git.saurik.com Git - apple/libdispatch.git/blob - src/shims/malloc_zone.h
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
21 #ifndef __DISPATCH_SHIMS_MALLOC_ZONE__
22 #define __DISPATCH_SHIMS_MALLOC_ZONE__
24 #include <sys/types.h>
29 * Implement malloc zones as a simple wrapper around malloc(3) on systems
30 * that don't support them.
32 #if !HAVE_MALLOC_CREATE_ZONE
33 typedef void * malloc_zone_t
;
35 static inline malloc_zone_t
*
36 malloc_create_zone(size_t start_size
, unsigned flags
)
39 return ((void *)(-1));
43 malloc_destroy_zone(malloc_zone_t
*zone
)
48 static inline malloc_zone_t
*
49 malloc_default_zone(void)
52 return ((void *)(-1));
55 static inline malloc_zone_t
*
56 malloc_zone_from_ptr(const void *ptr
)
59 return ((void *)(-1));
63 malloc_zone_malloc(malloc_zone_t
*zone
, size_t size
)
66 return (malloc(size
));
70 malloc_zone_calloc(malloc_zone_t
*zone
, size_t num_items
, size_t size
)
73 return (calloc(num_items
, size
));
77 malloc_zone_realloc(malloc_zone_t
*zone
, void *ptr
, size_t size
)
80 return (realloc(ptr
, size
));
84 malloc_zone_free(malloc_zone_t
*zone
, void *ptr
)
91 malloc_set_zone_name(malloc_zone_t
*zone
, const char *name
)
98 #endif /* __DISPATCH_SHIMS_MALLOC_ZONE__ */