]> git.ipfire.org Git - thirdparty/systemd.git/commit
alloc-util: cleanups 2644/head
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Tue, 16 Feb 2016 17:51:43 +0000 (23:51 +0600)
committerAlexander Kuleshov <kuleshovmail@gmail.com>
Thu, 18 Feb 2016 19:36:46 +0000 (01:36 +0600)
commitdbacacaaeac47f792fb33ead7f8946689219ef2c
tree90f2fd58c31884de1bbf25fb88d5d08b68afdafa
parent2c45295e47642812ea417efba7f2f3339c6e2912
alloc-util: cleanups

This patch contains a set of little cleanups for alloc-util.h:

1. The malloc_multiply(), realloc_multiply() and memdup_multiply()
functions check allocation related parameters on overflow. Let's
move them to the separate size_multiply_overflow() function for
simplicity, code duplication prevention and possible reuse in future.

2. use SIZE_MAX from stdlib instead of ((size_t) - 1) to be more
clear.

3. The 'a'/'b' variables are renamed to 'size' and 'need' to be
more clear.'
src/basic/alloc-util.h