Re: [Spice-devel] [PATCH] reds: constification

2016-02-04 Thread Daniel P. Berrange
On Thu, Feb 04, 2016 at 04:03:10PM +, Frediano Ziglio wrote:
> Make version_string a constant.
> Also there is no need to have a pointer but declare the buffer as static
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  server/reds.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index edbdaad..4225847 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3299,7 +3299,7 @@ static void reds_init_vd_agent_resources(RedsState 
> *reds)
>  }
>  }
>  
> -const char *version_string = VERSION;
> +static const char version_string[] = VERSION;

The 'version_string' is only used once:

$ git grep version_string
reds.c:const char *version_string = VERSION;
reds.c:spice_info("starting %s", version_string);

So why not just kill the pointless variable and directly
use 'VERSION' in the call to spice_info()

Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] reds: constification

2016-02-04 Thread Frediano Ziglio
Make version_string a constant.
Also there is no need to have a pointer but declare the buffer as static

Signed-off-by: Frediano Ziglio 
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index edbdaad..4225847 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3299,7 +3299,7 @@ static void reds_init_vd_agent_resources(RedsState *reds)
 }
 }
 
-const char *version_string = VERSION;
+static const char version_string[] = VERSION;
 
 static int do_spice_init(RedsState *reds, SpiceCoreInterface *core_interface)
 {
-- 
2.5.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel