diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-19 06:52:24 -0400 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2014-05-28 15:20:52 +0200 |
commit | c3caa5c3bdbd0ad0bc7ce5e7cd1a8eb5b7ca6a69 (patch) | |
tree | 6dc141509d7e032a24af49a9ad0ba9892c7b893c /perl.c | |
parent | 40b5a549d4793cde8b4d93ccdd03c16e039440c9 (diff) | |
download | perl-c3caa5c3bdbd0ad0bc7ce5e7cd1a8eb5b7ca6a69.tar.gz |
Use the C_ARRAY_LENGTH.
Use the C_ARRAY_LENGTH instead of sizeof(c_array)/sizeof(c_array[0])
or sizeof(c_array)/sizeof(type_of_element_in_c_array), and C_ARRAY_END
for c_array + C_ARRAY_LENGTH(c_array).
While doing this found potential off-by-one error in sv.c:Perl_sv_magic:
how > C_ARRAY_LENGTH(PL_magic_data)
should probably have been
how >= C_ARRAY_LENGTH(PL_magic_data)
No tests fail, but this seems to be more of an internal sanity check.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -677,7 +677,7 @@ perl_destruct(pTHXx) msg.msg_name = NULL; msg.msg_namelen = 0; msg.msg_iov = vec; - msg.msg_iovlen = sizeof(vec)/sizeof(vec[0]); + msg.msg_iovlen = C_ARRAY_LENGTH(vec); vec[0].iov_base = (void*)⌖ vec[0].iov_len = sizeof(target); |