Skip to content

Commit

Permalink
training: Replace memfree by free
Browse files Browse the repository at this point in the history
free also accepts a nullptr argument, so the code can be simplified.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed May 1, 2017
1 parent ca89a11 commit 1d6dd03
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions training/commontraining.cpp
Expand Up @@ -22,7 +22,6 @@
#include "emalloc.h"
#include "featdefs.h"
#include "fontinfo.h"
#include "freelist.h"
#include "globals.h"
#include "intfeaturespace.h"
#include "mastertrainer.h"
Expand Down Expand Up @@ -579,18 +578,12 @@ void CleanUpUnusedData(
iterate(ProtoList)
{
Prototype = (PROTOTYPE *) first_node (ProtoList);
if (Prototype->Variance.Elliptical != nullptr) {
memfree(Prototype->Variance.Elliptical);
Prototype->Variance.Elliptical = nullptr;
}
if (Prototype->Magnitude.Elliptical != nullptr) {
memfree(Prototype->Magnitude.Elliptical);
Prototype->Magnitude.Elliptical = nullptr;
}
if (Prototype->Weight.Elliptical != nullptr) {
memfree(Prototype->Weight.Elliptical);
Prototype->Weight.Elliptical = nullptr;
}
free(Prototype->Variance.Elliptical);
Prototype->Variance.Elliptical = nullptr;
free(Prototype->Magnitude.Elliptical);
Prototype->Magnitude.Elliptical = nullptr;
free(Prototype->Weight.Elliptical);
Prototype->Weight.Elliptical = nullptr;
}
}

Expand Down

0 comments on commit 1d6dd03

Please sign in to comment.