浏览代码

Removed unnecessary use of StringBuf in int_quest.c to avoid memleaks in certain cases.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14148 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 15 年之前
父节点
当前提交
9025c3c4c9
共有 1 个文件被更改,包括 2 次插入16 次删除
  1. 2 16
      src/char_sql/int_quest.c

+ 2 - 16
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;
 }