diff options
Diffstat (limited to 'gnulib-local')
-rw-r--r-- | gnulib-local/ChangeLog | 5 | ||||
-rw-r--r-- | gnulib-local/lib/xalloc.h | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index d16273b..3cfbae7 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,5 +1,10 @@ 2006-11-26 Bruno Haible <bruno@clisp.org> + * lib/xalloc.h (xmemdup): Add a typesafe C++ template variant. + Based on a patch from Paul Eggert in gnulib. + +2006-11-26 Bruno Haible <bruno@clisp.org> + Optimize IS_INSTANCE. * build-aux/moopp: Emit also a classname_SUPERCLASSES_LENGTH macro. * lib/moo.h (IS_INSTANCE): Use the value of this macro, known at diff --git a/gnulib-local/lib/xalloc.h b/gnulib-local/lib/xalloc.h index 1168a54..e92d9a3 100644 --- a/gnulib-local/lib/xalloc.h +++ b/gnulib-local/lib/xalloc.h @@ -52,7 +52,7 @@ extern void *xrealloc (void *ptr, size_t size); template <typename T> inline T * xrealloc (T * ptr, size_t size) { - return (T *) xrealloc((void *) ptr, size); + return (T *) xrealloc ((void *) ptr, size); } extern "C" { #endif @@ -121,6 +121,15 @@ xnboundedmalloc (size_t n, size_t bound, size_t s) /* Return a newly allocated copy of the N bytes of memory starting at P. */ extern void *xmemdup (const void *p, size_t n); +#ifdef __cplusplus +} +template <typename T> + inline T * xmemdup (const T * p, size_t n) + { + return (T *) xmemdup ((const void *) p, n); + } +extern "C" { +#endif /* Return a newly allocated copy of STRING. */ extern char *xstrdup (const char *string); |