Author: chromatic
Date: Wed May 16 22:21:20 2007
New Revision: 18579
Modified:
trunk/include/parrot/memory.h
trunk/include/parrot/string_funcs.h
trunk/src/gc/memory.c
trunk/src/string.c
Log:
[GC] Add const qualifiers to free() signature (Mike Mattie, RT #42961).
Modified: trunk/include/parrot/memory.h
==============================================================================
--- trunk/include/parrot/memory.h (original)
+++ trunk/include/parrot/memory.h Wed May 16 22:21:20 2007
@@ -1,5 +1,5 @@
/* memory.h
- * Copyright (C) 2001-2003, The Perl Foundation.
+ * Copyright (C) 2001-2007, The Perl Foundation.
* SVN Info
* $Id$
* Overview:
@@ -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(void *);
+PARROT_API void mem_sys_free(const void * const);
void *mem__internal_allocate(size_t, const char *, int);
#define mem_internal_allocate(x) mem__internal_allocate(x, __FILE__, __LINE__)
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Wed May 16 22:21:20 2007
@@ -1,5 +1,5 @@
/* string_funcs.h
- * Copyright (C) 2001-2006, The Perl Foundation.
+ * Copyright (C) 2001-2007, The Perl Foundation.
* SVN Info
* $Id$
* Overview:
@@ -83,7 +83,7 @@
PARROT_API STRING *const_string(Interp *, const char *buffer)
__attribute__nonnull__(2);
PARROT_API char *string_to_cstring(Interp *, STRING *);
-PARROT_API void string_cstring_free(char *);
+PARROT_API void string_cstring_free(const char * const);
PARROT_API void string_pin(Interp *, STRING *);
PARROT_API void string_unpin(Interp *, STRING *);
PARROT_API STRING *string_bitwise_and(Interp *interp, STRING *s1,
Modified: trunk/src/gc/memory.c
==============================================================================
--- trunk/src/gc/memory.c (original)
+++ trunk/src/gc/memory.c Wed May 16 22:21:20 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2006, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -153,13 +153,13 @@
*/
void
-mem_sys_free(void *from)
+mem_sys_free(const void * const from)
{
#ifdef DETAIL_MEMORY_DEBUG
fprintf(stderr, "Freed %p\n", from);
#endif
if (from)
- free(from);
+ free((void *)from);
}
void
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Wed May 16 22:21:20 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2006, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -1878,7 +1878,7 @@
*/
void
-string_cstring_free(char *p)
+string_cstring_free(const char * const p)
{
mem_sys_free(p);
}