Skip to content

perlapi: Combine is_safe_syscall, IS_SAFE_SYSCALL #23444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -3295,9 +3295,12 @@ Perl_uv_to_utf8_msgs(pTHX_ U8 *d, UV uv, UV flags , HV **msgs)
/*
=for apidoc_section $utility

=for apidoc is_safe_syscall
=for apidoc is_safe_syscall
=for apidoc_item ||IS_SAFE_SYSCALL|

Test that the given C<pv> (with length C<len>) doesn't contain any internal
These are synonymous.

They test that the given C<pv> (with length C<len>) doesn't contain any internal
C<NUL> characters.
If it does, set C<errno> to C<ENOENT>, optionally warn using the C<syscalls>
category, and return FALSE.
Expand All @@ -3306,8 +3309,6 @@ Return TRUE if the name is safe.

C<what> and C<op_name> are used in any warning.

Used by the C<IS_SAFE_SYSCALL()> macro.

=cut
*/

Expand Down
12 changes: 1 addition & 11 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8409,17 +8409,7 @@ so no C<x++>.
#endif


/*
=for apidoc_section $utility

=for apidoc Am|bool|IS_SAFE_SYSCALL|NN const char *pv|STRLEN len|NN const char *what|NN const char *op_name

Same as L</is_safe_syscall>.

=cut

Allows one ending \0
*/
/* Allows one ending \0 */
#define IS_SAFE_SYSCALL(p, len, what, op_name) (Perl_is_safe_syscall(aTHX_ (p), (len), (what), (op_name)))

#define IS_SAFE_PATHNAME(p, len, op_name) IS_SAFE_SYSCALL((p), (len), "pathname", (op_name))
Expand Down