You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/01/23 22:28:17 UTC
(axis-axis2-c-core) 02/05: Remove broken and unused axutil_strtol/axutil_strtoul functions (AXIS2C-1508)
This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git
commit e2d96d8879e916c8817a84fe501c125eab14e408
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Fri Jan 23 09:45:46 2026 -1000
Remove broken and unused axutil_strtol/axutil_strtoul functions (AXIS2C-1508)
These functions were severely broken:
- Did not handle negative numbers (returned 0 for "-123")
- Did not handle positive sign or leading whitespace
- Completely ignored the base parameter
- Never matched standard strtol/strtoul behavior
More importantly, they were dead code - never actually used anywhere
in the codebase. All actual code uses the standard library strtol()
directly (22 call sites in samples/ and util/).
Removed:
- axutil_strtol() function from util/src/types.c
- axutil_strtoul() function from util/src/types.c
- AXIS2_STRTOL macro from util/include/axutil_types.h
- AXIS2_STRTOUL macro from util/include/axutil_types.h
The remaining axutil_atoi() and axutil_atol() functions are kept as
they follow consistent (if limited) behavior and are actually used.
Co-Authored-By: Claude Opus 4.5 <no...@anthropic.com>
---
util/include/axutil_types.h | 17 -----------------
util/src/types.c | 42 ------------------------------------------
2 files changed, 59 deletions(-)
diff --git a/util/include/axutil_types.h b/util/include/axutil_types.h
index d6df33904..5b8c3169a 100644
--- a/util/include/axutil_types.h
+++ b/util/include/axutil_types.h
@@ -41,23 +41,6 @@ extern "C"
#define AXIS2_ATOI(s) axutil_atoi(s)
- AXIS2_EXTERN uint64_t AXIS2_CALL
- axutil_strtoul(
- const char *nptr,
- char **endptr,
- int base);
-
-#define AXIS2_STRTOUL(s, e, b) axutil_strtoul(s, e, b)
-
- AXIS2_EXTERN int64_t AXIS2_CALL
- axutil_strtol(
- const char *nptr,
- char **endptr,
- int base);
-
-#define AXIS2_STRTOL(s, e, b) axutil_strtol(s, e, b)
-
-
AXIS2_EXTERN int64_t AXIS2_CALL
axutil_atol(
const char *s);
diff --git a/util/src/types.c b/util/src/types.c
index a47cc67bf..d1db26613 100644
--- a/util/src/types.c
+++ b/util/src/types.c
@@ -45,45 +45,3 @@ axutil_atol(
}
return n;
}
-
-AXIS2_EXTERN uint64_t AXIS2_CALL
-axutil_strtoul(
- const char *s,
- char **endptr,
- int base)
-{
- int i;
- uint64_t n;
-
- n = 0;
- for(i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
- {
- n = 10 * n + (s[i] - '0');
- }
- if(endptr != NULL)
- {
- *endptr = (char *)(s + i);
- }
- return n;
-}
-
-AXIS2_EXTERN int64_t AXIS2_CALL
-axutil_strtol(
- const char *s,
- char **endptr,
- int base)
-{
- int i;
- int64_t n;
-
- n = 0;
- for(i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
- {
- n = 10 * n + (s[i] - '0');
- }
- if(endptr != NULL)
- {
- *endptr = (char *)(s + i);
- }
- return n;
-}