summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-05-18 12:23:59 +0200
committerNiels de Vos <ndevos@redhat.com>2016-05-23 01:13:27 -0700
commite221827c18ad4161a8e54ad67c9128ad234b8c03 (patch)
tree0b0c5d7c3c94bcfe41edf82fb18bca8c16dca0a7 /xlators
parentbeebee772505017ed1ef24197880e1ccd0a2536c (diff)
index: improve compiler warning fix
Commit 137bd83029458ecd461718a891c74cd1afd8f6cb introduced some typecasting to work around a compiler warning. It is much cleaner to add a -1 value in the enumeration and use that in if-statements. BUG: 1335232 Change-Id: I830a565b8d96d7b51ff775e94aa23dd567ffe0d9 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14409 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/index/src/index.c6
-rw-r--r--xlators/features/index/src/index.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 12203f82c56..36502383488 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -417,7 +417,7 @@ index_dec_link_count (index_priv_t *priv, index_xattrop_type_t type)
char*
index_get_subdir_from_type (index_xattrop_type_t type)
{
- if ((int)type < 0 || (int)type >= (int)XATTROP_TYPE_END)
+ if (type < XATTROP || type >= XATTROP_TYPE_END)
return NULL;
return index_subdirs[type];
}
@@ -1558,7 +1558,7 @@ index_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag,
int32_t op_ret = 0;
int32_t op_errno = 0;
int ret = 0;
- int type = -1;
+ index_xattrop_type_t type = XATTROP_TYPE_UNSET;
struct iatt preparent = {0};
struct iatt postparent = {0};
char index_dir[PATH_MAX] = {0};
@@ -1588,7 +1588,7 @@ index_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag,
gf_uuid_copy (preparent.ia_gfid, loc->pargfid);
preparent.ia_ino = -1;
- if (type < 0) {
+ if (type <= XATTROP_TYPE_UNSET) {
ret = index_inode_ctx_get (loc->parent, this, &ictx);
if ((ret == 0) && gf_uuid_is_null (ictx->virtual_pargfid)) {
ret = -EINVAL;
diff --git a/xlators/features/index/src/index.h b/xlators/features/index/src/index.h
index 44e0039ff70..24fd293db70 100644
--- a/xlators/features/index/src/index.h
+++ b/xlators/features/index/src/index.h
@@ -27,6 +27,7 @@ typedef enum {
} index_state_t;
typedef enum {
+ XATTROP_TYPE_UNSET = -1,
XATTROP,
DIRTY,
ENTRY_CHANGES,