From 103de9c164934b2393dfcba7011625f90c8a2097 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jul 2019 14:30:13 +0300 Subject: NLHR_PTR - smart pointers make better code --- protocols/GmailNotifier/src/check.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'protocols/GmailNotifier') diff --git a/protocols/GmailNotifier/src/check.cpp b/protocols/GmailNotifier/src/check.cpp index 06a1926ef1..d9386b191b 100644 --- a/protocols/GmailNotifier/src/check.cpp +++ b/protocols/GmailNotifier/src/check.cpp @@ -80,18 +80,14 @@ void CheckMailInbox(Account *curAcc) nlr.dataLength = szBody.GetLength(); nlr.pData = szBody.GetBuffer(); - NETLIBHTTPREQUEST *nlu = Netlib_HttpTransaction(hNetlibUser, &nlr); + NLHR_PTR nlu(Netlib_HttpTransaction(hNetlibUser, &nlr)); if (nlu == nullptr || nlu->resultCode != 200) { mir_strcpy(curAcc->results.content, Translate("Can't send account data!")); - Netlib_FreeHttpRequest(nlu); curAcc->results_num = -1; mir_strcat(curAcc->results.content, "]"); curAcc->IsChecking = false; - return; } - - Netlib_FreeHttpRequest(nlu); } // go! @@ -115,11 +111,10 @@ void CheckMailInbox(Account *curAcc) nlr.headers = headers; nlr.headersCount = _countof(headers); - NETLIBHTTPREQUEST *nlu = Netlib_HttpTransaction(hNetlibUser, &nlr); + NLHR_PTR nlu(Netlib_HttpTransaction(hNetlibUser, &nlr)); if (nlu == nullptr) { mir_snprintf(curAcc->results.content, "%s [%s]", szNick.get(), (nlr.resultCode == 401) ? Translate("Wrong name or password!") : Translate("Can't get RSS feed!")); - Netlib_FreeHttpRequest(nlu); curAcc->results_num = -1; curAcc->IsChecking = false; -- cgit v1.2.3