mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 09:50:22 +01:00
c-stdaux: re-import git-subtree for 'src/c-stdaux'
git subtree pull --prefix src/c-stdaux git@github.com:c-util/c-stdaux.git main --squash
This commit is contained in:
commit
78dfc56a74
4 changed files with 30 additions and 1 deletions
2
src/c-stdaux/.github/workflows/ci.yml
vendored
2
src/c-stdaux/.github/workflows/ci.yml
vendored
|
|
@ -25,6 +25,6 @@ jobs:
|
|||
macos: true
|
||||
ci-docs:
|
||||
name: Documentation CI
|
||||
uses: bus1/cabuild/.github/workflows/ci-sphinx.yml@main
|
||||
uses: bus1/cabuild/.github/workflows/ci-sphinx.yml@v1
|
||||
with:
|
||||
source: "./src/docs"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ common extended features of wide-spread compilers like gcc and clang.
|
|||
### Project
|
||||
|
||||
* **Website**: <https://c-util.github.io/c-stdaux>
|
||||
* **Documentation**: <https://c-stdaux.readthedocs.io>
|
||||
* **Bug Tracker**: <https://github.com/c-util/c-stdaux/issues>
|
||||
|
||||
### Requirements
|
||||
|
|
|
|||
|
|
@ -677,6 +677,23 @@ static inline void *c_memcpy(void *dst, const void *src, size_t n) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* c_memcmp() - Compare memory areas
|
||||
* @s1: Pointer to one area
|
||||
* @s2: Pointer to other area
|
||||
* @n: Length of area to compare
|
||||
*
|
||||
* Compare the memory of size ``n`` of ``s1`` and ``s2``, just as ``memcmp(3)``
|
||||
* does, except this function allows either to be ``NULL`` if ``n`` is zero.
|
||||
*
|
||||
* Return: Comparison result for ordering is returned.
|
||||
*/
|
||||
static inline int c_memcmp(const void *s1, const void *s2, size_t n) {
|
||||
if (n > 0)
|
||||
return memcmp(s1, s2, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC: Common Destructors
|
||||
*
|
||||
|
|
|
|||
|
|
@ -357,6 +357,17 @@ static void test_misc(int non_constant_expr) {
|
|||
|
||||
c_memcpy(NULL, NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test c_memcmp() with.
|
||||
*/
|
||||
{
|
||||
uint64_t v1 = (uint64_t)-1, v2 = (uint64_t)0;
|
||||
|
||||
c_assert(c_memcmp(NULL, NULL, 0) == 0);
|
||||
c_assert(c_memcmp(&v1, &v2, 0) == 0);
|
||||
c_assert(c_memcmp(&v1, &v2, 8) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue