From 13eb83bea655c3302c74a82d826d75bceb9232a2 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 8 Dec 2014 22:13:57 +0000 Subject: code cleanup around mir_snprintf git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SeenPlugin/src/utils.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/SeenPlugin') diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 3c9bc669fb..a5fcd575ce 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -570,11 +570,12 @@ int UpdateValues(WPARAM hContact,LPARAM lparam) db_set_b(hContact, S_MOD, "Offline", 1); { DWORD t; - char *str = (char *)malloc(MAXMODULELABELLENGTH+9); - mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",proto); - t = db_get_dw(NULL,S_MOD,str,0); - if (!t) t = time(NULL); - free(str); + char str[MAXMODULELABELLENGTH + 9]; + + mir_snprintf(str, SIZEOF(str), "OffTime-%s", proto); + t = db_get_dw(NULL, S_MOD, str, 0); + if (!t) + t = time(NULL); DBWriteTimeTS(t, hContact); } @@ -653,10 +654,9 @@ static void cleanThread(void *param) } } - char *str = (char *)malloc(MAXMODULELABELLENGTH+9); - mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName); - db_unset(NULL,S_MOD,str); - free(str); + char str[MAXMODULELABELLENGTH + 9]; + mir_snprintf(str, SIZEOF(str), "OffTime-%s", infoParam->sProtoName); + db_unset(NULL, S_MOD, str); } free(infoParam); } @@ -690,12 +690,12 @@ int ModeChange(WPARAM wparam,LPARAM lparam) else if ((isetting==ID_STATUS_OFFLINE)&&((WORD)ack->hProcess>ID_STATUS_OFFLINE)) { //we have just loged-off if (IsWatchedProtocol(ack->szModule)) { - char *str = (char *)malloc(MAXMODULELABELLENGTH+9); + char str[MAXMODULELABELLENGTH + 9]; time_t t; + time(&t); - mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",ack->szModule); - db_set_dw(NULL,S_MOD,str,t); - free(str); + mir_snprintf(str, SIZEOF(str), "OffTime-%s", ack->szModule); + db_set_dw(NULL, S_MOD, str, t); } } -- cgit v1.2.3