use copies of Emitter instead of passing pointers around

This commit is contained in:
Cameron Ross 2018-06-16 02:10:19 -03:00
parent 5172f8b932
commit ccaa7749bb
No known key found for this signature in database
GPG key ID: 777897D98DC91C54
3 changed files with 3 additions and 5 deletions

View file

@ -243,7 +243,7 @@ struct Dumper
{
try
{
auto emitter = new Emitter(stream_, canonical_, indent_, textWidth_, lineBreak_);
auto emitter = Emitter(stream_, canonical_, indent_, textWidth_, lineBreak_);
auto serializer = Serializer(emitter, resolver_, encoding_, explicitStart_,
explicitEnd_, YAMLVersion_, tags_);
foreach(ref document; documents)

View file

@ -95,8 +95,6 @@ public:
@disable bool opEquals(ref Queue);
@disable int opCmp(ref Queue);
@disable this(this);
~this() @safe nothrow @nogc
{
freeStock();

View file

@ -32,7 +32,7 @@ struct Serializer
{
private:
///Emitter to emit events produced.
Emitter* emitter_;
Emitter emitter_;
///Resolver used to determine which tags are automaticaly resolvable.
Resolver resolver_;
@ -66,7 +66,7 @@ struct Serializer
* YAMLVersion = YAML version string.
* tagDirectives = Tag directives to emit.
*/
this(Emitter* emitter, Resolver resolver, Encoding encoding,
this(Emitter emitter, Resolver resolver, Encoding encoding,
const Flag!"explicitStart" explicitStart,
const Flag!"explicitEnd" explicitEnd, string YAMLVersion,
TagDirective[] tagDirectives) @safe