summaryrefslogtreecommitdiffstats
path: root/libmount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2015-02-16 14:17:54 +0100
committerKarel Zak2015-02-16 14:17:54 +0100
commit37290a53960dcd7f71e948576b9978bf685d9012 (patch)
tree2846a160de656ea320057e6e6e83ff01bd4ea139 /libmount/src/optstr.c
parentlibsmartcols: remove assert(arg) from public functions (diff)
downloadkernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.tar.gz
kernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.tar.xz
kernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.zip
libmount: remove assert(arg) from public functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/optstr.c')
-rw-r--r--libmount/src/optstr.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index b1ac254ac..a729695f1 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -127,7 +127,6 @@ static int mnt_optstr_locate_option(char *optstr, const char *name,
return 1;
assert(name);
- assert(optstr);
namesz = strlen(name);
@@ -218,15 +217,15 @@ static int __mnt_optstr_append_option(char **optstr,
* @name: value name
* @value: value
*
- * Returns: 0 on success or -1 in case of error. After an error the @optstr should
+ * Returns: 0 on success or <0 in case of error. After an error the @optstr should
* be unmodified.
*/
int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
{
size_t vsz, nsz;
- assert(optstr);
-
+ if (!optstr)
+ return -EINVAL;
if (!name || !*name)
return 0;
@@ -242,7 +241,7 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
* @name: value name
* @value: value
*
- * Returns: 0 on success or -1 in case of error. After an error the @optstr should
+ * Returns: 0 on success or <0 in case of error. After an error the @optstr should
* be unmodified.
*/
int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value)
@@ -250,8 +249,8 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value
int rc = 0;
char *tmp = *optstr;
- assert(optstr);
-
+ if (!optstr)
+ return -EINVAL;
if (!name || !*name)
return 0;
@@ -289,8 +288,8 @@ int mnt_optstr_get_option(const char *optstr, const char *name,
struct libmnt_optloc ol;
int rc;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
mnt_init_optloc(&ol);
@@ -319,8 +318,8 @@ int mnt_optstr_deduplicate_option(char **optstr, const char *name)
int rc;
char *begin = NULL, *end = NULL, *opt;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
opt = *optstr;
do {
@@ -435,10 +434,7 @@ int mnt_optstr_set_option(char **optstr, const char *name, const char *value)
char *nameend;
int rc = 1;
- assert(optstr);
- assert(name);
-
- if (!optstr)
+ if (!optstr || !name)
return -EINVAL;
mnt_init_optloc(&ol);
@@ -484,8 +480,8 @@ int mnt_optstr_remove_option(char **optstr, const char *name)
struct libmnt_optloc ol;
int rc;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
mnt_init_optloc(&ol);
@@ -525,8 +521,6 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs,
size_t namesz, valsz;
struct libmnt_optmap const *maps[2];
- assert(optstr);
-
if (!optstr)
return -EINVAL;
@@ -671,8 +665,6 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
size_t namesz = 0, valsz = 0;
int nmaps = 0;
- assert(optstr);
-
if (!optstr || !flags || !map)
return -EINVAL;
@@ -741,8 +733,6 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
unsigned long fl;
int rc = 0;
- assert(optstr);
-
if (!optstr || !map)
return -EINVAL;