XStringListToTextProperty(3)

πŸ¦‹ string lists + text properties: the libX11 page πŸ¦‹

okay bestie, this is the libX11 / XLIB FUNCTIONS manual page for XStringListToTextProperty(3), and it's literally about converting string lists and text property structures. No cap, it's giving β€œC API but make it group chat.” πŸ’…


🌸 NAME 🌸

XStringListToTextProperty, XTextPropertyToStringList, XFreeStringList, XTextProperty β€” convert string lists and text property structure. That's the whole squad, and yes, some of these are functions and one is the structure. ✨

πŸŽ€ SYNTAX πŸŽ€

Status XStringListToTextProperty(char **list, int count, XTextProperty
       *text_prop_return);

Status XTextPropertyToStringList(XTextProperty *text_prop, char
       ***list_return, int *count_return);

void XFreeStringList(char **list);

πŸ’– ARGUMENTS πŸ’–

  • count β€” specifies the number of strings. πŸ”’
  • count_return β€” returns the number of strings. she gives you the count back, queen.
  • list β€” specifies the list of strings to be freed. 🧹
  • list β€” specifies a list of null-terminated character strings. yes, same arg name, different job β€” not me having two lists in the same section 😭
  • list_return β€” returns a list of null-terminated character strings. 🎁
  • text_prop β€” specifies the XTextProperty structure to be used.
  • text_prop_return β€” returns the XTextProperty structure. πŸ“¦

πŸ”₯ DESCRIPTION πŸ”₯

So XStringListToTextProperty sets the specified XTextProperty to be of type STRING (format 8) with a value representing the concatenation of the specified list of null-separated character strings. It also stores an extra null byte at the end of the value field of text_prop_return β€” and that extra null byte is not included in the nitems member. The strings are assumed (without verification!) to be in the STRING encoding. If insufficient memory is available for the new value string, XStringListToTextProperty does not set any fields in the XTextProperty structure and returns a zero status. Otherwise, it returns a nonzero status. To free the storage for the value field, use XFree. ✨

XTextPropertyToStringList returns a list of strings representing the null-separated elements of the specified XTextProperty structure. Important vibe check: the data in text_prop must be of type STRING and format 8. Multiple elements of the property β€” for example, the strings in a disjoint text selection β€” are separated by NULL (encoding 0). The contents of the property are not null-terminated. If insufficient memory is available for the list and its elements, XTextPropertyToStringList sets no return values and returns a zero status. Otherwise, it returns a nonzero status. To free the storage for the list and its contents, use XFreeStringList. πŸ’…

XFreeStringList releases memory allocated by XmbTextPropertyToTextList, Xutf8TextPropertyToTextList and XTextPropertyToStringList, plus the missing charset list allocated by XCreateFontSet. So it's the cleanup bestie for those specific allocations. 🧹🫢

🧚 STRUCTURES 🧚

The XTextProperty structure contains:

typedef struct {
        unsigned char *value;   /* property data */
        Atom encoding;  /* type of property */
        int format;     /* 8, 16, or 32 */
        unsigned long nitems;   /* number of items in value */
} XTextProperty;

🌈 SEE ALSO 🌈

go read these too, bestie:


k bye bestie πŸ’– this page comes from X Version 11, libX11 1.8.14, and the footer tag is XStringListToTextProperty(3). The footer doesn't list a separate date, so no invented date here β€” no cap. 🫢✨

πŸ“¦ where this page comes from