String trim functions with destination size limitation
Repeated code

size_t src_size = strlen(src) + 1;
if (src_size &gt; dest_size) {
  return NULL;
}
return memmove(dest, src, src_size);


is a good candidate for a function (safe_memmove or something similar).



- Optimistic loops while (isspace((unsigned char) *src)) may never stop: '\0' is not a white space. Test for end of string explicitly:

    while (*src &amp;&amp; isspace((unsigned char) *src))



  Red face above. I don't know what I was thinking.


Portability. A free-standing environment doesn't have to provide memmove or strlen or isspace. Only features confined in &lt;float.h&gt;, &lt;iso646.h&gt;, &lt;limits.h&gt;, &lt;stdarg.h&gt;, &lt;stdbool.h&gt;, &lt;stddef.h&gt;, and &lt;stdint.h&gt; are mandatory. I am afraid that to claim embedded portability you need to implement optional features yourself.

Sorry for nitpicking.