XMSTRINGCONCATANDFREE(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

XmStringConcatAndFree β€” a compound string function that glues one string onto the end of another and then frees the originals, bestie πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <Xm/Xm.h>
XmString XmStringConcatAndFree(
XmString s1,
XmString s2);

πŸ’… DESCRIPTION πŸ’…

okay so here's the vibe: XmStringConcatAndFree copies s2 to the end of s1 and hands you back a copy of the resulting compound string. and then β€” this is the part that makes it iconic β€” the original strings get freed. like, both of them. gone. slay ✨

the function will allocate space to hold the returned compound string, so bestie, that memory is yours to manage now. the application is responsible for managing the allocated space. 🫢

and how do you give that space back? you call XmStringFree. that's it. that's the whole recovery arc πŸ’€

  • s1 β€” specifies the compound string to which a copy of s2 is appended. she's the main character, everything gets appended to her πŸ‘‘
  • s2 β€” specifies the compound string that is appended to the end of s1. she's the plus-one tagging along at the end 🌸

so here's the tea: XmStringConcatAndFree works like the XmStringConcat function, except that it frees the s1 and s2 strings, and is therefore more efficient. you should use XmStringConcatAndFree instead of XmStringConcat if you want s1 and s2 to be freed afterwards. no cap, that's literally the whole point. iykyk πŸ”₯

⚠️ heads up bestie: once this runs, s1 and s2 are freed. if you still needed them for something else, that's giving undefined-behaviour energy. plan accordingly πŸ’€

🌈 RETURN 🌈

returns a new compound string. brand new. fresh out the box. periodt ✨



and that's the whole page, bestie!! this was XmStringConcatAndFree(library call) β€” a library call, in case the parentheses didn't already give it away πŸ’… go forth, concat, and free responsibly πŸŽ€βœ¨πŸ’–