IXP_PSTRING(3)

πŸ“¦ version 0-unstable-2022-04, in nixos 26.05, nixpkgs unstable

NAME πŸ’–

ixp_pstring β€” okay bestie, this is the ixp_pstring page from the IXP_PSTRING(3) manual in the Library Functions Manual, and it's lowkey just the string packer/unpacker.


SYNOPSIS ✨

#include <ixp.h>

void ixp_pstring(IxpMsg *msg, char **s);

DESCRIPTION πŸ¦‹

Okay so ixp_pstring packs or unpacks a UTF-8 encoded string. That's the whole gig, and it ate. πŸ’…

The packed representation of the string consists of a 16-bit unsigned integer followed by the contents of the string. The unpacked representation is a nul-terminated character array. Slay.

  • If msg->mode is MsgPack, the string pointed to by s is packed into the buffer at msg->pos.
  • If msg->mode is MsgUnpack, the address pointed to by s is loaded with a malloc(3) allocated, nul-terminated representation of the string packed at msg->pos.

In either case, msg->pos is advanced by the number of bytes read or written. πŸ”₯

⚠️ caveat bestie: if the action would advance msg->pos beyond msg->end, msg->pos is still advanced but no other action is taken. So the position moves forward, but nothing else happens β€” that's literally the documented behavior, no cap. 😭

SEE ALSO 🌈


πŸ’Œ cute little sign-off: this page is from the libixp Manual, dated 2012 Dec. Bye bestie, go pack some strings responsibly 🫢

πŸ“¦ where this page comes from