summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-15 18:22:10 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-15 18:22:10 +0000
commit01e5afaa9a948bcacdfbfc75b3bd11a31f11b5c4 (patch)
tree38a526788bc80733180ae98e8ea70c99ee24a371
parent83dc1f0757461e897f9fdc34bc528e9c06c30dcc (diff)
downloadhercules-01e5afaa9a948bcacdfbfc75b3bd11a31f11b5c4.tar.gz
hercules-01e5afaa9a948bcacdfbfc75b3bd11a31f11b5c4.tar.bz2
hercules-01e5afaa9a948bcacdfbfc75b3bd11a31f11b5c4.tar.xz
hercules-01e5afaa9a948bcacdfbfc75b3bd11a31f11b5c4.zip
Removed unnecessary use of StringBuf in int_quest.c to avoid memleaks in certain cases.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14148 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/char_sql/int_quest.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/char_sql/int_quest.c b/src/char_sql/int_quest.c
index 5d84e0b8e..dd5b915a4 100644
--- a/src/char_sql/int_quest.c
+++ b/src/char_sql/int_quest.c
@@ -67,38 +67,24 @@ bool mapif_quest_delete(int char_id, int quest_id)
//Add a quest to a questlog
bool mapif_quest_add(int char_id, struct quest qd)
{
- StringBuf buf;
-
- StringBuf_Init(&buf);
- StringBuf_Printf(&buf, "INSERT INTO `%s`(`quest_id`, `char_id`, `state`, `time`, `count1`, `count2`, `count3`) VALUES ('%d', '%d', '%d','%d', '%d', '%d', '%d')", quest_db, qd.quest_id, char_id, qd.state, qd.time, qd.count[0], qd.count[1], qd.count[2]);
-
- if ( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
+ if ( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s`(`quest_id`, `char_id`, `state`, `time`, `count1`, `count2`, `count3`) VALUES ('%d', '%d', '%d','%d', '%d', '%d', '%d')", quest_db, qd.quest_id, char_id, qd.state, qd.time, qd.count[0], qd.count[1], qd.count[2]) )
{
Sql_ShowDebug(sql_handle);
return false;
}
- StringBuf_Destroy(&buf);
-
return true;
}
//Update a questlog
bool mapif_quest_update(int char_id, struct quest qd)
{
- StringBuf buf;
-
- StringBuf_Init(&buf);
- StringBuf_Printf(&buf, "UPDATE `%s` SET `state`='%d', `count1`='%d', `count2`='%d', `count3`='%d' WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, qd.state, qd.count[0], qd.count[1], qd.count[2], qd.quest_id, char_id);
-
- if ( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
+ if ( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `state`='%d', `count1`='%d', `count2`='%d', `count3`='%d' WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, qd.state, qd.count[0], qd.count[1], qd.count[2], qd.quest_id, char_id) )
{
Sql_ShowDebug(sql_handle);
return false;
}
- StringBuf_Destroy(&buf);
-
return true;
}