Patchwork [v2,15/27] qdev: remove parse method for string properties

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 4, 2012, 8:02 a.m.
Message ID <1328342577-25732-16-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/139544/
State New
Headers show

Comments

Paolo Bonzini - Feb. 4, 2012, 8:02 a.m.
We need the print method to put double quotes, but parsing is not special.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev-properties.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
Anthony Liguori - Feb. 6, 2012, 2:31 p.m.
On 02/04/2012 02:02 AM, Paolo Bonzini wrote:
> We need the print method to put double quotes, but parsing is not special.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   hw/qdev-properties.c |   11 -----------
>   1 files changed, 0 insertions(+), 11 deletions(-)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 5e19ec8..1fc77b5 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -510,16 +510,6 @@ PropertyInfo qdev_prop_hex64 = {
>
>   /* --- string --- */
>
> -static int parse_string(DeviceState *dev, Property *prop, const char *str)
> -{
> -    char **ptr = qdev_get_prop_ptr(dev, prop);
> -
> -    if (*ptr)
> -        g_free(*ptr);
> -    *ptr = g_strdup(str);
> -    return 0;
> -}
> -
>   static void free_string(DeviceState *dev, Property *prop)
>   {
>       g_free(*(char **)qdev_get_prop_ptr(dev, prop));
> @@ -581,7 +571,6 @@ PropertyInfo qdev_prop_string = {
>       .name  = "string",
>       .type  = PROP_TYPE_STRING,
>       .size  = sizeof(char*),
> -    .parse = parse_string,
>       .print = print_string,
>       .free  = free_string,
>       .get   = get_string,

Patch

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 5e19ec8..1fc77b5 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -510,16 +510,6 @@  PropertyInfo qdev_prop_hex64 = {
 
 /* --- string --- */
 
-static int parse_string(DeviceState *dev, Property *prop, const char *str)
-{
-    char **ptr = qdev_get_prop_ptr(dev, prop);
-
-    if (*ptr)
-        g_free(*ptr);
-    *ptr = g_strdup(str);
-    return 0;
-}
-
 static void free_string(DeviceState *dev, Property *prop)
 {
     g_free(*(char **)qdev_get_prop_ptr(dev, prop));
@@ -581,7 +571,6 @@  PropertyInfo qdev_prop_string = {
     .name  = "string",
     .type  = PROP_TYPE_STRING,
     .size  = sizeof(char*),
-    .parse = parse_string,
     .print = print_string,
     .free  = free_string,
     .get   = get_string,