1 /* no-libgcrypt.c - Replacement functions for libgcrypt.
2 * Copyright (C) 2003 Free Software Foundation, Inc.
4 * This file is free software; as a special exception the author gives
5 * unlimited permission to copy and/or distribute it, with or without
6 * modifications, as long as this notice is preserved.
8 * This file is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 #include "../common/util.h"
23 /* Replace libgcrypt's malloc functions which are used by
24 ../jnlib/libjnlib.a . ../common/util.h defines macros to map them
29 fprintf (stderr
, "error allocating enough memory: %s\n", strerror (errno
));
35 gcry_malloc (size_t n
)
41 gcry_xmalloc (size_t n
)
50 gcry_strdup (const char *string
)
52 char *p
= malloc (strlen (string
)+1);
60 gcry_realloc (void *a
, size_t n
)
62 return realloc (a
, n
);
66 gcry_xrealloc (void *a
, size_t n
)
68 void *p
= realloc (a
, n
);
77 gcry_calloc (size_t n
, size_t m
)
83 gcry_xcalloc (size_t n
, size_t m
)
85 void *p
= calloc (n
, m
);
93 gcry_xstrdup (const char *string
)
95 void *p
= malloc (strlen (string
)+1);