Print this page
8548 want memset_s(3C)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/iso/string_iso.h
+++ new/usr/src/head/iso/string_iso.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /* Copyright (c) 1988 AT&T */
23 23 /* All Rights Reserved */
24 24
25 25
26 26 /*
27 27 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 28 * Copyright 2014 PALO, Richard.
29 29 *
30 30 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
31 31 * Use is subject to license terms.
32 32 */
33 33
34 34 /*
35 35 * An application should not include this header directly. Instead it
36 36 * should be included only through the inclusion of other Sun headers.
37 37 *
38 38 * The contents of this header is limited to identifiers specified in the
39 39 * C Standard. Any new identifiers specified in future amendments to the
40 40 * C Standard must be placed in this header. If these new identifiers
41 41 * are required to also be in the C++ Standard "std" namespace, then for
42 42 * anything other than macro definitions, corresponding "using" directives
43 43 * must also be added to <string.h>.
44 44 */
45 45
46 46 #ifndef _ISO_STRING_ISO_H
47 47 #define _ISO_STRING_ISO_H
48 48
49 49 #include <sys/feature_tests.h>
50 50 #include <sys/null.h>
51 51
52 52 #ifdef __cplusplus
53 53 extern "C" {
54 54 #endif
55 55
56 56 #if __cplusplus >= 199711L
57 57 namespace std {
58 58 #endif
59 59
60 60 #if !defined(_SIZE_T) || __cplusplus >= 199711L
61 61 #define _SIZE_T
62 62 #if defined(_LP64) || defined(_I32LPx)
63 63 typedef unsigned long size_t; /* size of something in bytes */
64 64 #else
65 65 typedef unsigned int size_t; /* (historical version) */
66 66 #endif
67 67 #endif /* !_SIZE_T */
68 68
69 69 extern int memcmp(const void *, const void *, size_t);
70 70 extern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t);
71 71 extern void *memmove(void *, const void *, size_t);
72 72 extern void *memset(void *, int, size_t);
73 73 extern char *strcat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
74 74 extern int strcmp(const char *, const char *);
75 75 extern char *strcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
76 76 extern int strcoll(const char *, const char *);
77 77 extern size_t strcspn(const char *, const char *);
78 78 extern char *strerror(int);
79 79 extern size_t strlen(const char *);
80 80 extern char *strncat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
81 81 extern int strncmp(const char *, const char *, size_t);
82 82 extern char *strncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
83 83 extern size_t strspn(const char *, const char *);
84 84 extern char *strtok(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
85 85 extern size_t strxfrm(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
86 86
87 87 /*
88 88 * The C++ Standard (ISO/IEC 14882:1998) specifies that each of the
89 89 * function signatures for the following functions be replaced by
90 90 * two declarations, both of which have the same behavior.
91 91 */
92 92 #if __cplusplus >= 199711L
93 93 extern const void *memchr(const void *, int, size_t);
94 94 #ifndef _MEMCHR_INLINE
95 95 #define _MEMCHR_INLINE
96 96 extern "C++" {
97 97 inline void *memchr(void * __s, int __c, size_t __n) {
98 98 return (void *)memchr((const void *)__s, __c, __n);
99 99 }
100 100 }
101 101 #endif /* _MEMCHR_INLINE */
102 102 extern const char *strchr(const char *, int);
103 103 #ifndef _STRCHR_INLINE
104 104 #define _STRCHR_INLINE
105 105 extern "C++" {
106 106 inline char *strchr(char *__s, int __c) {
107 107 return (char *)strchr((const char *)__s, __c);
108 108 }
109 109 }
110 110 #endif /* _STRCHR_INLINE */
111 111 extern const char *strpbrk(const char *, const char *);
112 112 #ifndef _STRPBRK_INLINE
113 113 #define _STRPBRK_INLINE
114 114 extern "C++" {
115 115 inline char *strpbrk(char *__s1, const char *__s2) {
116 116 return (char *)strpbrk((const char *)__s1, __s2);
117 117 }
118 118 }
119 119 #endif /* _STRPBRK_INLINE */
120 120 extern const char *strrchr(const char *, int);
121 121 #ifndef _STRRCHR_INLINE
122 122 #define _STRRCHR_INLINE
123 123 extern "C++" {
124 124 inline char *strrchr(char *__s, int __c) {
125 125 return (char *)strrchr((const char *)__s, __c);
126 126 }
127 127 }
128 128 #endif /* _STRRCHR_INLINE */
129 129 extern const char *strstr(const char *, const char *);
130 130 #ifndef _STRSTR_INLINE
131 131 #define _STRSTR_INLINE
132 132 extern "C++" {
133 133 inline char *strstr(char *__s1, const char *__s2) {
134 134 return (char *)strstr((const char *)__s1, __s2);
135 135 }
↓ open down ↓ |
135 lines elided |
↑ open up ↑ |
136 136 }
137 137 #endif /* _STRSTR_INLINE */
138 138 #else /* __cplusplus >= 199711L */
139 139 extern void *memchr(const void *, int, size_t);
140 140 extern char *strchr(const char *, int);
141 141 extern char *strpbrk(const char *, const char *);
142 142 extern char *strrchr(const char *, int);
143 143 extern char *strstr(const char *, const char *);
144 144 #endif /* __cplusplus >= 199711L */
145 145
146 +#if __EXT1_VISIBLE
147 +
148 +#ifndef _RSIZE_T_DEFINED
149 +#define _RSIZE_T_DEFINED
150 +typedef size_t rsize_t;
151 +#endif
152 +
153 +#ifndef _ERRNO_T_DEFINED
154 +#define _ERRNO_T_DEFINED
155 +typedef int errno_t;
156 +#endif
157 +
158 +/* ISO/IEC 9899:2011 K.3.7.4.1.1 */
159 +extern errno_t memset_s(void *, rsize_t, int, rsize_t);
160 +#endif /* __EXT1_VISIBLE */
161 +
146 162 #if __cplusplus >= 199711L
147 163 }
148 164 #endif /* end of namespace std */
149 165
150 166 #ifdef __cplusplus
151 167 }
152 168 #endif
153 169
154 170 #endif /* _ISO_STRING_ISO_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX