File tree Expand file tree Collapse file tree 2 files changed +0
-74
lines changed Expand file tree Collapse file tree 2 files changed +0
-74
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ void udelay(uint32_t us);
24
24
void * memchr (const void * void_s , int32_t c , size_t n );
25
25
int32_t strcmp (const char * s1_arg , const char * s2_arg );
26
26
int32_t strncmp (const char * s1_arg , const char * s2_arg , size_t n_arg );
27
- char * strcpy_s (char * d_arg , size_t dmax , const char * s_arg );
28
27
char * strncpy_s (char * d_arg , size_t dmax , const char * s_arg , size_t slen_arg );
29
28
char * strchr (char * s_arg , char ch );
30
29
size_t strnlen_s (const char * str_arg , size_t maxlen_arg );
Original file line number Diff line number Diff line change @@ -172,79 +172,6 @@ char *strchr(char *s_arg, char ch)
172
172
return ((* s ) != '\0' ) ? s : NULL ;
173
173
}
174
174
175
- /**
176
- *strcpy_s
177
- *
178
- * description:
179
- * This function copies the string pointed to by s to a buffer
180
- * pointed by d.
181
- *
182
- * input:
183
- * d pointer to dest buffer.
184
- *
185
- * dmax maximum length of dest buffer
186
- *
187
- * s pointer to the source string
188
- *
189
- * return value:
190
- * dest pointer to dest string if string is copied
191
- * successfully,or else return null.
192
- *
193
- * notes:
194
- * 1) both d and s shall not be null pointers.
195
- * 2) dmax shall not 0.
196
- */
197
- char * strcpy_s (char * d_arg , size_t dmax , const char * s_arg )
198
- {
199
- char * d = d_arg ;
200
- const char * s = s_arg ;
201
- char * dest_base ;
202
- size_t dest_avail ;
203
- uint64_t overlap_guard ;
204
-
205
- if ((s == NULL ) || (d == NULL ) || (dmax == 0U )) {
206
- pr_err ("%s: invalid src, dest buffer or length." , __func__ );
207
- return NULL ;
208
- }
209
-
210
- if (s == d ) {
211
- return d ;
212
- }
213
-
214
- overlap_guard = (uint64_t )((d > s ) ? (d - s - 1 ) : (s - d - 1 ));
215
-
216
- dest_avail = dmax ;
217
- dest_base = d ;
218
-
219
- while (dest_avail > 0U ) {
220
- if (overlap_guard == 0U ) {
221
- pr_err ("%s: overlap happened." , __func__ );
222
- d -- ;
223
- * d = '\0' ;
224
- return NULL ;
225
- }
226
-
227
- * d = * s ;
228
- if (* d == '\0' ) {
229
- return dest_base ;
230
- }
231
-
232
- d ++ ;
233
- s ++ ;
234
- dest_avail -- ;
235
- overlap_guard -- ;
236
- }
237
-
238
- pr_err ("%s: dest buffer has no enough space." , __func__ );
239
-
240
- /*
241
- * to avoid a string that is not
242
- * null-terminated in dest buffer
243
- */
244
- dest_base [dmax - 1 ] = '\0' ;
245
- return NULL ;
246
- }
247
-
248
175
/*
249
176
* strncpy_s
250
177
*
You can’t perform that action at this time.
0 commit comments