NN_REALLOCMSG(3)
β¨ NN_REALLOCMSG β¨
okay bestie, pull up a chair π this is the nn_reallocmsg page from the nanomsg manual, section 3, and it's literally the glow-up-your-message function. let's get into it.
πΈ NAME πΈ
nn_reallocmsg β reallocate a message. that's it, that's the whole vibe. resize szn π
π¦ SYNOPSIS π¦
#include <nanomsg/nn.h>
void *nn_reallocmsg (void *msg, size_t size);
yes queen, that's the signature. void * in, void * out, size_t size for the new size. no cap. β¨
π DESCRIPTION π
so here's the tea π« β this function reallocates a message that was previously allocated by nn_allocmsg(3), or that you received from a peer using the NN_MSG mechanism.
basically: you got a message, and now you want it to be a different size. this is the function for that. main character energy fr fr π
β οΈ important bestie β just like the standard realloc, this operation may involve copying the data in the buffer. so like, it's not always an in-place glow-up. the data might get moved. the way that realloc works... yeah. lowkey iconic, highkey worth knowing. π
π RETURN VALUE π
- if the function succeeds, you get a pointer to the newly allocated buffer back. slay π
- otherwise,
NULLis returned anderrnois set to one of the values defined below. not the vibe, but okay. π
π₯ ERRORS π₯
ENOMEMβ not enough memory to allocate the message. the machine said no. π
π EXAMPLE π
here's the whole thing in action, bestie:
void *buf = nn_allocmsg (12, 0);
void *newbuf = nn_reallocmsg (buf, 20);
nn_freemsg (newbuf);
allocate 12, realloc to 20, free it. clean, simple, periodt. β¨
π SEE ALSO π
go read these next, i'm obsessed with them:
π AUTHORS π
- Martin Sustrik
<sustrik@250bpm.com>
and that's the whole page, bestie!! π«Ά this was nanomsg version 1.2.2, dated 2026-01-16, and yeah β the manual name was NN_REALLOCMSG(3) the whole time, iykyk. now go reallocate something responsibly. mwah. π
π§π
π¦ where this page comes from
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms