Use xs_replace_i() in some places.

This commit is contained in:
default 2022-09-27 10:20:33 +02:00
parent c41f982eea
commit 48a50770f4
3 changed files with 4 additions and 10 deletions

5
html.c
View File

@ -63,10 +63,7 @@ d_char *not_really_markdown(char *content, d_char **f_content)
s = xs_str_cat(s, "</pre>"); s = xs_str_cat(s, "</pre>");
/* some beauty fixes */ /* some beauty fixes */
if (xs_str_in(s, "</blockquote><br>") != -1) { s = xs_replace_i(s, "</blockquote><br>", "</blockquote>");
xs *os = s;
s = xs_replace(os, "</blockquote><br>", "</blockquote>");
}
*f_content = s; *f_content = s;

View File

@ -47,7 +47,6 @@ int server_get_handler(d_char *req, char *q_path,
xs *list = user_list(); xs *list = user_list();
char *p, *uid; char *p, *uid;
xs *ul = xs_str_new("<ul class=\"snac-user-list\">\n"); xs *ul = xs_str_new("<ul class=\"snac-user-list\">\n");
xs *os = s;
p = list; p = list;
while (xs_list_iter(&p, &uid)) { while (xs_list_iter(&p, &uid)) {
@ -67,7 +66,7 @@ int server_get_handler(d_char *req, char *q_path,
ul = xs_str_cat(ul, "</ul>\n"); ul = xs_str_cat(ul, "</ul>\n");
s = xs_replace(os, "%userlist%", ul); s = xs_replace_i(s, "%userlist%", ul);
} }
*body = s; *body = s;

6
snac.c
View File

@ -77,8 +77,7 @@ void srv_debug(int level, d_char *str)
if (xs_str_in(msg, srv_basedir) != -1) { if (xs_str_in(msg, srv_basedir) != -1) {
/* replace basedir with ~ */ /* replace basedir with ~ */
xs *o_str = msg; msg = xs_replace_i(msg, srv_basedir, "~");
msg = xs_replace(o_str, srv_basedir, "~");
} }
if (dbglevel >= level) { 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) { if (xs_str_in(msg, snac->basedir) != -1) {
/* replace long basedir references with ~ */ /* replace long basedir references with ~ */
xs *o_str = msg; msg = xs_replace_i(msg, snac->basedir, "~");
msg = xs_replace(o_str, snac->basedir, "~");
} }
srv_debug(level, msg); srv_debug(level, msg);