Skip to contentSkip to conversation

indent an if statement

PATCH In review Dan Carpenter 5 participants 8 messages May 21, 2014 – May 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 indent an if statement

The "n += 32;" goes with the if statement on the line before so it should be indented.

fs/xfs/xfs_bit.h +1 -1
index f1e3c90..f685942 100644
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;
 	}
 	return n - 1;
 }
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

The "n += 32;" goes with the if statement on the line before so it should be indented.

Easy one ;)

Wow, it's been this way ever since 79071eb0 in 2008.

Quoted 19 lines
fs/xfs/xfs_bit.h +1 -1
index f1e3c90..f685942 100644
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;
 	}
 	return n - 1;
 }

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter

The "n += 32;" goes with the if statement on the line before so it should be indented.

fs/xfs/xfs_bit.h +0 -0
index f1e3c90..f685942 100644

fs/xfs/xfs_bit.h static inline int xfs_lowbit64(__uint64_t v) · line 70

Quoted 5 lines
fs/xfs/xfs_bit.h +1 -1
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;

If we want to clean up this stuff let's do it properly:

		if (w) {
			n = ffs(w);
			if (n)
				n += 32;
		}
#3 lore raw
Quoted 19 lines · Christoph Hellwig
Quoted 10 lines · Dan Carpenter

The "n += 32;" goes with the if statement on the line before so it should be indented.

fs/xfs/xfs_bit.h +0 -0
index f1e3c90..f685942 100644

fs/xfs/xfs_bit.h static inline int xfs_lowbit64(__uint64_t v) · line 70

Quoted 5 lines
fs/xfs/xfs_bit.h +1 -1
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;

If we want to clean up this stuff let's do it properly:

Quoted 6 lines
		if (w) {
			n = ffs(w);
			if (n)
				n += 32;
		}

Sure. I will resend.

regards,
dan carpenter

#4 lore raw

Am 21.05.2014 16:35, schrieb Dan Carpenter:

Quoted 20 lines · Christoph Hellwig
Quoted 19 lines · Dan Carpenter
Quoted 10 lines

The "n += 32;" goes with the if statement on the line before so it should be indented.

fs/xfs/xfs_bit.h +0 -0
index f1e3c90..f685942 100644

fs/xfs/xfs_bit.h static inline int xfs_lowbit64(__uint64_t v) · line 70

Quoted 5 lines
fs/xfs/xfs_bit.h +1 -1
@@ -67,7 +67,7 @@ static inline int xfs_lowbit64(__uint64_t v)
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
 		if (w && (n = ffs(w)))
-		n += 32;
+			n += 32;

If we want to clean up this stuff let's do it properly:

Quoted 7 lines
Quoted 6 lines
		if (w) {
			n = ffs(w);
			if (n)
				n += 32;
		}

This looks like a ffsll() maybe there are other implemantions and we can make a generic version (acualy i found only a ffsll() in nouvou, NTL).

just my 2 cents,

re,
wh

Quoted 11 lines

Sure. I will resend.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 2 lines · walter harms

This looks like a ffsll() maybe there are other implemantions and we can make a generic version (acualy i found only a ffsll() in nouvou, NTL).

All the helper in xfs_bit.[ch] are probably candidates for generic library functions.

#6 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · walter harms

This looks like a ffsll() maybe there are other implemantions and we can make a generic version (acualy i found only a ffsll() in nouvou, NTL).

All the helper in xfs_bit.[ch] are probably candidates for generic library functions.

Discussed in the thread:

http://oss.sgi.com/archives/xfs/2014-01/msg00542.html

--Mark.

#7 lore raw

PATCH v2 1/1 small cleanup in xfs_lowbit64()

In reply to Christoph Hellwig

There are two checkpatch.pl complaints here because of the bad indenting and because of the assignment inside the condition.

---
v2: more cleanups

fs/xfs/xfs_bit.h +5 -2
index f1e3c90..e1649c0 100644
@@ -66,8 +66,11 @@ static inline int xfs_lowbit64(__uint64_t v)
 		n = ffs(w);
 	} else {	/* upper bits */
 		w = (__uint32_t)(v >> 32);
-		if (w && (n = ffs(w)))
-		n += 32;
+		if (w) {
+			n = ffs(w);
+			if (n)
+				n += 32;
+		}
 	}
 	return n - 1;
 }