On Thu, 2002-06-13 at 22:34, Stipe Tolj wrote:
> Oded Arbel wrote:
> >
> > Hi.
> >
> > Just had a talk with my resident GCC guru, and his suggestion (which seems to work
>for me) is to #define the functions as nothing, i.e.
> > #define func_name(a)
> > thats it. nothing after that. now GCC is happy :-)
>
> Hmm, did you test the resulting bearerbox at least?!
>
> I'm not quite sure, but there are dependancies to the func_name()
> somewhere else and this may conflict if the macro return simply
> nothing.
You have to return its own parameter because there's functions
somewhere like ocstr_destroy(gw_claim_area(xpto))
I'll apply this patch if you agree:
Index: gwlib/gwmem-native.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/gwmem-native.c,v
retrieving revision 1.5
diff -u -r1.5 gwmem-native.c
--- gwlib/gwmem-native.c 10 Jan 2001 16:45:26 -0000 1.5
+++ gwlib/gwmem-native.c 14 Jun 2002 12:04:26 -0000
@@ -18,6 +18,8 @@
#undef realloc
#undef free
+void *gw_void(void *ptr) { return ptr; }
+
void *gw_native_malloc(size_t size)
{
void *ptr;
Index: gwlib/gwmem.h
===================================================================
RCS file: /home/cvs/gateway/gwlib/gwmem.h,v
retrieving revision 1.19
diff -u -r1.19 gwmem.h
--- gwlib/gwmem.h 2 Feb 2001 15:54:08 -0000 1.19
+++ gwlib/gwmem.h 14 Jun 2002 12:04:26 -0000
@@ -42,6 +42,8 @@
void gw_check_shutdown(void);
+void *gw_void(void *ptr);
+
/*
* "slow" == "checking" with a small variation.
*/
@@ -63,7 +65,7 @@
#define gw_free(ptr) (gw_native_free(ptr))
#define gw_strdup(str) (gw_native_strdup(str))
#define gw_assert_allocated(ptr, file, line, function)
-#define gw_claim_area(ptr) (ptr)
+#define gw_claim_area(ptr) (gw_void(ptr))
#define gw_claim_area_for(ptr, file, line, func) (ptr)
#define gwmem_shutdown()
#define gwmem_type() (octstr_imm("native"))