aboutsummaryrefslogtreecommitdiffstats
path: root/common/stringop.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:07:59 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-05-25 21:07:59 +1000
commitdb38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f (patch)
tree3ee9f0c2bf76907b2854bf6ba2be8ab124b74fb9 /common/stringop.c
parentMerge pull request #2028 from RyanDwyer/fix-move-workspace (diff)
downloadsway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.tar.gz
sway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.tar.zst
sway-db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f.zip
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.c14
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) {
55 *end = '\0'; 55 *end = '\0';
56} 56}
57 57
58char *lenient_strcat(char *dest, const char *src) {
59 if (dest && src) {
60 return strcat(dest, src);
61 }
62 return dest;
63}
64
65char *lenient_strncat(char *dest, const char *src, size_t len) {
66 if (dest && src) {
67 return strncat(dest, src, len);
68 }
69 return dest;
70}
71
58// strcmp that also handles null pointers. 72// strcmp that also handles null pointers.
59int lenient_strcmp(char *a, char *b) { 73int lenient_strcmp(char *a, char *b) {
60 if (a == b) { 74 if (a == b) {