summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-07-25 07:40:14 +0200
committerEugen Wissner <belka@caraus.de>2017-07-25 07:40:14 +0200
commit1389b03842ede1ea73d38f41e6575f1055dc0a83 (patch)
treef49af1d5519995f5992161535d2a7ead791126e8
parenta37c9b162e877aa9544f79436adcc83471d68cee (diff)
downloadtanya-1389b03842ede1ea73d38f41e6575f1055dc0a83.tar.gz
memory: Fix parameter name in the documentation
Size parameter for "make" was renamed into n, but the function description wasn't fixed: size => n This commit also removes some redundant variables in "make".
-rw-r--r--source/tanya/memory/package.d26
1 files changed, 8 insertions, 18 deletions
diff --git a/source/tanya/memory/package.d b/source/tanya/memory/package.d
index a9491fe..e6d1db8 100644
--- a/source/tanya/memory/package.d
+++ b/source/tanya/memory/package.d
@@ -178,7 +178,7 @@ pure nothrow @safe @nogc
return (size - 1) / alignment * alignment + alignment;
}
-/**
+/*
* Internal function used to create, resize or destroy a dynamic array. It
* may throw $(D_PSYMBOL OutOfMemoryError). The new
* allocated part of the array isn't initialized. This function can be trusted
@@ -381,10 +381,7 @@ in
}
body
{
- T ret;
- const size = stateSize!T;
-
- auto mem = (() @trusted => allocator.allocate(size))();
+ auto mem = (() @trusted => allocator.allocate(stateSize!T))();
if (mem is null)
{
onOutOfMemoryError();
@@ -394,9 +391,7 @@ body
() @trusted { allocator.deallocate(mem); }();
}
- ret = emplace!T(mem[0 .. size], args);
-
- return ret;
+ return emplace!T(mem[0 .. stateSize!T], args);
}
/**
@@ -425,10 +420,7 @@ in
}
body
{
- typeof(return) ret;
- const size = stateSize!T;
-
- auto mem = (() @trusted => allocator.allocate(size))();
+ auto mem = (() @trusted => allocator.allocate(stateSize!T))();
if (mem is null)
{
onOutOfMemoryError();
@@ -438,10 +430,8 @@ body
() @trusted { allocator.deallocate(mem); }();
}
- auto ptr = (() @trusted => (cast(T*) mem[0 .. size].ptr))();
- ret = emplace!T(ptr, args);
-
- return ret;
+ auto ptr = (() @trusted => (cast(T*) mem[0 .. stateSize!T].ptr))();
+ return emplace!T(ptr, args);
}
///
@@ -453,12 +443,12 @@ unittest
}
/**
- * Constructs a new array with $(D_PARAM size) elements.
+ * Constructs a new array with $(D_PARAM n) elements.
*
* Params:
* T = Array type.
* allocator = Allocator.
- * size = Array size.
+ * n = Array size.
*
* Returns: Newly created array.
*