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 return malloc (strlen (string
)+1);
64 gcry_realloc (void *a
, size_t n
)
66 return realloc (a
, n
);
70 gcry_xrealloc (void *a
, size_t n
)
72 void *p
= realloc (a
, n
);
81 gcry_calloc (size_t n
, size_t m
)
87 gcry_xcalloc (size_t n
, size_t m
)
89 void *p
= calloc (n
, m
);
97 gcry_xstrdup (const char *string
)
99 void *p
= malloc (strlen (string
)+1);
115 /* Stubs for gpg-error functions required because some compilers do
116 not eliminate the supposed-to-be-unused-inline-functions and thus
117 require functions called from these inline fucntions. Although we
118 do not use gpg-error, gpg-error.h may get included via gcrypt.h if
119 it happens to be used used in libjnlib-config.h. */
121 gpg_err_code_from_errno (int err
)
124 assert (!"stub function");
129 /* Retrieve the error code directly from the ERRNO variable. This
130 returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped
131 (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */
133 gpg_err_code_from_syserror (void)
135 assert (!"stub function");