]> git.saurik.com Git - apple/libc.git/blob - include/secure/_strings.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / include / secure / _strings.h
1 /*
2 * Copyright (c) 2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _STRINGS_H_
25 # error "Never use <secure/_strings.h> directly; include <strings.h> instead."
26 #endif
27
28 #ifndef _SECURE__STRINGS_H_
29 #define _SECURE__STRINGS_H_
30
31 #include <sys/cdefs.h>
32 #include <Availability.h>
33 #include <secure/_common.h>
34
35 #if _USE_FORTIFY_LEVEL > 0
36
37 /* bcopy and bzero */
38
39 /* Removed in Issue 7 */
40 #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
41
42 #if __has_builtin(__builtin___memmove_chk) || defined(__GNUC__)
43 #undef bcopy
44 /* void bcopy(const void *src, void *dst, size_t len) */
45 #define bcopy(src, dest, ...) \
46 __builtin___memmove_chk (dest, src, __VA_ARGS__, __darwin_obsz0 (dest))
47 #endif
48
49 #if __has_builtin(__builtin___memset_chk) || defined(__GNUC__)
50 #undef bzero
51 /* void bzero(void *s, size_t n) */
52 #define bzero(dest, ...) \
53 __builtin___memset_chk (dest, 0, __VA_ARGS__, __darwin_obsz0 (dest))
54 #endif
55
56 #endif
57
58 #endif /* _USE_FORTIFY_LEVEL > 0 */
59 #endif /* _SECURE__STRINGS_H_ */