PCRE2_CODE_FREE(3)
π PCRE2_CODE_FREE(3) β aka the "bye bestie" page for compiled patterns
ok so this is part of PCRE2, which literally stands for Perl-compatible regular expressions and it's the revised API version, bestie. this page lives in the Library Functions Manual and it's about one (1) tiny little function that cleans up after your regex. she's small but she's important, ok?? π
β¨ SYNOPSIS β¨
like, here's the whole vibe, one include, one function, no notes:
#include <pcre2.h>
void pcre2_code_free(pcre2_code *code);
that's it. that's the girl. π«Ά
πΈ DESCRIPTION πΈ
okay so if code is NULL, this function does nothing. literally nothing. it's like texting your bestie and getting left on read β no crash, no drama, nothing happens. π
otherwise?? code must point to a compiled pattern. like, that's the vibe check, bestie, that's the contract. and what she does is she frees its memory β and omg not just the basic memory, she also frees any memory used by the JIT compiler too. she's thorough. she cleans up the whole group chat. π§Ήβ¨
and listen, there's one more slay: if the compiled pattern was created by a call to pcre2_code_copy_with_tables(), then the memory for the character tables is also freed. so like, if you used the copy-with-tables route, she's got you covered on the tables too. no leaks, no leftovers, no "wait who's still in the server". π
fr fr, be careful β the docs say code must point to a compiled pattern. so don't be sending her random garbage pointers, okay?? that's not the move. π
also, there is a complete description of the PCRE2 native API over in the pcre2api page, and if you're doing the POSIX thing, the description of the POSIX API is in the pcre2posix page. go read those, they're iconic. ππ
π¦ SEE ALSO π¦
pcre2apiβ the full native API lorepcre2posixβ the POSIX API lore
β¨π and that's the whole page, bestie! πβ¨ this was PCRE2 10.47, dropped on 28 June 2018, from the PCRE2_CODE_FREE(3) manual page in the Library Functions Manual. go free your codes responsibly, mwah π πΈ
π¦ where this page comes from
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 43: pcre2-devel 10.47-1.fc43 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- fedora 44: pcre2-devel 10.47-1.fc44.1 Β· BSD-3-Clause AND FSFULLR AND X11 AND GPL-2.0-or-later AND FSFAP AND FSFUL AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms