[Spice-devel,xf86-video-qxl,10/13] mspace: no more warnings

Submitted by Alon Levy on April 9, 2012, 5:33 p.m.

Details

Message ID 1333992799-14302-11-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy April 9, 2012, 5:33 p.m.
---
 src/mspace.c |   11 ++++++-----
 src/mspace.h |    5 ++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mspace.c b/src/mspace.c
index 94d50e6..17d976a 100644
--- a/src/mspace.c
+++ b/src/mspace.c
@@ -21,8 +21,6 @@ 
 #include <string.h>
 #include "mspace.h"
 
-#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
-
 #define MALLOC_ALIGNMENT ((size_t)8U)
 #define USE_LOCKS 0
 #define malloc_getpagesize ((size_t)4096U)
@@ -47,12 +45,12 @@ 
 
 #define M_GRANULARITY        (-1)
 
-void default_abort_func(void *user_data)
+void __attribute__ ((__noreturn__)) default_abort_func(void *user_data)
 {
     for (;;);
 }
 
-void default_print_func(void *user_data, char *format, ...)
+void default_print_func(void *user_data, const char *format, ...)
 {
 }
 
@@ -762,6 +760,7 @@  static struct malloc_params mparams;
 #define segment_holds(S, A)\
   ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
 
+#if DEBUG
 /* Return segment holding given address */
 static msegmentptr segment_holding(mstate m, char* addr) {
   msegmentptr sp = &m->seg;
@@ -783,7 +782,7 @@  static int has_segment_link(mstate m, msegmentptr ss) {
       return 0;
   }
 }
-
+#endif
 
 
 /*
@@ -1795,6 +1794,7 @@  static void reset_on_error(mstate m) {
 }
 #endif /* PROCEED_ON_ERROR */
 
+#if 0
 /* Allocate chunk and prepend remainder with chunk in successor base. */
 static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
                            size_t nb) {
@@ -1836,6 +1836,7 @@  static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
   check_malloced_chunk(m, chunk2mem(p), nb);
   return chunk2mem(p);
 }
+#endif
 
 /* -------------------------- System allocation -------------------------- */
 
diff --git a/src/mspace.h b/src/mspace.h
index 96b0593..8f5ba83 100644
--- a/src/mspace.h
+++ b/src/mspace.h
@@ -9,11 +9,14 @@  extern "C" {
 
 //typedef unsigned long size_t;
 typedef void (*mspace_abort_t)(void *user_data);
-typedef void (*mspace_print_t)(void *user_data, char *format, ...);
+typedef void (*mspace_print_t)(void *user_data, const char *format, ...);
 
 void mspace_set_abort_func(mspace_abort_t f);
 void mspace_set_print_func(mspace_print_t f);
 
+void default_abort_func(void *user_data);
+void default_print_func(void *user_data, const char *format, ...);
+
 /*
   mspace is an opaque type representing an independent
   region of space that supports mspace_malloc, etc.

Comments

ACK
On Mon, Apr 09, 2012 at 08:33:16PM +0300, Alon Levy wrote:
> ---
>  src/mspace.c |   11 ++++++-----
>  src/mspace.h |    5 ++++-
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mspace.c b/src/mspace.c
> index 94d50e6..17d976a 100644
> --- a/src/mspace.c
> +++ b/src/mspace.c
> @@ -21,8 +21,6 @@
>  #include <string.h>
>  #include "mspace.h"
>  
> -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */
> -
>  #define MALLOC_ALIGNMENT ((size_t)8U)
>  #define USE_LOCKS 0
>  #define malloc_getpagesize ((size_t)4096U)
> @@ -47,12 +45,12 @@
>  
>  #define M_GRANULARITY        (-1)
>  
> -void default_abort_func(void *user_data)
> +void __attribute__ ((__noreturn__)) default_abort_func(void *user_data)
>  {
>      for (;;);
>  }
>  
> -void default_print_func(void *user_data, char *format, ...)
> +void default_print_func(void *user_data, const char *format, ...)
>  {
>  }
>  
> @@ -762,6 +760,7 @@ static struct malloc_params mparams;
>  #define segment_holds(S, A)\
>    ((char*)(A) >= S->base && (char*)(A) < S->base + S->size)
>  
> +#if DEBUG
>  /* Return segment holding given address */
>  static msegmentptr segment_holding(mstate m, char* addr) {
>    msegmentptr sp = &m->seg;
> @@ -783,7 +782,7 @@ static int has_segment_link(mstate m, msegmentptr ss) {
>        return 0;
>    }
>  }
> -
> +#endif
>  
>  
>  /*
> @@ -1795,6 +1794,7 @@ static void reset_on_error(mstate m) {
>  }
>  #endif /* PROCEED_ON_ERROR */
>  
> +#if 0
>  /* Allocate chunk and prepend remainder with chunk in successor base. */
>  static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
>                             size_t nb) {
> @@ -1836,6 +1836,7 @@ static void* prepend_alloc(mstate m, char* newbase, char* oldbase,
>    check_malloced_chunk(m, chunk2mem(p), nb);
>    return chunk2mem(p);
>  }
> +#endif
>  
>  /* -------------------------- System allocation -------------------------- */
>  
> diff --git a/src/mspace.h b/src/mspace.h
> index 96b0593..8f5ba83 100644
> --- a/src/mspace.h
> +++ b/src/mspace.h
> @@ -9,11 +9,14 @@ extern "C" {
>  
>  //typedef unsigned long size_t;
>  typedef void (*mspace_abort_t)(void *user_data);
> -typedef void (*mspace_print_t)(void *user_data, char *format, ...);
> +typedef void (*mspace_print_t)(void *user_data, const char *format, ...);
>  
>  void mspace_set_abort_func(mspace_abort_t f);
>  void mspace_set_print_func(mspace_print_t f);
>  
> +void default_abort_func(void *user_data);
> +void default_print_func(void *user_data, const char *format, ...);
> +
>  /*
>    mspace is an opaque type representing an independent
>    region of space that supports mspace_malloc, etc.
> -- 
> 1.7.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel