diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-04-25 01:06:37 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-04-25 01:06:37 +0200 |
commit | fcb2e4d8376c254ac9b10a561a530b45d8fccb6d (patch) | |
tree | 605da22e697ee14a5a40f531a32c32941b1087d4 /tests/misc.c | |
parent | cb8af2c6912547204ba94933af7b580f09cd43a7 (diff) | |
download | gmp-fcb2e4d8376c254ac9b10a561a530b45d8fccb6d.tar.gz |
* tests/misc.c,tests.h (__gmp_allocate_strdup, strtoupper): New
functions.
Diffstat (limited to 'tests/misc.c')
-rw-r--r-- | tests/misc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/misc.c b/tests/misc.c index 7640754bc..d1316409c 100644 --- a/tests/misc.c +++ b/tests/misc.c @@ -23,6 +23,7 @@ MA 02111-1307, USA. #include "config.h" +#include <ctype.h> #include <stdio.h> #include <stdlib.h> /* for getenv */ @@ -138,6 +139,28 @@ __gmp_allocate_or_reallocate (void *ptr, size_t oldsize, size_t newsize) return (*__gmp_reallocate_func) (ptr, oldsize, newsize); } +char * +__gmp_allocate_strdup (const char *s) +{ + size_t len; + char *t; + len = strlen (s); + t = (*__gmp_allocate_func) (len+1); + memcpy (t, s, len+1); + return t; +} + + +char * +strtoupper (char *s_orig) +{ + char *s; + for (s = s_orig; *s != '\0'; s++) + if (isascii (*s)) + *s = toupper (*s); + return s_orig; +} + void mpz_set_n (mpz_ptr z, mp_srcptr p, mp_size_t size) |