basic: make check-pointer-deref clean
Add the needed assert changes to make the code clean for the new check-pointer-deref script. Note that for `_cmp()` functions its a bit of a question if we want `assert()` or `POINTER_MAY_BE_NULL()` here. The former is more correct but it adds a (small) runtime hit. If we use POINTER_MAY_BE_NULL() it is compiled out but strictly speaking it is wrong (so at least we would need a comment).
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include "strv.h"
|
||||
|
||||
int ordered_set_ensure_allocated(OrderedSet **s, const struct hash_ops *ops) {
|
||||
assert(s);
|
||||
|
||||
if (*s)
|
||||
return 0;
|
||||
|
||||
@@ -22,6 +24,8 @@ int ordered_set_ensure_allocated(OrderedSet **s, const struct hash_ops *ops) {
|
||||
int ordered_set_ensure_put(OrderedSet **s, const struct hash_ops *ops, void *p) {
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
r = ordered_set_ensure_allocated(s, ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user