On Tue, 22 May 2007 14:24:14 -0700 Steve Peters (via RT) <[EMAIL PROTECTED]> wrote:
> # New Ticket Created by Steve Peters > # Please include the string: [perl #43033] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43033 > > > > free() assumes its passed a void *. mem_sys_free() should take the > same type of argument. Assuming that what you are passing to free() > will never be modified is a bit risky and may prevent various memory > debugging aids from working correctly. I just changed that actually. It looks like the const laundering was dropped. What kind of debugging aids are you talking about ? I changed it for good reasons. I noticed a patch where a developer dropped useful const attributes because of a warning from the compiler. non-const pointers passed through a const qualified mem_sys_free are automatically promoted, and the const was stripped off before being passed to free. If I launder the const const pointer would the need for this patch be removed ? > Steve Peters > [EMAIL PROTECTED] > > Index: src/gc/memory.c > =================================================================== > --- src/gc/memory.c (revision 18626) > +++ src/gc/memory.c (working copy) > @@ -153,13 +153,13 @@ > */ > > void > -mem_sys_free(const void * const from) > +mem_sys_free(void * from) > { > #ifdef DETAIL_MEMORY_DEBUG > fprintf(stderr, "Freed %p\n", from); > #endif > if (from) > - free((void *)from); > + free(from); > } > > void > Index: include/parrot/memory.h > =================================================================== > --- include/parrot/memory.h (revision 18626) > +++ include/parrot/memory.h (working copy) > @@ -19,7 +19,7 @@ > > PARROT_API void *mem__sys_realloc(void *, size_t); > #define mem_sys_realloc(x,y) (assert(x!=NULL), mem__sys_realloc(x,y)) > -PARROT_API void mem_sys_free(const void * const); > +PARROT_API void mem_sys_free(void *); > > void *mem__internal_allocate(size_t, const char *, int); > #define mem_internal_allocate(x) mem__internal_allocate(x, __FILE__, > __LINE__)
signature.asc
Description: PGP signature