1 /* t-support.c - helper functions for the regression tests.
2 * Copyright (C) 2007 Free Software Foundation, Inc.
4 * This file is part of JNLIB.
6 * JNLIB is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 3 of
9 * the License, or (at your option) any later version.
11 * JNLIB is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
27 #include "t-support.h"
30 /* Replacements for the malloc functions as used here. */
35 fprintf (stderr
,"error: out of core in regression tests: %s\n",
42 gcry_malloc (size_t n
)
48 gcry_xmalloc (size_t n
)
57 gcry_strdup (const char *string
)
59 char *p
= malloc (strlen (string
)+1);
67 gcry_realloc (void *a
, size_t n
)
69 return realloc (a
, n
);
73 gcry_xrealloc (void *a
, size_t n
)
75 void *p
= realloc (a
, n
);
84 gcry_calloc (size_t n
, size_t m
)
90 gcry_xcalloc (size_t n
, size_t m
)
92 void *p
= calloc (n
, m
);
100 gcry_xstrdup (const char *string
)
102 void *p
= malloc (strlen (string
)+1);
118 /* Stubs for gpg-error functions required because some compilers do
119 not eliminate the supposed-to-be-unused-inline-functions and thus
120 require functions called from these inline fucntions. Although we
121 do not use gpg-error, gpg-error.h may get included via gcrypt.h if
122 it happens to be used used in libjnlib-config.h. */
124 gpg_err_code_from_errno (int err
)
127 assert (!"stub function");
132 /* Retrieve the error code directly from the ERRNO variable. This
133 returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
134 (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
136 gpg_err_code_from_syserror (void)
138 assert (!"stub function");