DPDK  18.05.1
rte_string_fns.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
11 #ifndef _RTE_STRING_FNS_H_
12 #define _RTE_STRING_FNS_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdio.h>
19 
46 int
47 rte_strsplit(char *string, int stringlen,
48  char **tokens, int maxtokens, char delim);
49 
55 static inline size_t
56 rte_strlcpy(char *dst, const char *src, size_t size)
57 {
58  return (size_t)snprintf(dst, size, "%s", src);
59 }
60 
61 /* pull in a strlcpy function */
62 #ifdef RTE_EXEC_ENV_BSDAPP
63 #include <string.h>
64 #ifndef __BSD_VISIBLE /* non-standard functions are hidden */
65 #define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
66 #endif
67 
68 
69 #else /* non-BSD platforms */
70 #ifdef RTE_USE_LIBBSD
71 #include <bsd/string.h>
72 
73 #else /* no BSD header files, create own */
74 #define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
75 
76 #endif /* RTE_USE_LIBBSD */
77 #endif /* BSDAPP */
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif /* RTE_STRING_FNS_H */