This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid some branches
[perl5.git] / proto.h
diff --git a/proto.h b/proto.h
index 39276fa..8e0c669 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -35,6 +35,20 @@ PERL_CALLCONV UV     NATIVE_TO_NEED(const UV enc, const UV ch)
 #endif
 
 PERL_CALLCONV const char *     Perl_PerlIO_context_layers(pTHX_ const char *mode);
+PERL_CALLCONV int      Perl_PerlLIO_dup2_cloexec(pTHX_ int oldfd, int newfd);
+PERL_CALLCONV int      Perl_PerlLIO_dup_cloexec(pTHX_ int oldfd)
+                       __attribute__warn_unused_result__;
+
+PERL_CALLCONV int      Perl_PerlLIO_open3_cloexec(pTHX_ const char *file, int flag, int perm)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLLIO_OPEN3_CLOEXEC \
+       assert(file)
+
+PERL_CALLCONV int      Perl_PerlLIO_open_cloexec(pTHX_ const char *file, int flag)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLLIO_OPEN_CLOEXEC  \
+       assert(file)
+
 PERL_CALLCONV void*    Perl_Slab_Alloc(pTHX_ size_t sz)
                        __attribute__warn_unused_result__;
 
@@ -744,7 +758,6 @@ PERL_CALLCONV void  Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padl
 PERL_CALLCONV bool     Perl_do_eof(pTHX_ GV* gv);
 #define PERL_ARGS_ASSERT_DO_EOF        \
        assert(gv)
-PERL_CALLCONV void     Perl_do_execfree(pTHX);
 PERL_CALLCONV void     Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, const char *name, GV *sv);
 #define PERL_ARGS_ASSERT_DO_GV_DUMP    \
        assert(file); assert(name)
@@ -1375,20 +1388,25 @@ PERL_CALLCONV bool      Perl_isIDFIRST_lazy(pTHX_ const char* p)
 #define PERL_ARGS_ASSERT_ISIDFIRST_LAZY        \
        assert(p)
 
-/* PERL_CALLCONV bool  Perl_is_ascii_string(const U8* const s, const STRLEN len)
+PERL_CALLCONV bool     Perl_isSCRIPT_RUN(pTHX_ const U8 *s, const U8 *send, const bool utf8_target)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_ISSCRIPT_RUN  \
+       assert(s); assert(send)
+
+/* PERL_CALLCONV bool  Perl_is_ascii_string(const U8* const s, STRLEN len)
                        __attribute__warn_unused_result__
                        __attribute__pure__; */
 
 /* PERL_CALLCONV bool  Perl_is_c9strict_utf8_string(const U8 *s, STRLEN len)
                        __attribute__warn_unused_result__; */
 
-/* PERL_CALLCONV bool  is_c9strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool  is_c9strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool        S_is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
 #define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN        \
        assert(s)
 #endif
-/* PERL_CALLCONV bool  Perl_is_invariant_string(const U8* const s, const STRLEN len)
+/* PERL_CALLCONV bool  Perl_is_invariant_string(const U8* const s, STRLEN len)
                        __attribute__warn_unused_result__
                        __attribute__pure__; */
 
@@ -1405,9 +1423,9 @@ PERL_STATIC_INLINE bool   S_is_safe_syscall(pTHX_ const char *pv, STRLEN len, cons
 /* PERL_CALLCONV bool  Perl_is_strict_utf8_string(const U8 *s, STRLEN len)
                        __attribute__warn_unused_result__; */
 
-/* PERL_CALLCONV bool  is_strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool  is_strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool        S_is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
 #define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN  \
        assert(s)
 #endif
@@ -1593,10 +1611,10 @@ PERL_CALLCONV bool      Perl_is_utf8_digit(pTHX_ const U8 *p)
 #define PERL_ARGS_ASSERT_IS_UTF8_DIGIT \
        assert(p)
 
-/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_flags(const U8 * const s, const STRLEN len, const U32 flags); */
-/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_loc_flags(const U8 * const s, const STRLEN len, const U8 **ep, const U32 flags); */
+/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_flags(const U8 * const s, STRLEN len, const U32 flags); */
+/* PERL_CALLCONV bool  is_utf8_fixed_width_buf_loc_flags(const U8 * const s, STRLEN len, const U8 **ep, const U32 flags); */
 #ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool        S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, const STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
+PERL_STATIC_INLINE bool        S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
 #define PERL_ARGS_ASSERT_IS_UTF8_FIXED_WIDTH_BUF_LOCLEN_FLAGS  \
        assert(s)
 #endif
@@ -1687,7 +1705,7 @@ PERL_STATIC_INLINE bool   S_is_utf8_string_flags(const U8 *s, STRLEN len, const U3
 #endif
 
 #ifndef NO_MATHOMS
-PERL_CALLCONV bool     Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep);
+PERL_CALLCONV bool     Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep);
 #define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC    \
        assert(s); assert(ep)
 #endif
@@ -2084,6 +2102,11 @@ PERL_CALLCONV Pid_t      Perl_my_fork(void);
 PERL_CALLCONV I32      Perl_my_lstat(pTHX);
 #endif
 PERL_CALLCONV I32      Perl_my_lstat_flags(pTHX_ const U32 flags);
+PERL_CALLCONV int      Perl_my_mkstemp_cloexec(char *templte)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_MY_MKSTEMP_CLOEXEC    \
+       assert(templte)
+
 PERL_CALLCONV PerlIO*  Perl_my_popen_list(pTHX_ const char* mode, int n, SV ** args);
 #define PERL_ARGS_ASSERT_MY_POPEN_LIST \
        assert(mode); assert(args)
@@ -2918,6 +2941,11 @@ PERL_CALLCONV void       Perl_set_numeric_underlying(pTHX);
 PERL_CALLCONV void     Perl_setdefout(pTHX_ GV* gv);
 #define PERL_ARGS_ASSERT_SETDEFOUT     \
        assert(gv)
+PERL_CALLCONV void     Perl_setfd_cloexec(int fd);
+PERL_CALLCONV void     Perl_setfd_cloexec_for_nonsysfd(pTHX_ int fd);
+PERL_CALLCONV void     Perl_setfd_cloexec_or_inhexec_by_sysfdness(pTHX_ int fd);
+PERL_CALLCONV void     Perl_setfd_inhexec(int fd);
+PERL_CALLCONV void     Perl_setfd_inhexec_for_sysfd(pTHX_ int fd);
 PERL_CALLCONV char*    Perl_setlocale(int category, const char* locale);
 PERL_CALLCONV HEK*     Perl_share_hek(pTHX_ const char* str, SSize_t len, U32 hash);
 #define PERL_ARGS_ASSERT_SHARE_HEK     \
@@ -3554,10 +3582,10 @@ PERL_CALLCONV UV        Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp)
 
 PERL_CALLCONV bool     Perl_try_amagic_bin(pTHX_ int method, int flags);
 PERL_CALLCONV bool     Perl_try_amagic_un(pTHX_ int method, int flags);
-PERL_CALLCONV I32      Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags);
+PERL_CALLCONV SSize_t  Perl_unpack_str(pTHX_ const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags);
 #define PERL_ARGS_ASSERT_UNPACK_STR    \
        assert(pat); assert(patend); assert(s); assert(strend)
-PERL_CALLCONV I32      Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
+PERL_CALLCONV SSize_t  Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
 #define PERL_ARGS_ASSERT_UNPACKSTRING  \
        assert(pat); assert(patend); assert(s); assert(strend)
 PERL_CALLCONV void     Perl_unshare_hek(pTHX_ HEK* hek);
@@ -3607,8 +3635,7 @@ PERL_STATIC_INLINE U8*    Perl_utf8_hop_safe(const U8 *s, SSize_t off, const U8 *st
 #endif
 
 PERL_CALLCONV STRLEN   Perl_utf8_length(pTHX_ const U8* s, const U8 *e)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__;
+                       __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_UTF8_LENGTH   \
        assert(s); assert(e)
 
@@ -3831,6 +3858,13 @@ PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg)
        assert(sv); assert(mg)
 
 #endif
+#if !defined(EBCDIC)
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE unsigned int        S__variant_byte_number(PERL_UINTMAX_T word)
+                       __attribute__warn_unused_result__;
+#endif
+
+#endif
 #if !defined(HAS_GETENV_LEN)
 PERL_CALLCONV char*    Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len);
 #define PERL_ARGS_ASSERT_GETENV_LEN    \
@@ -3845,6 +3879,11 @@ STATIC int       S_dooneliner(pTHX_ const char *cmd, const char *filename)
 
 #  endif
 #endif
+#if !defined(HAS_MKOSTEMP)
+PERL_CALLCONV int      Perl_my_mkostemp(char *templte, int flags);
+#define PERL_ARGS_ASSERT_MY_MKOSTEMP   \
+       assert(templte)
+#endif
 #if !defined(HAS_MKSTEMP)
 PERL_CALLCONV int      Perl_my_mkstemp(char *templte);
 #define PERL_ARGS_ASSERT_MY_MKSTEMP    \
@@ -4092,6 +4131,13 @@ PERL_CALLCONV bool       Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
 #define PERL_ARGS_ASSERT_DO_EXEC3      \
        assert(incmd)
 #endif
+#if defined (HAS_SOCKETPAIR) ||     (defined (HAS_SOCKET) && defined(SOCK_DGRAM) &&    defined(AF_INET) && defined(PF_INET))
+PERL_CALLCONV int      Perl_PerlSock_socketpair_cloexec(pTHX_ int domain, int type, int protocol, int *pairfd)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLSOCK_SOCKETPAIR_CLOEXEC   \
+       assert(pairfd)
+
+#endif
 #if defined(DEBUGGING)
 PERL_CALLCONV int      Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
                        __attribute__warn_unused_result__;
@@ -4238,10 +4284,25 @@ STATIC const char*      S_my_nl_langinfo(const nl_item item, bool toggle);
 #if defined(HAS_NL_LANGINFO) && defined(PERL_LANGINFO_H)
 PERL_CALLCONV const char*      Perl_langinfo(const nl_item item);
 #endif
+#if defined(HAS_PIPE)
+PERL_CALLCONV int      Perl_PerlProc_pipe_cloexec(pTHX_ int *pipefd)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_PERLPROC_PIPE_CLOEXEC \
+       assert(pipefd)
+
+#endif
 #if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
 PERL_CALLCONV Signal_t Perl_csighandler(int sig, siginfo_t *info, void *uap);
 PERL_CALLCONV Signal_t Perl_sighandler(int sig, siginfo_t *info, void *uap);
 #endif
+#if defined(HAS_SOCKET)
+PERL_CALLCONV int      Perl_PerlSock_accept_cloexec(pTHX_ int listenfd, struct sockaddr *addr, Sock_size_t *addrlen)
+                       __attribute__warn_unused_result__;
+
+PERL_CALLCONV int      Perl_PerlSock_socket_cloexec(pTHX_ int domain, int type, int protocol)
+                       __attribute__warn_unused_result__;
+
+#endif
 #if defined(HAVE_INTERP_INTERN)
 PERL_CALLCONV void     Perl_sys_intern_clear(pTHX);
 PERL_CALLCONV void     Perl_sys_intern_init(pTHX);
@@ -4315,6 +4376,15 @@ PERL_STATIC_INLINE STRLEN        S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLE
        assert(sv); assert(pv)
 #endif
 #endif
+#if defined(PERL_CORE) || defined(PERL_EXT)
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE Size_t      S_variant_under_utf8_count(const U8* const s, const U8* const e)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_VARIANT_UNDER_UTF8_COUNT      \
+       assert(s); assert(e)
+#endif
+
+#endif
 #if defined(PERL_CR_FILTER)
 #  if defined(PERL_IN_TOKE_C)
 STATIC I32     S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen);
@@ -4621,6 +4691,7 @@ PERL_CALLCONV SV* Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp);
        assert(hv); assert(indexp)
 #endif
 #if defined(PERL_IN_LOCALE_C)
+STATIC const char*     S_category_name(const int category);
 #ifndef PERL_NO_INLINE_FUNCTIONS
 PERL_STATIC_INLINE const char *        S_save_to_buffer(const char * string, char **buf, Size_t *buf_size, const Size_t offset);
 #define PERL_ARGS_ASSERT_SAVE_TO_BUFFER        \
@@ -4985,7 +5056,7 @@ STATIC int        S_div128(pTHX_ SV *pnum, bool *done);
 STATIC char    S_first_symbol(const char *pat, const char *patend);
 #define PERL_ARGS_ASSERT_FIRST_SYMBOL  \
        assert(pat); assert(patend)
-STATIC const char *    S_get_num(pTHX_ const char *patptr, I32 *lenptr)
+STATIC const char *    S_get_num(pTHX_ const char *patptr, SSize_t *lenptr)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_GET_NUM       \
        assert(patptr); assert(lenptr)
@@ -4998,7 +5069,7 @@ STATIC SV*        S_is_an_int(pTHX_ const char *s, STRLEN l)
 #define PERL_ARGS_ASSERT_IS_AN_INT     \
        assert(s)
 
-STATIC I32     S_measure_struct(pTHX_ struct tempsym* symptr);
+STATIC SSize_t S_measure_struct(pTHX_ struct tempsym* symptr);
 #define PERL_ARGS_ASSERT_MEASURE_STRUCT        \
        assert(symptr)
 STATIC SV*     S_mul128(pTHX_ SV *sv, U8 m);
@@ -5023,7 +5094,7 @@ STATIC char *     S_sv_exp_grow(pTHX_ SV *sv, STRLEN needed)
 #define PERL_ARGS_ASSERT_SV_EXP_GROW   \
        assert(sv)
 
-STATIC I32     S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s);
+STATIC SSize_t S_unpack_rec(pTHX_ struct tempsym* symptr, const char *s, const char *strbeg, const char *strend, const char **new_s);
 #define PERL_ARGS_ASSERT_UNPACK_REC    \
        assert(symptr); assert(s); assert(strbeg); assert(strend)
 #endif
@@ -5495,6 +5566,16 @@ STATIC char*     S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, cons
 #define PERL_ARGS_ASSERT_FIND_BYCLASS  \
        assert(prog); assert(c); assert(s); assert(strend)
 
+STATIC char *  S_find_next_ascii(char* s, const char * send, const bool is_utf8)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_FIND_NEXT_ASCII       \
+       assert(s); assert(send)
+
+STATIC char *  S_find_next_non_ascii(char* s, const char * send, const bool is_utf8)
+                       __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_FIND_NEXT_NON_ASCII   \
+       assert(s); assert(send)
+
 STATIC bool    S_isFOO_utf8_lc(pTHX_ const U8 classnum, const U8* character)
                        __attribute__warn_unused_result__;
 #define PERL_ARGS_ASSERT_ISFOO_UTF8_LC \
@@ -5754,7 +5835,7 @@ STATIC SV*        S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRL
 STATIC void    S_no_op(pTHX_ const char *const what, char *s);
 #define PERL_ARGS_ASSERT_NO_OP \
        assert(what)
-STATIC void    S_parse_ident(pTHX_ char **s, char **d, char * const e, int allow_package, bool is_utf8, bool check_dollar);
+STATIC void    S_parse_ident(pTHX_ char **s, char **d, char * const e, int allow_package, bool is_utf8, bool check_dollar, bool tick_warn);
 #define PERL_ARGS_ASSERT_PARSE_IDENT   \
        assert(s); assert(d); assert(e)
 STATIC int     S_pending_ident(pTHX);