summaryrefslogtreecommitdiff
path: root/src/basic/memory-util.h
Commit message (Collapse)AuthorAgeFilesLines
* memory-util: make ArrayCleanup passed to array_cleanup() constYu Watanabe2023-05-091-4/+4
| | | | Should not change any behavior, preparation for later commits.
* memory-util: add a concept for gcc cleanup attribute based array destructionLennart Poettering2023-02-231-0/+34
|
* boot: Simplify object erasureJan Janssen2023-01-091-11/+1
| | | | | | | | This erase_obj() machinery looks like voodoo and creates an awful lot of noise as soon as we get back to building with -O0. We can do this in a more simple way by introducing a struct that holds the information we need on cleanup. When building with optimization enabled, all this gets inlined and the eraser vanishes.
* memory-util: introdyce mempcpy_safe()Yu Watanabe2022-02-161-2/+10
|
* memory-util: replace memeqzero() by a more generic memeqbyte()Lennart Poettering2021-09-131-1/+3
| | | | | The new helper can check for any byte, no just zeroes. The old name is then converted into a macro that wraps our new version of the helper.
* memory-util: add mempmem_safe()Lennart Poettering2021-08-101-0/+10
| | | | | | | | This is like memmem_safe() but returns a pointer after the needle, instead to the beginning of the needle. This is then used at one place. Not much, but it makes me sleep safer at night, as it avoids the manual counting done so far.
* Merge pull request #19662 from yuwata/memdupLennart Poettering2021-05-191-3/+3
|\ | | | | util: make memdup() or friends safer
| * memory-util: make memcpy_safe() return pointer to destinationYu Watanabe2021-05-191-3/+3
| |
* | alloc-util: introduce MALLOC_SIZEOF_SAFE() helperLennart Poettering2021-05-191-1/+1
|/ | | | | | | | | It's a wrapper around malloc_usable_size() that is supposed to be compatible with _FORTIFY_SOURCES=1, by taking the __builtin_object_size() data into account, the same way as the _FORTIFY_SOURCES=1 logic does. Fixes: #19203
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* bus-message: add macro for calculation of offset from the pageZbigniew Jędrzejewski-Szmek2020-06-221-0/+1
|
* memory-util: add missing () in macro evaulationLennart Poettering2020-04-231-1/+1
|
* tree-wide: yet another batch of coccinelle recommendationsFrantisek Sumsal2020-01-021-3/+2
| | | | | Prettify certain parts of the codebase using coccinelle transformations (no functional changes).
* memory-util: introduce erase_and_free() helperLennart Poettering2019-12-041-7/+14
|
* memory-util: Add PAGE_ALIGN_DOWNChris Down2019-10-031-0/+1
| | | | | For example, cgroup v2 rounds down to the previous page when returning memory limits.
* test: add _cleanup_(erase_and_freep)Zbigniew Jędrzejewski-Szmek2019-07-101-0/+11
| | | | | Based on the macro and test case by Lennart Poettering and Topi Miettinen suggestion.
* basic/memory-util: do not "return" anything from memzero() macroZbigniew Jędrzejewski-Szmek2019-05-301-2/+2
| | | | The macro is not used in expressions, so we don't need the ternary statement.
* ask-password: erase character read with _cleanup_Lennart Poettering2019-03-201-0/+5
| | | | | This is much nicer, since it means we erase the character regardless how we exit the scope.
* util: move some raw memory functions from string-util.h → memory-util.hLennart Poettering2019-03-141-0/+26
|
* util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering2019-03-131-0/+53
Just some source rearranging.