This is an automated email from the ASF dual-hosted git repository. ChristopherSchultz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat-connectors.git
commit 53506d4b86dc6b8a9c755adf63b5ea73bcd5f4d7 Author: Christopher Schultz <[email protected]> AuthorDate: Mon Jun 8 15:46:18 2026 -0400 Improve performance Don't bother converting from double -> string -> double Use strtod instead of atof to get error handling --- native/common/jk_map.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/native/common/jk_map.c b/native/common/jk_map.c index 8c6de4240..04eb325a4 100644 --- a/native/common/jk_map.c +++ b/native/common/jk_map.c @@ -230,13 +230,22 @@ int jk_map_get_int(jk_map_t *m, const char *name, int def) double jk_map_get_double(jk_map_t *m, const char *name, double def) { - char buf[100]; - const char *rc; + const char *rc = jk_map_get_string(m, name, NULL); + char *end; + double d; - sprintf(buf, "%f", def); - rc = jk_map_get_string(m, name, buf); + if (rc == NULL) { + return def; + } + + errno = 0; + d = strtod(rc, &end); + + if (end == rc || errno == ERANGE) { + return def; + } - return atof(rc); + return d; } int jk_map_get_bool(jk_map_t *m, const char *name, int def) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
