On Sat, 14 Jun 2003 16:49:45 -0700 Chris Palmer <chris@nodewarrior.org> wrote:
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?
I had a quick look around for this and found the following comment for a_Dw_page_add_text (from src/dw_page.c): /* * Add a word to the page structure. Stashes the argument pointer in * the page data structure so that it will be deallocated on destroy. */ Which I guess answers the second question too. It's always such a pleasant surprise to have actual, useful comments in code! But then, I've come to expect pleasant surprises with Dillo ;) -- Stephen Lewis slewis@paradise.net.nz