From fb53533e86fdd2658f6334452b72a2379d81a941 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 20 Apr 2014 18:44:41 +0200 Subject: [PATCH] package daemon: CommitTransactionHandler: Use NotOwningEntryRef --- .../package/CommitTransactionHandler.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/servers/package/CommitTransactionHandler.cpp b/src/servers/package/CommitTransactionHandler.cpp index a1bac43b3b..4302ccf6a3 100644 --- a/src/servers/package/CommitTransactionHandler.cpp +++ b/src/servers/package/CommitTransactionHandler.cpp @@ -230,19 +230,14 @@ CommitTransactionHandler::_ReadPackagesToActivate( } // read the package - entry_ref entryRef; - entryRef.device = fTransactionDirectoryRef.device; - entryRef.directory = fTransactionDirectoryRef.node; - if (entryRef.set_name(packageName) != B_OK) - throw Exception(B_NO_MEMORY); - package = new(std::nothrow) Package; if (package == NULL || !fPackagesToActivate.AddItem(package)) { delete package; throw Exception(B_NO_MEMORY); } - error = package->Init(entryRef); + error = package->Init( + NotOwningEntryRef(fTransactionDirectoryRef, packageName)); if (error != B_OK) throw Exception(error, "failed to read package", packageName); @@ -403,12 +398,8 @@ CommitTransactionHandler::_AddPackagesToActivate() } // get a BEntry for the package - entry_ref entryRef; - entryRef.device = fTransactionDirectoryRef.device; - entryRef.directory = fTransactionDirectoryRef.node; - if (entryRef.set_name(package->FileName()) != B_OK) - throw Exception(B_NO_MEMORY); - + NotOwningEntryRef entryRef(fTransactionDirectoryRef, + package->FileName()); BEntry entry; error = entry.SetTo(&entryRef); if (error != B_OK) {