chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6837cc4
)
Extra utility function.
author
Simon Tatham
<anakin@pobox.com>
Sat, 5 Aug 2006 16:35:25 +0000
(16:35 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 5 Aug 2006 16:35:25 +0000
(16:35 +0000)
[originally from svn r6780]
dsf.c
patch
|
blob
|
history
puzzles.h
patch
|
blob
|
history
diff --git
a/dsf.c
b/dsf.c
index a81bc3c008853a0a3b97e89898585da6eee4f6d4..91d4b2cb6ab74b642df369aae1d0c7932ff9918e 100644
(file)
--- a/
dsf.c
+++ b/
dsf.c
@@
-28,3
+28,11
@@
void dsf_merge(int *dsf, int v1, int v2)
v2 = dsf_canonify(dsf, v2);
dsf[v2] = v1;
}
+
+void dsf_init(int *dsf, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ dsf[i] = i;
+}
diff --git
a/puzzles.h
b/puzzles.h
index d9cb745d6c2555434e3222d9c8c9dd2fecc494a2..4b977a58e504e041aec831f1dd53a761e000dccd 100644
(file)
--- a/
puzzles.h
+++ b/
puzzles.h
@@
-280,6
+280,7
@@
void draw_rect_outline(drawing *dr, int x, int y, int w, int h,
*/
int dsf_canonify(int *dsf, int val);
void dsf_merge(int *dsf, int v1, int v2);
+void dsf_init(int *dsf, int len);
/*
* version.c