From 3beb9e42dcf434610625de8d3824505186a95757 Mon Sep 17 00:00:00 2001 From: Matthew Todd Date: Wed, 16 Jan 2013 21:15:23 -0800 Subject: [PATCH] Replace all occurrences of markup in notification. fix_markup previously would only replace one occurrence of needle in the notification string. So we'd end up with some markup's making it through, if there was more than one of a particular kind. Introduces new function string_replace_all and calls it from fix_markup. --- dunst.c | 30 +++++++++++++++--------------- utils.c | 12 ++++++++++++ utils.h | 4 ++++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/dunst.c b/dunst.c index 6b4ccac..7b43dbd 100644 --- a/dunst.c +++ b/dunst.c @@ -874,23 +874,23 @@ char return NULL; } - str = string_replace(""", "\"", str); - str = string_replace("'", "'", str); - str = string_replace("&", "&", str); - str = string_replace("<", "<", str); - str = string_replace(">", ">", str); + str = string_replace_all(""", "\"", str); + str = string_replace_all("'", "'", str); + str = string_replace_all("&", "&", str); + str = string_replace_all("<", "<", str); + str = string_replace_all(">", ">", str); /* remove tags */ - str = string_replace("", "", str); - str = string_replace("", "", str); - str = string_replace("
", " ", str); - str = string_replace("
", " ", str); - str = string_replace("
", " ", str); - str = string_replace("", "", str); - str = string_replace("", "", str); - str = string_replace("", "", str); - str = string_replace("", "", str); - str = string_replace("", "", str); + str = string_replace_all("", "", str); + str = string_replace_all("", "", str); + str = string_replace_all("
", " ", str); + str = string_replace_all("
", " ", str); + str = string_replace_all("
", " ", str); + str = string_replace_all("", "", str); + str = string_replace_all("", "", str); + str = string_replace_all("", "", str); + str = string_replace_all("", "", str); + str = string_replace_all("", "", str); start = strstr(str, "