summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-14 20:58:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-14 20:58:37 +0000
commit0e6b7dfe24583e2023f668d7fbfcba3d495dd9be (patch)
treed99fd7dba86b7377dc29bca390f572a14283b73b /src
parentf5d4931269b235ad3346cd7a7be7d865e176341a (diff)
code optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@9800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdfile/file.cpp11
1 files changed, 3 insertions, 8 deletions
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);
}
}
}