Re: [PATCH 1/5] common: constify some declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

On Wed, 2016-01-27 at 16:09 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  common/log.c        | 2 +-
>  common/marshaller.c | 7 +++++--
>  common/marshaller.h | 2 +-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/common/log.c b/common/log.c
> index 607aa82..a9bbebc 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -43,7 +43,7 @@ static int abort_level = -1;
>  
>  static GLogLevelFlags spice_log_level_to_glib(SpiceLogLevel level)
>  {
> -    static GLogLevelFlags glib_levels[] = {
> +    static const GLogLevelFlags glib_levels[] = {
>          [ SPICE_LOG_LEVEL_ERROR ] = G_LOG_LEVEL_ERROR,
>          [ SPICE_LOG_LEVEL_CRITICAL ] = G_LOG_LEVEL_CRITICAL,
>          [ SPICE_LOG_LEVEL_WARNING ] = G_LOG_LEVEL_WARNING,
> diff --git a/common/marshaller.c b/common/marshaller.c
> index c967371..c1d208e 100644
> --- a/common/marshaller.c
> +++ b/common/marshaller.c
> @@ -347,9 +347,12 @@ uint8_t *spice_marshaller_add(SpiceMarshaller *m, const
> uint8_t *data, size_t si
>      return ptr;
>  }
>  
> -uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t
> size)
> +uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data,
> size_t size)
>  {
> -    return spice_marshaller_add_ref_full(m, data, size, NULL, NULL);
> +    /* the cast to no-const here is safe as data is used for writing only if
> +     * free_data pointer is not NULL
> +     */
> +    return spice_marshaller_add_ref_full(m, (uint8_t *) data, size, NULL,
> NULL);
>  }
>  
>  void spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks *chunks)
> diff --git a/common/marshaller.h b/common/marshaller.h
> index b698b69..9f9c3ad 100644
> --- a/common/marshaller.h
> +++ b/common/marshaller.h
> @@ -37,7 +37,7 @@ void spice_marshaller_destroy(SpiceMarshaller *m);
>  uint8_t *spice_marshaller_reserve_space(SpiceMarshaller *m, size_t size);
>  void spice_marshaller_unreserve_space(SpiceMarshaller *m, size_t size);
>  uint8_t *spice_marshaller_add(SpiceMarshaller *m, const uint8_t *data, size_t
> size);
> -uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, uint8_t *data, size_t
> size);
> +uint8_t *spice_marshaller_add_ref(SpiceMarshaller *m, const uint8_t *data,
> size_t size);
>  uint8_t *spice_marshaller_add_ref_full(SpiceMarshaller *m, uint8_t *data,
> size_t size,
>                                         spice_marshaller_item_free_func
> free_data, void *opaque);
>  void     spice_marshaller_add_ref_chunks(SpiceMarshaller *m, SpiceChunks
> *chunks);
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]