Introduce a function to copy i3strings
This commit is contained in:
parent
dd488818a9
commit
8272924117
|
@ -169,6 +169,12 @@ i3String *i3string_from_markup_with_length(const char *from_markup, size_t num_b
|
||||||
*/
|
*/
|
||||||
i3String *i3string_from_ucs2(const xcb_char2b_t *from_ucs2, size_t num_glyphs);
|
i3String *i3string_from_ucs2(const xcb_char2b_t *from_ucs2, size_t num_glyphs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the given i3string.
|
||||||
|
* Note that this will not free the source string.
|
||||||
|
*/
|
||||||
|
i3String *i3string_copy(i3String *str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free an i3String.
|
* Free an i3String.
|
||||||
*
|
*
|
||||||
|
|
|
@ -109,6 +109,17 @@ i3String *i3string_from_ucs2(const xcb_char2b_t *from_ucs2, size_t num_glyphs) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the given i3string.
|
||||||
|
* Note that this will not free the source string.
|
||||||
|
*/
|
||||||
|
i3String *i3string_copy(i3String *str) {
|
||||||
|
if (str->is_markup)
|
||||||
|
return i3string_from_markup(i3string_as_utf8(str));
|
||||||
|
else
|
||||||
|
return i3string_from_utf8(i3string_as_utf8(str));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free an i3String.
|
* Free an i3String.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue