Util: Add to_bool() and use it for JSON, Pg & query encoding

To improve interop with legacy modules.
This commit is contained in:
Yorhel 2025-02-25 09:10:03 +01:00
parent 06e2f950fe
commit c7a3415485
10 changed files with 141 additions and 37 deletions

View file

@ -77,7 +77,8 @@ RECVFN(bool) {
}
SENDFN(bool) {
fustr_write_ch(out, SvTRUE(val) ? 1 : 0);
int r = fu_2bool(val); /* So that we also recognize \0 and \1 */
fustr_write_ch(out, r < 0 ? SvTRUE(val) : r);
}
RECVFN(void) {