Changeset 2798


Ignore:
Timestamp:
Sep 19, 2015, 10:35:03 PM (10 years ago)
Author:
bird
Message:

electric.*: Made it work with recent gcc versions.

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/kmk/electric.c

    r2626 r2798  
    3131#  include <sys/mman.h>
    3232#  include <errno.h>
     33#  include <stdint.h>
    3334# endif
    3435# include <string.h>
     
    157158# endif
    158159}
     160
    159161
    160162void *
     
    193195}
    194196
     197# ifdef __GNUC__
     198void *
     199xmalloc_size_t (size_t size)
     200{
     201  return xmalloc(size);
     202}
     203
     204void *
     205xcalloc_size_t (size_t size, size_t items)
     206{
     207  return xcalloc(size * items);
     208}
     209
     210void *
     211xrealloc_size_t (void *ptr, size_t size)
     212{
     213  return xrealloc(ptr, size);
     214}
     215# endif /* __GNUC__ */
     216
    195217#else /* !ELECTRIC_HEAP */
    196218extern void electric_heap_keep_ansi_c_quiet (void);
  • TabularUnified trunk/src/kmk/electric.h

    r2591 r2798  
    3737void *xrealloc (void *, unsigned int);
    3838char *xstrdup (const char *);
     39#ifdef __GNUC__
     40void *xmalloc_size_t (size_t size);
     41void *xcalloc_size_t (size_t size, size_t items);
     42void *xrealloc_size_t (void *ptr, size_t size);
     43#endif
    3944
     45
     46#undef  free
    4047#define free(a)         xfree(a)
    41 #define calloc(a,b)     xcalloc((a) * (b))
    42 #define malloc(a)       xmalloc(a)
    43 #define realloc(a,b)    xrealloc((a),(b))
     48#undef  strdup
    4449#define strdup(a)       xstrdup(a)
     50
     51#undef  calloc
     52#undef  malloc
     53#undef  realloc
     54#ifdef __GNUC__
     55# define calloc(a,b)     xcalloc_size_t(a,b)
     56# define malloc(a)       xmalloc_size_t(a)
     57# define realloc(a,b)    xrealloc_size_t(a,b)
     58#else
     59# define calloc(a,b)     xcalloc((a) * (b))
     60# define malloc(a)       xmalloc(a)
     61# define realloc(a,b)    xrealloc((a),(b))
     62#endif
    4563
    4664#endif
Note: See TracChangeset for help on using the changeset viewer.