summaryrefslogtreecommitdiff
path: root/src/map/mapreg_sql.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-01-20 04:36:08 +0100
committerHaru <haru@dotalux.com>2015-01-20 04:41:33 +0100
commit4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4 (patch)
treedab9d12a6a4b95a37598e27e6e86d6047360d61b /src/map/mapreg_sql.c
parent03709c136ad300be631adfd38dc36c2433bda718 (diff)
downloadhercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.gz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.bz2
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.xz
hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.zip
Minor fixes and tweaks suggested by cppcheck
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mapreg_sql.c')
-rw-r--r--src/map/mapreg_sql.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index f026fde00..0092a6c61 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -220,13 +220,11 @@ void script_load_mapreg(void) {
* Saves permanent variables to database.
*/
void script_save_mapreg(void) {
- DBIterator* iter;
- struct mapreg_save *m = NULL;
-
- if( mapreg->dirty ) {
- iter = db_iterator(mapreg->regs.vars);
- for( m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter) ) {
- if( m->save ) {
+ if (mapreg->dirty) {
+ DBIterator *iter = db_iterator(mapreg->regs.vars);
+ struct mapreg_save *m;
+ for (m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter)) {
+ if (m->save) {
int num = script_getvarid(m->uid);
int i = script_getvaridx(m->uid);
const char* name = script->get_str(num);