Re: Proposed addition of malloc_size_np()
- From: Jason Evans <jasone@xxxxxxxxxxx>
- Date: Sat, 25 Mar 2006 00:07:39 -0800
Poul-Henning Kamp wrote:
In message <44247DF1.8000002@xxxxxxxxxxx>, Jason Evans writes:
=== Proposal ===
Add malloc_size_np() to libc, and provide the prototype in malloc_np.h:
size_t
malloc_size_np(const void *ptr);
I'm for the concept, but wonder if it would be smarter to make it
void *
malloc_np(size_t, size_t *)
so we can do it in one go ?
I can see how this would be useful, but I don't think it completely replaces the use case for malloc_size_np(), which can be useful at other times than allocation/deallocation (ex: assertions that detect buffer overflow). Also, if we add malloc_np(), for completeness we should also provide:
void *
calloc_np(size_t size, size_t *size_ceil);
void *
realloc_np(void *ptr, size_t size, size_t *size_ceil);
(Let's ignore posix_memalign() here.)
size_t
free_np(void *ptr);
Given that these functions are essentially the (somewhat higher performance) fusion of two function calls, it isn't clear to me whether it's worth adding several extra functions. Personally, I would use them if they were available, but I'm not sure if they would be broadly useful. Thoughts?
Thanks,
Jason
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"
- References:
- Re: Proposed addition of malloc_size_np()
- From: Poul-Henning Kamp
- Re: Proposed addition of malloc_size_np()
- Prev by Date: Re: Proposed addition of malloc_size_np()
- Next by Date: Re: Proposed addition of malloc_size_np()
- Previous by thread: Re: Proposed addition of malloc_size_np()
- Next by thread: Re: Proposed addition of malloc_size_np()
- Index(es):
Relevant Pages
|
|