diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-05-25 21:07:59 +1000 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-05-25 21:07:59 +1000 |
| commit | 43060f159f83194f9363d1cd4d6d97cdadde3b7d (patch) | |
| tree | 3ee9f0c2bf76907b2854bf6ba2be8ab124b74fb9 /common/stringop.c | |
| parent | 6830ceefba5b6e33a5ede03bae2d62c5e99cdb87 (diff) | |
Clean up container title functions
* Add and use lenient_strcat and lenient_strncat functions
* Rename `concatenate_child_titles` function as that's no longer what it
does
* Rename `container_notify_child_title_changed` because we only need to
notify that the tree structure has changed, not titles
* Don't notify parents when a child changes its title
* Update ancestor titles when changing a container's layout
* Eg. create nested tabs and change the inner container to stacking
* No need to store tree presentation in both container->name and
formatted_title
Diffstat (limited to 'common/stringop.c')
| -rw-r--r-- | common/stringop.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/stringop.c b/common/stringop.c index 4a37543d..d9ae9925 100644 --- a/common/stringop.c +++ b/common/stringop.c @@ -55,6 +55,20 @@ void strip_quotes(char *str) { *end = '\0'; } +char *lenient_strcat(char *dest, const char *src) { + if (dest && src) { + return strcat(dest, src); + } + return dest; +} + +char *lenient_strncat(char *dest, const char *src, size_t len) { + if (dest && src) { + return strncat(dest, src, len); + } + return dest; +} + // strcmp that also handles null pointers. int lenient_strcmp(char *a, char *b) { if (a == b) { |
