xref: /dflybsd-src/contrib/gmp/mp_get_fns.c (revision d365564473a20a528d07c59cad8ee2f4bea5546f)
14b6a78b7SSimon Schubert /* mp_get_memory_functions -- Get the allocate, reallocate, and free functions.
24b6a78b7SSimon Schubert 
34b6a78b7SSimon Schubert Copyright 2002 Free Software Foundation, Inc.
44b6a78b7SSimon Schubert 
54b6a78b7SSimon Schubert This file is part of the GNU MP Library.
64b6a78b7SSimon Schubert 
74b6a78b7SSimon Schubert The GNU MP Library is free software; you can redistribute it and/or modify
84b6a78b7SSimon Schubert it under the terms of the GNU Lesser General Public License as published by
94b6a78b7SSimon Schubert the Free Software Foundation; either version 3 of the License, or (at your
104b6a78b7SSimon Schubert option) any later version.
114b6a78b7SSimon Schubert 
124b6a78b7SSimon Schubert The GNU MP Library is distributed in the hope that it will be useful, but
134b6a78b7SSimon Schubert WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
144b6a78b7SSimon Schubert or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
154b6a78b7SSimon Schubert License for more details.
164b6a78b7SSimon Schubert 
174b6a78b7SSimon Schubert You should have received a copy of the GNU Lesser General Public License
184b6a78b7SSimon Schubert along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
194b6a78b7SSimon Schubert 
204b6a78b7SSimon Schubert #include <stdio.h>  /* for NULL */
214b6a78b7SSimon Schubert #include "gmp.h"
224b6a78b7SSimon Schubert #include "gmp-impl.h"
234b6a78b7SSimon Schubert 
244b6a78b7SSimon Schubert void
mp_get_memory_functions(void * (** alloc_func)(size_t),void * (** realloc_func)(void *,size_t,size_t),void (** free_func)(void *,size_t))254b6a78b7SSimon Schubert mp_get_memory_functions (void *(**alloc_func) (size_t),
264b6a78b7SSimon Schubert 			 void *(**realloc_func) (void *, size_t, size_t),
27*d2d4b659SJohn Marino 			 void (**free_func) (void *, size_t)) __GMP_NOTHROW
284b6a78b7SSimon Schubert {
294b6a78b7SSimon Schubert   if (alloc_func != NULL)
304b6a78b7SSimon Schubert     *alloc_func = __gmp_allocate_func;
314b6a78b7SSimon Schubert 
324b6a78b7SSimon Schubert   if (realloc_func != NULL)
334b6a78b7SSimon Schubert     *realloc_func = __gmp_reallocate_func;
344b6a78b7SSimon Schubert 
354b6a78b7SSimon Schubert   if (free_func != NULL)
364b6a78b7SSimon Schubert     *free_func = __gmp_free_func;
374b6a78b7SSimon Schubert }
38