summaryrefslogtreecommitdiff
path: root/src/map/pc_groups.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-09 14:31:15 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-03-09 14:31:15 +0000
commit33369a948f2d6ba2059f81816ea7b16e486090ba (patch)
treeb08a112ecbacf193f3a98c2bcc05a01fddef5feb /src/map/pc_groups.c
parent440542802577e5f3f67081803873bc87642a3f48 (diff)
downloadhercules-33369a948f2d6ba2059f81816ea7b16e486090ba.tar.gz
hercules-33369a948f2d6ba2059f81816ea7b16e486090ba.tar.bz2
hercules-33369a948f2d6ba2059f81816ea7b16e486090ba.tar.xz
hercules-33369a948f2d6ba2059f81816ea7b16e486090ba.zip
Code cleanup: replaced `DBIterator` function calls with macros where possible.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15668 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc_groups.c')
-rw-r--r--src/map/pc_groups.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 379968c79..74215eab9 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -161,10 +161,8 @@ static void read_config(void)
group_count = config_setting_length(groups); // Save number of groups
// Check if all commands and permissions exist
- iter = pc_group_db->iterator(pc_group_db);
- for (group_settings = (GroupSettings*)iter->first(iter, NULL);
- iter->exists(iter);
- group_settings = (GroupSettings*)iter->next(iter, NULL)) {
+ iter = db_iterator(pc_group_db);
+ for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions;
int count = 0, i;
@@ -203,15 +201,13 @@ static void read_config(void)
}
}
}
- iter->destroy(iter);
+ dbi_destroy(iter);
// Apply inheritance
i = 0; // counter for processed groups
while (i < group_count) {
- iter = pc_group_db->iterator(pc_group_db);
- for (group_settings = (GroupSettings*)iter->first(iter, NULL);
- iter->exists(iter);
- group_settings = (GroupSettings*)iter->next(iter, NULL)) {
+ iter = db_iterator(pc_group_db);
+ for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *inherit = NULL,
*commands = group_settings->commands,
*permissions = group_settings->permissions;
@@ -265,7 +261,7 @@ static void read_config(void)
group_settings->inheritance_done = true; // we're done with this group
}
}
- iter->destroy(iter);
+ dbi_destroy(iter);
if (++loop > group_count) {
ShowWarning("pc_groups:read_config: Could not process inheritance rules, check your config '%s' for cycles...\n",
@@ -276,9 +272,7 @@ static void read_config(void)
// Pack permissions into GroupSettings.e_permissions for faster checking
iter = db_iterator(pc_group_db);
- for (group_settings = (GroupSettings*)dbi_first(iter);
- dbi_exists(iter);
- group_settings = (GroupSettings*)dbi_next(iter)) {
+ for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) {
config_setting_t *permissions = group_settings->permissions;
int i, count = config_setting_length(permissions);
@@ -294,7 +288,7 @@ static void read_config(void)
group_settings->e_permissions |= permission_name[j].permission;
}
}
- iter->destroy(iter);
+ dbi_destroy(iter);
}
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' groups in '"CL_WHITE"%s"CL_RESET"'.\n", group_count, config_filename);