Scroll to navigation

TICKIT_STRING(7) Miscellaneous Information Manual TICKIT_STRING(7)

NAME

TickitString - a reference-counted string buffer

SYNOPSIS

#include <tickit.h>

typedef struct TickitString;

DESCRIPTION

A TickitString instance stores a NUL-terminated character buffer (i.e. a plain C string) and a reference count. It allows string buffers to be efficiently shared while their usage is tracked, and reclaimed once no longer required.

FUNCTIONS

A new TickitString instance is created by calling tickit_string_new(3). Once constructed, its buffer can be read by calling tickit_string_get(3) and its length queried by tickit_string_len(3). The buffer should be considered immutable; it cannot be modified.

A string instance maintains a reference count to make it easier for applications to share and manage the lifetime of these buffers. A new string starts with a count of one, and it can be adjusted using tickit_string_ref(3) and tickit_string_unref(3). When the count reaches zero the instance is destroyed.

SEE ALSO

tickit(7)