shithub: mc

Download patch

ref: 1dde9b5ae36ddab2385148228da62ffbff37cdaa
parent: c2bcb3b515131d8bfd7b31eef5f469182b5df948
author: Ori Bernstein <[email protected]>
date: Sun Dec 14 11:43:53 EST 2014

Add a function for clearing any value.

    Fills all values with zero bits. This may or may not be useful.

--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -17,6 +17,7 @@
 	blat.myr \
 	chartype.myr \
 	cmp.myr \
+	clear.myr \
 	dial.myr \
 	die.myr \
 	dir.myr \
--- a/libstd/bldfile
+++ b/libstd/bldfile
@@ -19,6 +19,7 @@
 	bitset.myr
 	blat.myr
 	chartype.myr
+        clear.myr
 	cmp.myr
 	dial.myr
 	die.myr
--- /dev/null
+++ b/libstd/clear.myr
@@ -1,0 +1,12 @@
+use "slfill.use"
+pkg std =
+	generic clear	: (p : @a#	-> void)
+;;
+
+generic clear = {p : @a#
+	var bp
+
+	bp = p castto(byte#)
+	slfill(bp[:sizeof(@a)], 0)
+}
+