aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2013-07-30 11:24:42 +0000
committerTatsuya Kinoshita <tats@debian.org>2013-07-30 11:24:42 +0000
commit6be1df9b9f4e02ef59f74ebdde8aed3df624f8c3 (patch)
tree47112a8a150d302e94b183ca8733a61712c8d83c /debian/patches
parentUpdate 015_debian-version.patch (diff)
downloadw3m-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.patch47
-rw-r--r--debian/patches/series1
2 files changed, 48 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);
+ }
+ }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index bfc7f58..6181bb8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@
110_form-input-text.patch
120_sgrmouse.patch
130_siteconf.patch
+140_sort-dump-links.patch