diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-01 02:39:56 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-01 02:39:56 (EDT) |
commit | 819a8ce31288c065be0160d23dd804ec3ea188d7 (patch) | |
tree | 56af50ff3b89b003dc7c123ed2705dc8344efd32 /src | |
parent | 524e712b8e2cf42caecf6b819db2f37cb6262c2b (diff) | |
download | marquee-819a8ce31288c065be0160d23dd804ec3ea188d7.zip marquee-819a8ce31288c065be0160d23dd804ec3ea188d7.tar.gz marquee-819a8ce31288c065be0160d23dd804ec3ea188d7.tar.bz2 |
mq_html_p(), mq_html_p_free(): New functions
Diffstat (limited to 'src')
-rw-r--r-- | src/html.c | 34 | ||||
-rw-r--r-- | src/html.h | 6 |
2 files changed, 40 insertions, 0 deletions
@@ -70,6 +70,40 @@ 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; +} + +gchar * +mq_html_p_free(gchar *text) +{ + gchar *p; + + p = mq_html_p(text); + + g_free(text); + + return p; +} + +gchar * mq_html_container(const gchar *element, ...) { gsize len; @@ -28,6 +28,12 @@ gchar * mq_html_document(const gchar *title, ...); gchar * +mq_html_p(gchar *text); + +gchar * +mq_html_p_free(gchar *text); + +gchar * mq_html_container(const gchar *element, ...); gchar * |