diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2013-07-30 11:24:42 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2013-07-30 11:24:42 +0000 |
commit | 6be1df9b9f4e02ef59f74ebdde8aed3df624f8c3 (patch) | |
tree | 47112a8a150d302e94b183ca8733a61712c8d83c /debian/patches/140_sort-dump-links.patch | |
parent | Update 015_debian-version.patch (diff) | |
download | w3m-6be1df9b9f4e02ef59f74ebdde8aed3df624f8c3.tar.gz w3m-6be1df9b9f4e02ef59f74ebdde8aed3df624f8c3.zip |
New patch 140_sort-dump-links.patch to sort anchors in -dump
Diffstat (limited to '')
-rw-r--r-- | debian/patches/140_sort-dump-links.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/140_sort-dump-links.patch b/debian/patches/140_sort-dump-links.patch new file mode 100644 index 0000000..f290613 --- /dev/null +++ b/debian/patches/140_sort-dump-links.patch @@ -0,0 +1,47 @@ +Subject: Sort anchors by sequence number in -dump +Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657666 +From: "Conrad J.C. Hughes (for Debian package stuff)" <debbugs@xrad.org> + +Resolved merge conflicts by Tatsuya Kinoshita. + +--- a/main.c ++++ b/main.c +@@ -1269,6 +1269,12 @@ dump_extra(Buffer *buf) + #endif + } + ++static int ++cmp_anchor_hseq(const void *a, const void *b) ++{ ++ return (*((const Anchor **) a))->hseq - (*((const Anchor **) b))->hseq; ++} ++ + static void + do_dump(Buffer *buf) + { +@@ -1289,15 +1295,20 @@ do_dump(Buffer *buf) + int i; + saveBuffer(buf, stdout, FALSE); + if (displayLinkNumber && buf->href) { ++ int nanchor = buf->href->nanchor; + printf("\nReferences:\n\n"); +- for (i = 0; i < buf->href->nanchor; i++) { +- ParsedURL pu; ++ Anchor **in_order = New_N(Anchor *, buf->href->nanchor); ++ for (i = 0; i < nanchor; i++) ++ in_order[i] = buf->href->anchors + i; ++ qsort(in_order, nanchor, sizeof(Anchor *), cmp_anchor_hseq); ++ for (i = 0; i < nanchor; i++) { ++ ParsedURL pu; + char *url; +- if (buf->href->anchors[i].slave) ++ if (in_order[i]->slave) + continue; +- parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf)); ++ parseURL2(in_order[i]->url, &pu, baseURL(buf)); + url = url_decode2(parsedURL2Str(&pu)->ptr, Currentbuf); +- printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, url); ++ printf("[%d] %s\n", in_order[i]->hseq + 1, url); + } + } + } |