diff options
author | Werner Koch <wk@gnupg.org> | 2013-12-12 15:13:09 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-12-12 15:28:06 +0100 |
commit | 3b30e9840d4b351c4de73b126e561154cb7df4cc (patch) | |
tree | ef3d2d1127165ef5866840d33ccde9d35a2dee33 /mpi/ec.c | |
parent | cd548ba2dc777b8b27d8d33182ba733c20222120 (diff) | |
download | libgcrypt-3b30e9840d4b351c4de73b126e561154cb7df4cc.tar.gz |
Remove macro hacks for internal vs. external functions. Part 2 and last.
* src/visibility.h: Remove remaining define/undef hacks for symbol
visibility. Add macros to detect the use of the public functions.
Change all affected functions by replacing them by the x-macros.
* src/g10lib.h: Add internal prototypes.
(xtrymalloc, xtrycalloc, xtrymalloc_secure, xtrycalloc_secure)
(xtryrealloc, xtrystrdup, xmalloc, xcalloc, xmalloc_secure)
(xcalloc_secure, xrealloc, xstrdup, xfree): New macros.
--
The use of xmalloc/xtrymalloc/xfree is a more common pattern than the
gcry_free etc. functions. Those functions behave like those defined
by C and thus for better readability we use these macros and not
the underscore prefixed functions.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'mpi/ec.c')
-rw-r--r-- | mpi/ec.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -90,7 +90,7 @@ _gcry_mpi_point_new (unsigned int nbits) (void)nbits; /* Currently not used. */ - p = gcry_xmalloc (sizeof *p); + p = xmalloc (sizeof *p); _gcry_mpi_point_init (p); return p; } @@ -103,7 +103,7 @@ _gcry_mpi_point_release (mpi_point_t p) if (p) { _gcry_mpi_point_free_parts (p); - gcry_free (p); + xfree (p); } } @@ -164,7 +164,7 @@ _gcry_mpi_point_snatch_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z, mpi_snatch (x, point->x); mpi_snatch (y, point->y); mpi_snatch (z, point->z); - gcry_free (point); + xfree (point); } @@ -470,7 +470,7 @@ _gcry_mpi_ec_p_internal_new (enum gcry_mpi_ec_models model, { mpi_ec_t ctx; - ctx = gcry_xcalloc (1, sizeof *ctx); + ctx = xcalloc (1, sizeof *ctx); ec_p_init (ctx, model, dialect, flags, p, a, b); return ctx; @@ -515,7 +515,7 @@ _gcry_mpi_ec_free (mpi_ec_t ctx) if (ctx) { ec_deinit (ctx); - gcry_free (ctx); + xfree (ctx); } } |