git » nmdb » commit 4bc4501

Use D's resize mechanisms instead of an ugly hack.

author Alberto Bertogli
2007-09-01 23:41:16 UTC
committer Alberto Bertogli
2007-09-01 23:41:16 UTC
parent a791397be7b0d89cad3ee83cd688ee63598e38ac

Use D's resize mechanisms instead of an ugly hack.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

bindings/d/nmdb.d +4 -1

diff --git a/bindings/d/nmdb.d b/bindings/d/nmdb.d
index e6d51eb..5915197 100644
--- a/bindings/d/nmdb.d
+++ b/bindings/d/nmdb.d
@@ -97,7 +97,10 @@ class DB
 			throw new Exception("Can't get value");
 		}
 
-		return v[0 .. cast(size_t) size];
+		// resize using D's magic
+		v.length = cast(size_t) size;
+
+		return v;
 	}
 
 	private void do_set(char[] key, char[] val, int mode)