Changeset 461


Ignore:
Timestamp:
Feb 3, 2014 7:23:29 AM (6 years ago)
Author:
kulshres
Message:

make the use of rpl_?alloc consistent everywhere

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/src/adalloc.c

    r439 r461  
    1616#include <adolc/adalloc.h>
    1717
     18#if !defined(ADOLC_NO_MALLOC)
     19#   define ADOLC_CALLOC(n,m) calloc(n,m)
     20#else
     21#   define ADOLC_CALLOC(n,m) rpl_calloc(n,m)
     22#endif
    1823#if defined(ADOLC_USE_CALLOC)
    19 #  if defined(HAVE_MALLOC)
     24#  if !defined(ADOLC_NO_MALLOC)
    2025#     define ADOLC_MALLOC(n,m) calloc(n,m)
    2126#  else
     
    2328#  endif
    2429#else
    25 #  if defined(HAVE_MALLOC)
     30#  if !defined(ADOLC_NO_MALLOC)
    2631#     define ADOLC_MALLOC(n,m) malloc(n*m)
    2732#  else
    28 #     define ADOLC_MALLOC(n,m) rpl_malloc(n,m)
     33#     define ADOLC_MALLOC(n,m) rpl_malloc(n*m)
    2934#  endif
    3035#endif
     
    170175/* ------------------------------------------------------------------------- */
    171176unsigned int *myalloc1_uint(int m) {
    172     unsigned int *A = (unsigned int*)malloc(m*sizeof(unsigned int));
     177    unsigned int *A = (unsigned int*)ADOLC_MALLOC(m,sizeof(unsigned int));
    173178    if (A == NULL) {
    174179        fprintf(DIAG_OUT, "ADOL-C error, "__FILE__
     
    183188/* ------------------------------------------------------------------------- */
    184189unsigned long int *myalloc1_ulong(int m) {
    185     unsigned long int *A = (unsigned long int*)  calloc(m,sizeof(unsigned long int));
     190    unsigned long int *A = (unsigned long int*)ADOLC_CALLOC(m,sizeof(unsigned long int));
    186191    if (A == NULL) {
    187192        fprintf(DIAG_OUT, "ADOL-C error, "__FILE__
     
    196201/* ------------------------------------------------------------------------- */
    197202unsigned long int **myalloc2_ulong(int m,int n) {
    198     unsigned long int *Adum = (unsigned long int*)  calloc(m*n,sizeof(unsigned long int));
    199     unsigned long int **A   = (unsigned long int**) calloc(m,sizeof(unsigned long int*));
     203    unsigned long int *Adum = (unsigned long int*)ADOLC_CALLOC(m*n,sizeof(unsigned long int));
     204    unsigned long int **A   = (unsigned long int**)ADOLC_CALLOC(m,sizeof(unsigned long int*));
    200205    int i;
    201206    if (Adum == NULL) {
  • trunk/configure.ac

    r454 r461  
    101101AC_FUNC_MALLOC
    102102AC_FUNC_REALLOC
    103 
     103if test x$ac_cv_func_malloc_0_nonnull != xyes ; then
     104AC_DEFINE_UNQUOTED([calloc],[rpl_calloc],[Define to rpl_calloc if the replacement function should be used.])
     105fi
    104106# Checks for libraries and fuctions
    105107AC_SEARCH_LIBS([pow], [m])
Note: See TracChangeset for help on using the changeset viewer.