mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
btstack_util: add btstack_strcat
This commit is contained in:
parent
8d3d774439
commit
3ece47889a
@ -499,3 +499,11 @@ void btstack_strcpy(char * dst, uint16_t dst_size, const char * src){
|
||||
(void) memcpy(dst, src, bytes_to_copy);
|
||||
dst[bytes_to_copy] = 0;
|
||||
}
|
||||
|
||||
void btstack_strcat(char * dst, uint16_t dst_size, const char * src){
|
||||
uint16_t src_len = (uint16_t) strlen(src);
|
||||
uint16_t dst_len = (uint16_t) strlen(dst);
|
||||
uint16_t bytes_to_copy = btstack_min( src_len, dst_size - dst_len - 1);
|
||||
(void) memcpy( &dst[dst_len], src, bytes_to_copy);
|
||||
dst[dst_len + bytes_to_copy] = 0;
|
||||
}
|
||||
|
@ -319,6 +319,15 @@ uint16_t btstack_next_cid_ignoring_zero(uint16_t current_cid);
|
||||
*/
|
||||
void btstack_strcpy(char * dst, uint16_t dst_size, const char * src);
|
||||
|
||||
/**
|
||||
* @brief Append src string to string in dst buffer with terminating '\0'
|
||||
* @note max total string length will be dst_size-1 characters
|
||||
* @param dst
|
||||
* @param dst_size
|
||||
* @param src
|
||||
*/
|
||||
void btstack_strcat(char * dst, uint16_t dst_size, const char * src);
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user