[libvirt] [PATCH 07/18] virpcimock: Rename @fakesysfspcidir

Michal Privoznik posted 18 patches 6 years, 5 months ago
[libvirt] [PATCH 07/18] virpcimock: Rename @fakesysfspcidir
Posted by Michal Privoznik 6 years, 5 months ago
We will need to create more directories and instead of
introducing bunch of new variables to hold their actual
paths, we can have one and reuse it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/virpcimock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 296da9b453..e97dbd81f8 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -831,7 +831,7 @@ init_syms(void)
 static void
 init_env(void)
 {
-    VIR_AUTOFREE(char *) fakesysfspcidir = NULL;
+    VIR_AUTOFREE(char *) tmp = NULL;
 
     if (fakerootdir)
         return;
@@ -839,14 +839,14 @@ init_env(void)
     if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))
         ABORT("Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
 
-    if (virAsprintfQuiet(&fakesysfspcidir, "%s%s",
+    if (virAsprintfQuiet(&tmp, "%s%s",
                          fakerootdir, SYSFS_PCI_PREFIX) < 0)
         ABORT_OOM();
 
-    if (virFileMakePath(fakesysfspcidir) < 0)
-        ABORT("Unable to create: %s", fakesysfspcidir);
+    if (virFileMakePath(tmp) < 0)
+        ABORT("Unable to create: %s", tmp);
 
-    make_file(fakesysfspcidir, "drivers_probe", NULL, -1);
+    make_file(tmp, "drivers_probe", NULL, -1);
 
 # define MAKE_PCI_DRIVER(name, ...) \
     pci_driver_new(name, 0, __VA_ARGS__, -1, -1)
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 07/18] virpcimock: Rename @fakesysfspcidir
Posted by Daniel Henrique Barboza 6 years, 5 months ago
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

On 8/14/19 8:57 AM, Michal Privoznik wrote:
> We will need to create more directories and instead of
> introducing bunch of new variables to hold their actual
> paths, we can have one and reuse it.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>   tests/virpcimock.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tests/virpcimock.c b/tests/virpcimock.c
> index 296da9b453..e97dbd81f8 100644
> --- a/tests/virpcimock.c
> +++ b/tests/virpcimock.c
> @@ -831,7 +831,7 @@ init_syms(void)
>   static void
>   init_env(void)
>   {
> -    VIR_AUTOFREE(char *) fakesysfspcidir = NULL;
> +    VIR_AUTOFREE(char *) tmp = NULL;
>   
>       if (fakerootdir)
>           return;
> @@ -839,14 +839,14 @@ init_env(void)
>       if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))
>           ABORT("Missing LIBVIRT_FAKE_ROOT_DIR env variable\n");
>   
> -    if (virAsprintfQuiet(&fakesysfspcidir, "%s%s",
> +    if (virAsprintfQuiet(&tmp, "%s%s",
>                            fakerootdir, SYSFS_PCI_PREFIX) < 0)
>           ABORT_OOM();
>   
> -    if (virFileMakePath(fakesysfspcidir) < 0)
> -        ABORT("Unable to create: %s", fakesysfspcidir);
> +    if (virFileMakePath(tmp) < 0)
> +        ABORT("Unable to create: %s", tmp);
>   
> -    make_file(fakesysfspcidir, "drivers_probe", NULL, -1);
> +    make_file(tmp, "drivers_probe", NULL, -1);
>   
>   # define MAKE_PCI_DRIVER(name, ...) \
>       pci_driver_new(name, 0, __VA_ARGS__, -1, -1)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list