summaryrefslogtreecommitdiff
path: root/src/shared/def.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-11 00:45:47 +0200
committerLennart Poettering <lennart@poettering.net>2013-10-11 00:45:47 +0200
commit18387b5983150181dd9dee8edf1573285eecbaa4 (patch)
tree60818e4f9000af107fc71d785e29cfd0da410360 /src/shared/def.h
parenteaa3cbef3b8c214cd5c2d75b04e70ad477187e17 (diff)
macro: add new assert_return() macro for early parameter checking in functions
For the library functions we expose we currently repeatedly use checks like the following: if (!value_is_ok(parameter1)) return -EINVAL; if (!value_is_ok(parameter2)) return -EINVAL; And so on. Let's turn this into a macro: assert_return(value_is_ok(parameter1), -EINVAL); assert_return(value_is_ok(paramater2), -EINVAL); This makes our code a bit shorter and simpler, and also allows us to add a _unlikely_() around the check.
Diffstat (limited to 'src/shared/def.h')
0 files changed, 0 insertions, 0 deletions