New stuff
Thomas Arendsen Hein
thomas at intevation.de
Tue May 17 13:58:44 UTC 2005
* Matt Mackall <mpm at selenic.com> [20050517 11:58]:
> There's now a Python extension to do the delta patching.
goto is evil, attached are two patches to get rid of them.
Both should do the same, I only included them to show the difference
in diff generation between 'hg diff' and 'diff -u'.
Thomas
--
Email: thomas at intevation.de
http://intevation.de/~thomas/
-------------- next part --------------
# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID c8a3fb823ae8d5059a4bbd5c9106a915ebe8746a
# Parent 17884f79d59d8c8b3630819e931b0ae8c232d338
goto is evil.
--- a/mercurial/mpatch.c Tue May 17 09:27:14 2005
+++ b/mercurial/mpatch.c Tue May 17 12:57:14 2005
@@ -67,7 +67,7 @@
while (s != src->tail) {
if (s->start + offset >= cut)
- goto exit; /* we've gone far enough */
+ break; /* we've gone far enough */
postend = offset + s->start + s->len;
if (postend <= cut) {
@@ -95,11 +95,10 @@
s->len = s->len - l;
s->data = s->data + l;
- goto exit;
- }
- }
-
- exit:
+ break;
+ }
+ }
+
dest->tail = d;
src->head = s;
return offset;
@@ -113,7 +112,7 @@
while (s != src->tail) {
if (s->start + offset >= cut)
- goto exit;
+ break;
postend = offset + s->start + s->len;
if (postend <= cut) {
@@ -133,11 +132,10 @@
s->len = s->len - l;
s->data = s->data + l;
- goto exit;
- }
- }
-
- exit:
+ break;
+ }
+ }
+
src->head = s;
return offset;
}
-------------- next part --------------
diff -urN --exclude .hg --exclude build mercurial-upstream/mercurial/mpatch.c mercurial-no_goto/mercurial/mpatch.c
--- mercurial-upstream/mercurial/mpatch.c 2005-05-17 14:29:31.000000000 +0200
+++ mercurial-no_goto/mercurial/mpatch.c 2005-05-17 14:52:03.000000000 +0200
@@ -67,7 +67,7 @@
while (s != src->tail) {
if (s->start + offset >= cut)
- goto exit; /* we've gone far enough */
+ break; /* we've gone far enough */
postend = offset + s->start + s->len;
if (postend <= cut) {
@@ -95,11 +95,10 @@
s->len = s->len - l;
s->data = s->data + l;
- goto exit;
+ break;
}
}
- exit:
dest->tail = d;
src->head = s;
return offset;
@@ -113,7 +112,7 @@
while (s != src->tail) {
if (s->start + offset >= cut)
- goto exit;
+ break;
postend = offset + s->start + s->len;
if (postend <= cut) {
@@ -133,11 +132,10 @@
s->len = s->len - l;
s->data = s->data + l;
- goto exit;
+ break;
}
}
- exit:
src->head = s;
return offset;
}
More information about the Mercurial
mailing list