summaryrefslogtreecommitdiff
path: root/gmpxx.h
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2002-12-21 00:32:42 +0100
committerKevin Ryde <user42@zip.com.au>2002-12-21 00:32:42 +0100
commitca73d44e4d4515de20b990ebb36b57642743ce0a (patch)
tree65a4574d0174fa8bc08baeb0ccccceb141962702 /gmpxx.h
parentf082887e5147bc3ef4850b268b354331feab1b01 (diff)
downloadgmp-ca73d44e4d4515de20b990ebb36b57642743ce0a.tar.gz
* gmpxx.h (struct __gmp_alloc_cstring): Use mp_get_memory_functions,
not __gmp_free_func.
Diffstat (limited to 'gmpxx.h')
-rw-r--r--gmpxx.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gmpxx.h b/gmpxx.h
index 2b9646c78..b9c8c2fa9 100644
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -2328,14 +2328,19 @@ struct __gmp_rand_function
/**************** Auxiliary classes ****************/
-/* this is the same as gmp_allocated_string in gmp-impl.h
+/* this is much the same as gmp_allocated_string in gmp-impl.h
since gmp-impl.h is not publicly available, I redefine it here
I use a different name to avoid possible clashes */
struct __gmp_alloc_cstring
{
char *str;
__gmp_alloc_cstring(char *s) { str = s; }
- ~__gmp_alloc_cstring() { __gmp_free_func(str, strlen(str)+1); }
+ ~__gmp_alloc_cstring()
+ {
+ void (*freefunc) (void *, size_t);
+ mp_get_memory_functions (NULL, NULL, &freefunc);
+ (*freefunc) (str, strlen(str)+1);
+ }
};