diff options
-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); |