From 48a50770f46f160d8cbc852fdb90ea0c6c74cdd7 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 27 Sep 2022 10:20:33 +0200 Subject: [PATCH] Use xs_replace_i() in some places. --- html.c | 5 +---- httpd.c | 3 +-- snac.c | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/html.c b/html.c index de9060c..532c033 100644 --- a/html.c +++ b/html.c @@ -63,10 +63,7 @@ d_char *not_really_markdown(char *content, d_char **f_content) s = xs_str_cat(s, ""); /* some beauty fixes */ - if (xs_str_in(s, "
") != -1) { - xs *os = s; - s = xs_replace(os, "
", ""); - } + s = xs_replace_i(s, "
", ""); *f_content = s; diff --git a/httpd.c b/httpd.c index 256d7b1..3746a7f 100644 --- a/httpd.c +++ b/httpd.c @@ -47,7 +47,6 @@ int server_get_handler(d_char *req, char *q_path, xs *list = user_list(); char *p, *uid; xs *ul = xs_str_new("\n"); - s = xs_replace(os, "%userlist%", ul); + s = xs_replace_i(s, "%userlist%", ul); } *body = s; diff --git a/snac.c b/snac.c index 7063b4c..04c5944 100644 --- a/snac.c +++ b/snac.c @@ -77,8 +77,7 @@ void srv_debug(int level, d_char *str) if (xs_str_in(msg, srv_basedir) != -1) { /* replace basedir with ~ */ - xs *o_str = msg; - msg = xs_replace(o_str, srv_basedir, "~"); + msg = xs_replace_i(msg, srv_basedir, "~"); } if (dbglevel >= level) { @@ -96,8 +95,7 @@ void snac_debug(snac *snac, int level, d_char *str) if (xs_str_in(msg, snac->basedir) != -1) { /* replace long basedir references with ~ */ - xs *o_str = msg; - msg = xs_replace(o_str, snac->basedir, "~"); + msg = xs_replace_i(msg, snac->basedir, "~"); } srv_debug(level, msg);