summaryrefslogtreecommitdiff
path: root/plugins/Variables/variables.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-30 16:17:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-30 16:17:46 +0000
commit7dad3543a2b848f6547b291f812c9643dc0b85f2 (patch)
tree1054ad62ecba19750bb4531f34e9d033ac1b7244 /plugins/Variables/variables.cpp
parent008fe34954b0bda8fd3487a9658c14581ecd813a (diff)
Variables moved to mir_* memory allocation routines
git-svn-id: http://svn.miranda-ng.org/main/trunk@696 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/variables.cpp')
-rw-r--r--plugins/Variables/variables.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp
index 448398cafc..83e6bd34e0 100644
--- a/plugins/Variables/variables.cpp
+++ b/plugins/Variables/variables.cpp
@@ -2,7 +2,7 @@
Variables Plugin for Miranda-IM (www.miranda-im.org)
Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
+ This program is mir_free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@@ -179,9 +179,9 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
for (pos = 0;pos < _tcslen(string);pos++) {
// string may move in memory, iterate by remembering the position in the string
cur = string+pos;
- // free memory from last iteration, this way we can bail out at any time in the loop
+ // mir_free memory from last iteration, this way we can bail out at any time in the loop
if (parsedToken != NULL)
- free(parsedToken);
+ mir_free(parsedToken);
for (i=0;i<argc;i++)
if (argv[i] != NULL)
@@ -247,7 +247,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
fi->eCount += 1;
continue;
}
- token = ( TCHAR* )malloc((tcur-scur+1)*sizeof(TCHAR));
+ token = ( TCHAR* )mir_alloc((tcur-scur+1)*sizeof(TCHAR));
if (token == NULL) {
fi->eCount += 1;
return NULL;
@@ -267,7 +267,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
}
if (tmpVarPos < 0)
tr = searchRegister(token, (*cur==_T(FIELD_CHAR))?TRF_FIELD:TRF_FUNCTION);
- free(token);
+ mir_free(token);
if (tmpVarPos < 0 && tr == NULL) {
fi->eCount += 1;
// token not found, continue
@@ -388,10 +388,10 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
pos--; // parse the same pos again, it changed
if ( tr == NULL )
- parsedToken = NULL; // To avoid free
+ parsedToken = NULL; // To avoid mir_free
}
if (parsedToken != NULL)
- free(parsedToken);
+ mir_free(parsedToken);
for ( i=0; i < argc; i++ )
if ( argv[i] != NULL )
@@ -440,11 +440,11 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
if (!(fi->flags&FIF_TCHAR)) {
copied = TRUE;
- log_debugA("a2u (%s)", fi->szExtraText);
- tszFormat = fi->szFormat!=NULL?a2u(fi->szFormat):NULL;
- tszSource = fi->szExtraText!=NULL?a2u(fi->szExtraText):NULL;
+ log_debugA("mir_a2t (%s)", fi->szExtraText);
+ tszFormat = fi->szFormat!=NULL?mir_a2t(fi->szFormat):NULL;
+ tszSource = fi->szExtraText!=NULL?mir_a2t(fi->szExtraText):NULL;
for(i = 0; i < fi->cbTemporaryVarsSize; i++) {
- fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i]!=NULL?a2u(fi->szaTemporaryVars[i]):NULL;
+ fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i]!=NULL?mir_a2t(fi->szaTemporaryVars[i]):NULL;
}
}
else {
@@ -468,14 +468,14 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
if (copied) {
if (tszFormat != NULL) {
- free(tszFormat);
+ mir_free(tszFormat);
}
if (tszSource != NULL) {
- free(tszSource);
+ mir_free(tszSource);
}
for(i = 0; i < fi->cbTemporaryVarsSize; i++) {
if (fi->tszaTemporaryVars != NULL) {
- free(fi->tszaTemporaryVars);
+ mir_free(fi->tszaTemporaryVars);
}
}
}
@@ -619,7 +619,7 @@ int LoadVarModule() {
fi.tszFormat = db_gets(SETTING_STARTUPTEXT, NULL);
if (fi.tszFormat != NULL) {
freeMemory((WPARAM)formatString(&fi), 0);
- free(fi.tszFormat);
+ mir_free(fi.tszFormat);
}
}
log_debugA("Variables: Init done");