Madis Janson writes:
+ gchar *src, *buf, *name; + gint dummy, len; - if ( !(attrbuf = Html_get_attr(html, tag, tagsize, "name")) ) { + if ( !!(attrbuf = Html_get_attr(html, tag, tagsize, "name")) ) { + a_Dw_page_add_text(page, g_strdup(attrbuf), link_style); + } else if (tolower(tag[1]) != 'i' || (len = strlen(name = src)) < 16 || + (name += 7, len -= 7) < 16) { - a_Dw_page_add_text(page, g_strdup(attrbuf), link_style); + buf = g_malloc(16); + memcpy(buf, name, 6); + strcpy(buf + 6, "..."); + memcpy(buf + 9, name + (len - 6), 6); + buf[15] = 0; + a_Dw_page_add_text(page, buf, link_style);
Two questions: 1. Where does buf get free()'d? 2. If you know the exact size you need for buf, why not just use an array of that size? char buf[16]; bzero(buf, 16);