1 /*
2 * Arm SCP/MCP Software
3 * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Description:
8 * String management.
9 */
10
11 #include <fwk_assert.h>
12 #include <fwk_mm.h>
13
14 #include <stdlib.h>
15
fwk_str_memset(void * dest,int ch,size_t count)16 void fwk_str_memset(void *dest, int ch, size_t count)
17 {
18 void *ret;
19
20 if (dest == NULL) {
21 fwk_trap();
22 }
23
24 ret = memset(dest, ch, count);
25 if (ret != dest) {
26 fwk_trap();
27 }
28 }
29
fwk_str_memcpy(void * dest,const void * src,size_t count)30 void fwk_str_memcpy(void *dest, const void *src, size_t count)
31 {
32 void *ret;
33
34 if ((dest == NULL) || (src == NULL)) {
35 fwk_trap();
36 }
37
38 ret = memcpy(dest, src, count);
39 if (ret != dest) {
40 fwk_trap();
41 }
42 }
43
fwk_str_strncpy(char * dest,const char * src,size_t count)44 void fwk_str_strncpy(char *dest, const char *src, size_t count)
45 {
46 char *ch;
47
48 if ((dest == NULL) || (src == NULL)) {
49 fwk_trap();
50 }
51
52 ch = strncpy(dest, src, count);
53 if (ch != dest) {
54 fwk_trap();
55 }
56 }
57