summaryrefslogtreecommitdiffstats
path: root/libmount/src/iter.c
diff options
context:
space:
mode:
authorKarel Zak2012-12-04 14:22:39 +0100
committerKarel Zak2012-12-04 14:22:39 +0100
commitba2bdf41c436640286df40529cddede46b3ba5d8 (patch)
tree2fd343c6a2450b4566ca996ff2f0c9703bc2e680 /libmount/src/iter.c
parentlibblkid: re-read PART{UUID,LABEL} for successfully verified cached devices (diff)
downloadkernel-qcow2-util-linux-ba2bdf41c436640286df40529cddede46b3ba5d8.tar.gz
kernel-qcow2-util-linux-ba2bdf41c436640286df40529cddede46b3ba5d8.tar.xz
kernel-qcow2-util-linux-ba2bdf41c436640286df40529cddede46b3ba5d8.zip
libmount: clean nonnull attribute usage
- use __attribute__((nonnull) for functions where we not able to return an return code ("is", "has" and some "get" functions). - use __attribute__((nonnull) for small functions where we always modify any of the function argument (some mnt_optstr_* functions) Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/iter.c')
-rw-r--r--libmount/src/iter.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libmount/src/iter.c b/libmount/src/iter.c
index 393c23eb2..d7b8adbef 100644
--- a/libmount/src/iter.c
+++ b/libmount/src/iter.c
@@ -54,25 +54,20 @@ void mnt_free_iter(struct libmnt_iter *itr)
*/
void mnt_reset_iter(struct libmnt_iter *itr, int direction)
{
- assert(itr);
-
- if (direction == -1 && itr)
+ if (direction == -1)
direction = itr->direction;
- if (itr) {
- memset(itr, 0, sizeof(*itr));
- itr->direction = direction;
- }
+ memset(itr, 0, sizeof(*itr));
+ itr->direction = direction;
}
/**
* mnt_iter_get_direction:
* @itr: iterator pointer
*
- * Returns: MNT_INTER_{FOR,BACK}WARD or negative number in case of error.
+ * Returns: MNT_INTER_{FOR,BACK}WARD
*/
int mnt_iter_get_direction(struct libmnt_iter *itr)
{
- assert(itr);
- return itr ? itr->direction : -EINVAL;
+ return itr->direction;
}