PCRE2_GENE...EXT_CREATE(3)

πŸ’– NAME πŸ’–

PCRE2 β€” Perl-compatible regular expressions (revised API) ✨

okay bestie, this is the manual page for PCRE2 and it’s giving β€œtiny function, very important memory behavior” energy πŸ’…


🌸 SYNOPSIS 🌸

#include <pcre2.h>

pcre2_general_context *pcre2_general_context_create(
  void *(*private_malloc)(size_t, void *),
  void (*private_free)(void *, void *), void *memory_data);

πŸ¦‹ DESCRIPTION πŸ¦‹

So this function creates and initializes a general context β€” yes, that’s the whole main character move here πŸ‘‘.

The arguments define custom memory management functions and a data value that is passed to them when they are called. The private_malloc() function is used to get memory for the context. No cap.

If either of the first two arguments is NULL, the system memory management function is used instead. And if no memory could be obtained, the result is NULL. That’s the vibe check: no memory, no context 😭.

There is a complete description of the PCRE2 native API in the pcre2api page and a description of the POSIX API in the pcre2posix page. Go read those if you want the full lore 🫢.


✨ cute little sign-off: this page is from PCRE2 10.47, dated 23 January 2023. byeee bestie, go manage that memory responsibly πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from