refactor(splits): Minor cleanups to periph invocation

* Add strlcpy from public domain version.
* Leverage strlcpy to detect truncation of behavior dev strs, and log.
* Use `offsetof` for cleaner detection on peripheral side.
This commit is contained in:
Peter Johanson
2022-02-01 03:29:50 +00:00
committed by Pete Johanson
parent b8700eaaa1
commit 7430750428
5 changed files with 55 additions and 3 deletions

19
app/include/zmk/stdlib.h Normal file
View File

@@ -0,0 +1,19 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <stdlib.h> /* for size_t */
/*
* ANSI C version of strlcpy
* Based on the NetBSD strlcpy man page.
*
* Nathan Myers <ncm-nospam@cantrip.org>, 2003/06/03
* Placed in the public domain.
*/
size_t strlcpy(char *dst, const char *src, size_t size);