static _int_malloc et al
Roland McGrath
roland@redhat.com
Tue Jan 7 07:50:00 GMT 2003
Hi.
Is there any special reason _int_malloc et al should be static rather than
just hidden? I anticipate at some point using these routines from another
part of libc, in the Hurd port at least.
How about this? (I'm including the malloc.c patch since it's literally
just the cvs diff of the last commit inverted.)
2003-01-06 Roland McGrath <roland@redhat.com>
* malloc/malloc.c: Revert last change.
* malloc/malloc.h (_int_*): Move these decls to ...
* include/malloc.h: ... here. Add attribute_hidden.
Index: malloc/malloc.h
===================================================================
RCS file: /cvs/glibc/libc/malloc/malloc.h,v
retrieving revision 1.22
diff -p -u -r1.22 malloc.h
--- malloc/malloc.h 12 Mar 2002 21:58:54 -0000 1.22
+++ malloc/malloc.h 7 Jan 2003 07:47:49 -0000
@@ -224,18 +224,6 @@ extern void (*__after_morecore_hook) __M
/* Activate a standard set of debugging hooks. */
extern void __malloc_check_init __MALLOC_P ((void));
-/* Internal routines, operating on "arenas". */
-struct malloc_state;
-typedef struct malloc_state *mstate;
-
-extern mstate _int_new_arena __MALLOC_P ((size_t __ini_size));
-extern __malloc_ptr_t _int_malloc __MALLOC_P ((mstate __m, size_t __size));
-extern void _int_free __MALLOC_P ((mstate __m, __malloc_ptr_t __ptr));
-extern __malloc_ptr_t _int_realloc __MALLOC_P ((mstate __m,
- __malloc_ptr_t __ptr,
- size_t __size));
-extern __malloc_ptr_t _int_memalign __MALLOC_P ((mstate __m, size_t __alignment,
- size_t __size));
#ifdef __cplusplus
}; /* end of extern "C" */
Index: include/malloc.h
===================================================================
RCS file: /cvs/glibc/libc/include/malloc.h,v
retrieving revision 1.2
diff -p -u -r1.2 malloc.h
--- include/malloc.h 12 Mar 2002 21:58:14 -0000 1.2
+++ include/malloc.h 7 Jan 2003 07:47:49 -0000
@@ -8,4 +8,19 @@
/* Nonzero if the malloc is already initialized. */
extern int __malloc_initialized attribute_hidden;
+/* Internal routines, operating on "arenas". */
+struct malloc_state;
+typedef struct malloc_state *mstate;
+
+extern mstate _int_new_arena (size_t __ini_size) attribute_hidden;
+extern __malloc_ptr_t _int_malloc (mstate __m, size_t __size) attribute_hidden;
+extern void _int_free (mstate __m, __malloc_ptr_t __ptr)
+ attribute_hidden;
+extern __malloc_ptr_t _int_realloc (mstate __m,
+ __malloc_ptr_t __ptr,
+ size_t __size) attribute_hidden;
+extern __malloc_ptr_t _int_memalign (mstate __m, size_t __alignment,
+ size_t __size)
+ attribute_hidden;
+
#endif
More information about the Libc-hacker
mailing list