diff options
author | Werner Koch <wk@gnupg.org> | 2013-10-22 14:26:53 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-12-05 08:27:48 +0100 |
commit | 7bacf1812b55fa78db63abaa1f5a9220e9c6cccc (patch) | |
tree | 4141585ef24a83e22e411355585784f24b78f58f /mpi/mpi-div.c | |
parent | 85bb0a98ea5add0296cbcc415d557eaa1f6bd294 (diff) | |
download | libgcrypt-7bacf1812b55fa78db63abaa1f5a9220e9c6cccc.tar.gz |
Remove macro hacks for internal vs. external functions. Part 1.
* src/visibility.h: Remove almost all define/undef hacks for symbol
visibility. Add macros to detect the use of the public functions.
Change all affected functions by prefixing them explicitly with an
underscore and change all internal callers to call the underscore
prefixed versions. Provide convenience macros from sexp and mpi
functions.
* src/visibility.c: Change all functions to use only gpg_err_code_t
and translate to gpg_error_t only in visibility.c.
--
The use of the macro magic made if hard to follow the function calls
in the source. It was not easy to see if an internal or external
function (as defined by visibility.c) was called. The change is quite
large but hopefully makes Libgcrypt easier to maintain. Some
function have not yet been fixed; this will be done soon.
Because Libgcrypt does no make use of any other libgpg-error using
libraries it is useless to always translate between gpg_error_t and
gpg_err_code_t (i.e with and w/o error source identifier). This
translation has no mostly be moved to the function wrappers in
visibility.c. An additional advantage of using gpg_err_code_t is that
comparison can be done without using gpg_err_code().
I am sorry for that large patch, but a series of patches would
actually be more work to audit.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'mpi/mpi-div.c')
-rw-r--r-- | mpi/mpi-div.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mpi/mpi-div.c b/mpi/mpi-div.c index a6ee3006..9ac99c31 100644 --- a/mpi/mpi-div.c +++ b/mpi/mpi-div.c @@ -50,7 +50,7 @@ _gcry_mpi_fdiv_r( gcry_mpi_t rem, gcry_mpi_t dividend, gcry_mpi_t divisor ) _gcry_mpi_tdiv_r( rem, dividend, divisor ); if( ((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs ) - gcry_mpi_add( rem, rem, divisor); + mpi_add (rem, rem, divisor); if( temp_divisor ) mpi_free(temp_divisor); @@ -103,8 +103,8 @@ _gcry_mpi_fdiv_qr( gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t dividend, gcry_mp _gcry_mpi_tdiv_qr( quot, rem, dividend, divisor ); if( (divisor_sign ^ dividend->sign) && rem->nlimbs ) { - gcry_mpi_sub_ui( quot, quot, 1 ); - gcry_mpi_add( rem, rem, divisor); + mpi_sub_ui( quot, quot, 1 ); + mpi_add( rem, rem, divisor); } if( temp_divisor ) @@ -328,7 +328,8 @@ _gcry_mpi_divisible_ui(gcry_mpi_t dividend, ulong divisor ) void -gcry_mpi_div (gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t dividend, gcry_mpi_t divisor, int round) +_gcry_mpi_div (gcry_mpi_t quot, gcry_mpi_t rem, gcry_mpi_t dividend, + gcry_mpi_t divisor, int round) { if (!round) { |