diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-01 02:42:38 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-01 02:42:38 (EDT) |
commit | 8db7bd7e8ef20a66beffe25a5bc13fe276d37902 (patch) | |
tree | e143b08dec5f38c69c74a874826c6f776194b1bd | |
parent | 819a8ce31288c065be0160d23dd804ec3ea188d7 (diff) | |
download | marquee-8db7bd7e8ef20a66beffe25a5bc13fe276d37902.zip marquee-8db7bd7e8ef20a66beffe25a5bc13fe276d37902.tar.gz marquee-8db7bd7e8ef20a66beffe25a5bc13fe276d37902.tar.bz2 |
mq_html_p(), mq_html_p_free(): Just use g_strconcat()
-rw-r--r-- | src/html.c | 22 |
1 files changed, 3 insertions, 19 deletions
@@ -72,31 +72,15 @@ mq_html_document(const gchar *title, ...) gchar * mq_html_p(gchar *text) { - gsize len; - gchar *p; - gchar *ptr; - - /* Calculate length. */ - len = strlen("<p>"); - len += strlen(text); - len += strlen("</p>\n"); - ++len; /* NUL byte */ - - /* Build string. */ - p = g_new(gchar, len); - ptr = g_stpcpy(p, "<p>"); - ptr = g_stpcpy(ptr, text); - ptr = g_stpcpy(ptr, "</p>\n"); /* g_stpcpy() adds the NUL. */ - - return p; + return g_strconcat("<p>", text, "</p>", NULL); } gchar * mq_html_p_free(gchar *text) { - gchar *p; + gchar *p; - p = mq_html_p(text); + p = g_strconcat("<p>", text, "</p>", NULL); g_free(text); |