[16/16] mem/shmem: Fix typos for_each_shmem macro

Submitted by Cyrill Gorcunov on July 5, 2019, 3:38 p.m.

Details

Message ID 20190705153811.22652-17-gorcunov@gmail.com
State Accepted
Series "mem: Cleanup and fixups"
Headers show

Commit Message

Cyrill Gorcunov July 5, 2019, 3:38 p.m.
Since we use _i as a counter in macro declaration
we should use it as a reference. This macro simply
happen to work now because of being called with
variable i declarated in the caller code.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/shmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/shmem.c b/criu/shmem.c
index 1ca1b89320d2..965fecc56893 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -43,8 +43,8 @@ 
 #define SHMEM_HASH_SIZE	32
 static struct hlist_head shmems_hash[SHMEM_HASH_SIZE];
 
-#define for_each_shmem(_i, _si)				\
-	for (i = 0; i < SHMEM_HASH_SIZE; i++)			\
+#define for_each_shmem(_i, _si)					\
+	for (_i = 0; _i < SHMEM_HASH_SIZE; _i++)		\
 		hlist_for_each_entry(_si, &shmems_hash[_i], h)
 
 struct shmem_info {

Comments

Mike Rapoport July 8, 2019, 5:10 p.m.
On Fri, Jul 05, 2019 at 06:38:11PM +0300, Cyrill Gorcunov wrote:
> Since we use _i as a counter in macro declaration
> we should use it as a reference. This macro simply
> happen to work now because of being called with
> variable i declarated in the caller code.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  criu/shmem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/shmem.c b/criu/shmem.c
> index 1ca1b89320d2..965fecc56893 100644
> --- a/criu/shmem.c
> +++ b/criu/shmem.c
> @@ -43,8 +43,8 @@
>  #define SHMEM_HASH_SIZE	32
>  static struct hlist_head shmems_hash[SHMEM_HASH_SIZE];
>  
> -#define for_each_shmem(_i, _si)				\
> -	for (i = 0; i < SHMEM_HASH_SIZE; i++)			\
> +#define for_each_shmem(_i, _si)					\
> +	for (_i = 0; _i < SHMEM_HASH_SIZE; _i++)		\
>  		hlist_for_each_entry(_si, &shmems_hash[_i], h)
>  
>  struct shmem_info {
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>