[llvm-objdump] Use initializer list for scoped xar api constructors

llvm-svn: 315243
This commit is contained in:
Francis Ricci 2017-10-09 20:27:14 +00:00
parent c084589877
commit 57d8452a63
1 changed files with 3 additions and 4 deletions

View File

@ -206,9 +206,8 @@ typedef DiceTable::iterator dice_table_iterator;
namespace {
struct ScopedXarFile {
xar_t xar;
ScopedXarFile(const char *filename, int32_t flags) {
xar = xar_open(filename, flags);
}
ScopedXarFile(const char *filename, int32_t flags)
: xar(xar_open(filename, flags)) {}
~ScopedXarFile() {
if (xar)
xar_close(xar);
@ -220,7 +219,7 @@ struct ScopedXarFile {
struct ScopedXarIter {
xar_iter_t iter;
ScopedXarIter() { iter = xar_iter_new(); }
ScopedXarIter() : iter(xar_iter_new()) {}
~ScopedXarIter() {
if (iter)
xar_iter_free(iter);