From db38b9bbf3cce4083c538209a7ce5ef1a1cf5f3f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 25 May 2018 21:07:59 +1000 Subject: 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 --- include/stringop.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/stringop.h') diff --git a/include/stringop.h b/include/stringop.h index 7c29a745..e7f58011 100644 --- a/include/stringop.h +++ b/include/stringop.h @@ -1,5 +1,6 @@ #ifndef _SWAY_STRINGOP_H #define _SWAY_STRINGOP_H +#include #include "list.h" #if !HAVE_DECL_SETENV @@ -14,6 +15,10 @@ char *strip_whitespace(char *str); char *strip_comments(char *str); void strip_quotes(char *str); +// strcat that does nothing if dest or src is NULL +char *lenient_strcat(char *dest, const char *src); +char *lenient_strncat(char *dest, const char *src, size_t len); + // strcmp that also handles null pointers. int lenient_strcmp(char *a, char *b); -- cgit v1.2.3