shithub: mc

Download patch

ref: 5c1af81cfb80a3a4dcdb9b4cd8f1597366a0233c
parent: 72a6efce6e4619af93bea66fdfd1916ebe2d6af1
author: Ori Bernstein <[email protected]>
date: Mon Jan 6 17:18:25 EST 2014

Make the code match the comment.

--- a/6/ra.c
+++ b/6/ra.c
@@ -955,7 +955,7 @@
     regid u[Maxuse], d[Maxdef];
     size_t nu, nd;
     size_t useidx, defidx;
-    size_t i, j;
+    size_t i, j, k;
     int found;
 
     useidx = 0;
@@ -980,10 +980,12 @@
          * store the same register from the def. */
         found = 0;
         for (j = 0; j < defidx; j++) {
-            if (def[i].oldreg == d[i]) {
-                def[defidx].newreg = locreg(locmap[d[i]]->mode);
-                bsput(s->neverspill, def[defidx].newreg->reg.id);
-                found = 1;
+            for (k = 0; i < useidx; k++) {
+                if (use[j].oldreg == d[k]) {
+                    def[defidx].newreg = use[j].newreg;
+                    bsput(s->neverspill, def[defidx].newreg->reg.id);
+                    found = 1;
+                }
             }
         }
         if (!found) {
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -25,6 +25,7 @@
     slcp.myr \
     sldup.myr \
     sleq.myr \
+    slfill.myr \
     sljoin.myr \
     slpush.myr \
     slurp.myr \
--- a/libstd/dial.myr
+++ b/libstd/dial.myr
@@ -61,6 +61,7 @@
 
 	match getaddr(host)
 	| `Ipv4 bits:
+		put("connecting to %ub.%ub.%ub.%ub:%i\n", bits[0], bits[1], bits[2], bits[3], portnum)
 		sa.fam = Afinet
 		sa.addr = bits
 		sa.port = hosttonet(portnum)
@@ -68,13 +69,18 @@
 		-> `Failure "ipv6 not yet supported"
 	;;
 
+	put("socketing...\n")
 	sock = socket(sa.fam, socktype, 0)
+	put("socketed\n")
 	if sock < 0
 		-> `Failure "failed to connect to socket"
 	;;
 	var err
+	put("connecting...\n")
 	err = connect(sock, (&sa) castto(sockaddr#), sizeof(sockaddr_in))
+	put("connected\n")
 	if err < 0
+		put("Errno %i\n", -err)
 		close(sock)
 		-> `Failure "Failed to bind socket"
 	;;
--- /dev/null
+++ b/libstd/slfill.myr
@@ -1,0 +1,12 @@
+pkg std =
+	generic slfill	: (sl : @a[:], v : @a	-> @a[:])
+;;
+
+generic slfill = {sl, v
+	var i
+
+	for i = 0; i < sl.len; i++
+		sl[i] = v
+	;;
+	-> sl
+}