Message ID | 20190705153811.22652-17-gorcunov@gmail.com |
---|---|
State | Accepted |
Series | "mem: Cleanup and fixups" |
Commit | 728c9afae2f1b314283c61f3444676ce475a641c |
Headers | show |
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 {
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 >
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(-)