chiark / gitweb /
r6880 accidentally backed out r6780. That's what I get for accepting
authorSimon Tatham <anakin@pobox.com>
Sun, 29 Oct 2006 09:34:09 +0000 (09:34 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 29 Oct 2006 09:34:09 +0000 (09:34 +0000)
source files from Mike rather than patches, and not adequately
checking the result...

[originally from svn r6882]
[r6780 == f05c25347d66821d928668a7e87dffbf3ffed027]
[r6880 == b9547673c6462bf73e642328300479df6df71d7b]

dsf.c

diff --git a/dsf.c b/dsf.c
index f4deb1e5bfc25f6f9fa62a8e87e3f2c436f44f6d..207357de7f342ea8b30231faf16a7ddfa0b0616e 100644 (file)
--- a/dsf.c
+++ b/dsf.c
@@ -60,17 +60,23 @@ done:
     sfree(inverse_elements);
 }
 
-int *snew_dsf(int size)
+void dsf_init(int *dsf, int size)
 {
     int i;
-    int *ret;
-    
-    ret = snewn(size, int);
+
     for (i = 0; i < size; i++) {
         /* Bottom bit of each element of this array stores whether that element
          * is opposite to its parent, which starts off as false */
-        ret[i] = i << 1; 
+        dsf[i] = i << 1;
     }
+}
+
+int *snew_dsf(int size)
+{
+    int *ret;
+    
+    ret = snewn(size, int);
+    dsf_init(ret, size);
 
     /*print_dsf(ret, size); */