diff mbox

ui: Replace non-portable asprintf by g_strdup_printf

Message ID 1358357920-7543-1-git-send-email-sw@weilnetz.de
State Accepted
Headers show

Commit Message

Stefan Weil Jan. 16, 2013, 5:38 p.m. UTC
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

This code is untested because I don't have a Mac available.
Portability is unimportant here (it's only for cocoa),
but I replaced asprintf nevertheless for the sake of
uniformity of QEMU's code.

Regards,
Stefan Weil

 ui/cocoa.m |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andreas Färber Jan. 26, 2013, 6:20 p.m. UTC | #1
Am 16.01.2013 18:38, schrieb Stefan Weil:
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 
> This code is untested because I don't have a Mac available.
> Portability is unimportant here (it's only for cocoa),
> but I replaced asprintf nevertheless for the sake of
> uniformity of QEMU's code.

Builds fine. Thanks, applied to cocoa-for-upstream queue:
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/cocoa-for-upstream

Mentioning "cocoa" in the subject and CC'ing me would've been helpful
for finding this patch.

Andreas

> 
> Regards,
> Stefan Weil
> 
>  ui/cocoa.m |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 3bf1c6e..754b95c 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -813,9 +813,9 @@ QemuCocoaView *cocoaView;
>  
>          [sheet close];
>  
> -        asprintf(&argv[0], "%s", bin);
> -        asprintf(&argv[1], "-hda");
> -        asprintf(&argv[2], "%s", img);
> +        argv[0] = g_strdup_printf("%s", bin);
> +        argv[1] = g_strdup_printf("-hda");
> +        argv[2] = g_strdup_printf("%s", img);
>  
>          printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
>  
>
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 3bf1c6e..754b95c 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -813,9 +813,9 @@  QemuCocoaView *cocoaView;
 
         [sheet close];
 
-        asprintf(&argv[0], "%s", bin);
-        asprintf(&argv[1], "-hda");
-        asprintf(&argv[2], "%s", img);
+        argv[0] = g_strdup_printf("%s", bin);
+        argv[1] = g_strdup_printf("-hda");
+        argv[2] = g_strdup_printf("%s", img);
 
         printf("Using argc %d argv %s -hda %s\n", 3, bin, img);