Hi Paul,

In case HAVE_INLINE is not defined, xnmalloc is not an inline function.
XNMALLOC (n, char) was optimized to a single xmalloc call. Can we restore
this optimization?

2006-11-06  Bruno Haible  <[EMAIL PROTECTED]>

        * lib/xalloc.h (XNMALLOC): Restore optimization of sizeof(T) = 1 case.

*** gnulib-20061106/lib/xalloc.h        2006-11-07 03:13:57.000000000 +0100
--- gnulib-20061106-modified/lib/xalloc.h       2006-11-07 03:30:02.000000000 
+0100
***************
*** 149,155 ****
  
  /* Allocate memory for N elements of type T, with error checking.  */
  /* extern t *XNMALLOC (size_t n, typename t); */
! #define XNMALLOC(n, t) ((t *) xnmalloc (n, sizeof (t)))
  
  /* Allocate an object of type T dynamically, with error checking,
     and zero it.  */
--- 149,156 ----
  
  /* Allocate memory for N elements of type T, with error checking.  */
  /* extern t *XNMALLOC (size_t n, typename t); */
! #define XNMALLOC(n, t) \
!   ((t *) (sizeof (t) == 1 ? xmalloc (n) : xnmalloc (n, sizeof (t))))
  
  /* Allocate an object of type T dynamically, with error checking,
     and zero it.  */


Reply via email to