[libgpiod] iter: remove unnecessary indirection in free_dirs
diff mbox series

Message ID 92120a07-6945-1be9-15de-9e9a461c45bc@nisbet.kiwi.nz
State New
Headers show
Series
  • [libgpiod] iter: remove unnecessary indirection in free_dirs
Related show

Commit Message

Nisbet, Chris Jan. 18, 2020, 1:20 a.m. UTC
It is not necessary to pass the address of the 'dirs' variable to
dirs_free(), so this commit removes the unnecessary indirection.

Signed-off-by: Chris Nisbet <chris@nisbet.kiwi.nz>
---
  lib/iter.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Bartosz Golaszewski Jan. 23, 2020, 5:12 p.m. UTC | #1
sob., 18 sty 2020 o 02:30 Nisbet, Chris <chris@nisbet.kiwi.nz> napisał(a):
>
> It is not necessary to pass the address of the 'dirs' variable to
> dirs_free(), so this commit removes the unnecessary indirection.
>
> Signed-off-by: Chris Nisbet <chris@nisbet.kiwi.nz>

Hi Chris,

this looks good but it doesn't apply on top of current master. Can you
rebase it and resend?

Bartosz

Patch
diff mbox series

diff --git a/lib/iter.c b/lib/iter.c
index a4d883a..bfd2852 100644
--- a/lib/iter.c
+++ b/lib/iter.c
@@ -28,13 +28,13 @@  static int dir_filter(const struct dirent *dir)
      return !strncmp(dir->d_name, "gpiochip", 8);
  }

-static void free_dirs(struct dirent ***dirs, unsigned int num_dirs)
+static void free_dirs(struct dirent **dirs, unsigned int num_dirs)
  {
      unsigned int i;

      for (i = 0; i < num_dirs; i++)
-        free((*dirs)[i]);
-    free(*dirs);
+        free(dirs[i]);
+    free(dirs);
  }

  struct gpiod_chip_iter *gpiod_chip_iter_new(void)
@@ -69,7 +69,7 @@  struct gpiod_chip_iter *gpiod_chip_iter_new(void)
              goto err_close_chips;
      }

-    free_dirs(&dirs, num_chips);
+    free_dirs(dirs, num_chips);

      return iter;

@@ -85,7 +85,7 @@  err_free_iter:
      free(iter);

  err_free_dirs:
-    free_dirs(&dirs, num_chips);
+    free_dirs(dirs, num_chips);

      return NULL;
  }