PCRE_PATTERN_TO_HOST_BYTE_ORDER(3)

πŸ’… PCRE16_PATTERN_TO_HOST_BYTE_ORDER(3) πŸ’…

omg hey bestie, this one's from the Library Functions Manual and it's all about the PCRE crew 🫢✨


🏷️ NAME

PCRE β€” Perl-compatible regular expressions πŸŽ€

πŸ“œ SYNOPSIS

#include <pcre.h>

int pcre_pattern_to_host_byte_order(pcre *code,
     pcre_extra *extra, const unsigned char *tables);

int pcre16_pattern_to_host_byte_order(pcre16 *code,
     pcre16_extra *extra, const unsigned char *tables);

int pcre32_pattern_to_host_byte_order(pcre32 *code,
     pcre32_extra *extra, const unsigned char *tables);

🌈 DESCRIPTION

okay so real talk: this function is literally here to make sure the bytes sitting inside 2-byte and 4-byte values in a compiled pattern are in the correct order for the current host. it's the moment when a pattern gets compiled on one machine and then yeeted over to another machine that might have different endianness β€” and this function is the one that fixes it all up. πŸ’…βœ¨

The arguments are:

  • code β€” a compiled regular expression πŸŽ€
  • extra β€” points to an associated pcre[16|32]_extra structure, or is NULL πŸ™ˆ
  • tables β€” pointer to character tables, or NULL to set the built-in default πŸ’–

The result is 0 for success, or a negative PCRE_ERROR_xxx value otherwise. no cap, that's just how it is. 😭

There's a complete description of the PCRE native API over in the pcreapi page, and a description of the POSIX API in the pcreposix page. go read them, they're iconic πŸ“šβœ¨


okay that's the whole vibe bestie!! this page is PCRE 8.30, dated 24 June 2012, and it's the PCRE_PATTE..._BYTE_ORDER(3) page. slay, bye πŸ’…πŸ’–