From 0e6b7dfe24583e2023f668d7fbfcba3d495dd9be Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 14 Jul 2014 20:58:37 +0000 Subject: code optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@9800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdfile/file.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 413a202751..004eb72ccd 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -34,15 +34,10 @@ static HGENMENU hSRFileMenuItem; TCHAR* GetContactID(MCONTACT hContact) { - TCHAR *theValue = 0; char *szProto = GetContactProto(hContact); if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1) { - DBVARIANT dbv; - if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) { - theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal); - db_free(&dbv); + if (TCHAR *theValue = db_get_tsa(hContact, szProto, "ChatRoomID")) return theValue; - } } else { CONTACTINFO ci = { sizeof(ci) }; @@ -52,9 +47,9 @@ TCHAR* GetContactID(MCONTACT hContact) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { switch (ci.type) { case CNFT_ASCIIZ: - return (TCHAR *)ci.pszVal; + return (TCHAR*)ci.pszVal; case CNFT_DWORD: - return _itot(ci.dVal, (TCHAR *)mir_alloc(sizeof(TCHAR) * 32), 10); + return _itot(ci.dVal, (TCHAR*)mir_alloc(sizeof(TCHAR)*32), 10); } } } -- cgit v1.2.3