tree-wide: bunch of fixlets raised by coverity (#38341)
This commit is contained in:
+6
-2
@@ -6,8 +6,12 @@
|
||||
|
||||
/* The following macros add 1 when converting things, since 0 is a valid mode, while the pointer
|
||||
* NULL is special */
|
||||
#define PTR_TO_MODE(p) ((mode_t) ((uintptr_t) (p)-1))
|
||||
#define MODE_TO_PTR(u) ((void *) ((uintptr_t) (u)+1))
|
||||
static inline mode_t PTR_TO_MODE(void *p) {
|
||||
return p ? (mode_t) ((uintptr_t) p - 1) : MODE_INVALID;
|
||||
}
|
||||
static inline void* MODE_TO_PTR(mode_t m) {
|
||||
return m == MODE_INVALID ? NULL : (void *) ((uintptr_t) m + 1);
|
||||
}
|
||||
|
||||
int rmdir_parents(const char *path, const char *stop);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ int ordered_set_put_strdup_full(OrderedSet **s, const struct hash_ops *hash_ops,
|
||||
}
|
||||
|
||||
int ordered_set_put_strdupv_full(OrderedSet **s, const struct hash_ops *hash_ops, char **l) {
|
||||
int n = 0, r;
|
||||
int r, ret = 0;
|
||||
|
||||
assert(s);
|
||||
|
||||
@@ -70,14 +70,14 @@ int ordered_set_put_strdupv_full(OrderedSet **s, const struct hash_ops *hash_ops
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
n += r;
|
||||
ret = ret || r > 0;
|
||||
}
|
||||
|
||||
return n;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ordered_set_put_string_set_full(OrderedSet **s, const struct hash_ops *hash_ops, OrderedSet *l) {
|
||||
int n = 0, r;
|
||||
int r, ret = 0;
|
||||
char *p;
|
||||
|
||||
assert(s);
|
||||
@@ -89,10 +89,10 @@ int ordered_set_put_string_set_full(OrderedSet **s, const struct hash_ops *hash_
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
n += r;
|
||||
ret = ret || r > 0;
|
||||
}
|
||||
|
||||
return n;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ordered_set_print(FILE *f, const char *field, OrderedSet *s) {
|
||||
|
||||
Reference in New Issue
Block a user