write documentation for string.h functions.

This commit is contained in:
2025-12-26 12:33:35 +01:00
parent 28abee196c
commit f00f9bd9a1

View File

@@ -2,7 +2,25 @@
#include "atrb.h"
#include "types.h"
int memcmp(const void *s1, const void *s2, usize n) NONNULL((1, 2)) PURE;
/* Compares n bytes of s1 and s2.
* Returns =0 if both are equivalent,
* >0 if s1's value is greater, <0 if s2's value is greater.
* Returns 0 if n=0. */
int memcmp(const void *s1, const void *s2, usize n) NONNULL((1, 2)) PURE;
/* Sets n bytes of s to c.
* c shall be interpreted as an 8 bit unsigned integer.
* s is returned. */
void *memset(void *s, int c, usize n) NONNULL((1));
/* Copies n bytes from src to dst.
* src and dst may not alias, i.e. they mustn't overlap.
* If they do, use memmove instead.
* Returns dst. */
void *memcpy(void *restrict dst, const void *restrict src, usize n) NONNULL((1, 2));
/* Copies n bytes from src to dst.
* src and dst may alias one another, and will behave as if copied to an array.
* If src and dst can be guaranteed to not alias, memcpy is preferred.
* Returns dst. */
void *memmove(void *dst, const void *src, usize n) NONNULL((1, 2));