summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-05-01 14:23:23 -0600
committerKarl Williamson <khw@cpan.org>2018-06-25 07:33:26 -0600
commit5d4a52b5c68a11bfc97c2e24806993b84a61eade (patch)
tree32adacfa73add58acad66f7a533957d56bd45d11 /util.c
parent6928bedc792ff80f0cb915460a7eacae25fa9bdd (diff)
downloadperl-5d4a52b5c68a11bfc97c2e24806993b84a61eade.tar.gz
grok_atoUV: allow non-C strings and document
This changes the internal function grok_atoUV() to not require its input to be NUL-terminated. That means the existing calls to it must be changed to set the ending position before calling it, as some did already. This function is recommended to use in a couple of pods, but it wasn't documented in perlintern. This commit does that as well.
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util.c b/util.c
index 647f53307d..7282dd9cfe 100644
--- a/util.c
+++ b/util.c
@@ -4320,7 +4320,7 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
if (*p) {
if (isDIGIT(*p)) {
- const char* endptr;
+ const char* endptr = p + strlen(p);
UV uv;
if (grok_atoUV(p, &uv, &endptr) && uv <= U32_MAX) {
opt = (U32)uv;
@@ -4707,7 +4707,7 @@ S_mem_log_common(enum mem_log_type mlt, const UV n,
* timeval. */
{
STRLEN len;
- const char* endptr;
+ const char* endptr = pmlenv + stren(pmlenv);
int fd;
UV uv;
if (grok_atoUV(pmlenv, &uv, &endptr) /* Ignore endptr. */
@@ -5989,7 +5989,7 @@ static const char* atos_parse(const char* p,
* The matched regular expression is roughly "\(.*:\d+\)\s*$" */
const char* source_number_start;
const char* source_name_end;
- const char* source_line_end;
+ const char* source_line_end = start;
const char* close_paren;
UV uv;