diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-11-22 18:41:45 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-11-22 18:41:45 +0000 |
commit | f3316d36985ad16f1d82aea44eddc311cb739d6d (patch) | |
tree | 82f3a6c450ec8394baa9b588962d4497e7a704a4 /lib/util | |
parent | 09bcfca6b8a98a40a1895ae8a66dd3fc1344a966 (diff) | |
download | netpbm-mirror-f3316d36985ad16f1d82aea44eddc311cb739d6d.tar.gz netpbm-mirror-f3316d36985ad16f1d82aea44eddc311cb739d6d.tar.xz netpbm-mirror-f3316d36985ad16f1d82aea44eddc311cb739d6d.zip |
Fix %g for platform without vasprintf (but scores of %f still exist)
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2320 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/matrix.c | 12 | ||||
-rw-r--r-- | lib/util/nstring.h | 3 | ||||
-rw-r--r-- | lib/util/vasprintf.c | 13 |
3 files changed, 24 insertions, 4 deletions
diff --git a/lib/util/matrix.c b/lib/util/matrix.c index 5101f2c3..e9456e93 100644 --- a/lib/util/matrix.c +++ b/lib/util/matrix.c @@ -106,10 +106,14 @@ findLargestIthCoeff(unsigned int const n, maxSoFar = thisA; } } - if (maxSoFar < epsilon) - pm_asprintf(errorP, "Matrix equation has no unique solution. " - "(debug: coeff %u %e < %e)", i, maxSoFar, epsilon); - else { + if (maxSoFar < epsilon) { + const char * const baseMsg = "Matrix equation has no unique solution"; + if (pm_have_float_format()) + pm_asprintf(errorP, "%s. (debug: coeff %u %e < %e)", + baseMsg, i, maxSoFar, epsilon); + else + pm_asprintf(errorP, "%s", baseMsg); + } else { *istarP = maxIdx; *errorP = NULL; } diff --git a/lib/util/nstring.h b/lib/util/nstring.h index 28adda94..7238a76e 100644 --- a/lib/util/nstring.h +++ b/lib/util/nstring.h @@ -175,6 +175,9 @@ pm_vasprintf(const char ** const resultP, const char * const format, va_list args); +bool +pm_vasprintf_knows_float(void); + void pm_strfree(const char * const string); diff --git a/lib/util/vasprintf.c b/lib/util/vasprintf.c index e38252fa..b294763a 100644 --- a/lib/util/vasprintf.c +++ b/lib/util/vasprintf.c @@ -6,6 +6,8 @@ #include <string.h> #include "pm_config.h" +#include "pm_c_util.h" + #include "nstring.h" @@ -56,3 +58,14 @@ pm_vasprintf(const char ** const resultP, } #endif } + + + +bool +pm_vasprintf_knows_float(void) { +#if HAVE_VASPRINTF + return true; +#else + return false; +#endif +} |