Exemplo n.º 1
0
static void
group_cache_remove_by_id(struct uldb_mysql_state *state, int group_id)
{
  struct userlist_group *grp;

  if (group_id <= 0 || group_id >= state->groups.size) return;
  if (!(grp = state->groups.group_map[group_id])) return;

  state->groups.group_map[grp->group_id] = 0;
  state->groups.count--;
  UNLINK_FROM_LIST(&grp->b,state->groups.first,state->groups.last,left,right);
  userlist_free(&grp->b);
  memset(grp, 0, sizeof(*grp));
}
Exemplo n.º 2
0
static void
group_cache_remove(struct uldb_mysql_state *state, struct userlist_group *grp)
{
  if (!grp) return;

  if (grp->group_id > 0 && grp->group_id < state->groups.size
      && state->groups.group_map[grp->group_id] == grp) {
    state->groups.group_map[grp->group_id] = 0;
    state->groups.count--;
  }
  UNLINK_FROM_LIST(&grp->b,state->groups.first,state->groups.last,left,right);

  userlist_free(&grp->b);
  memset(grp, 0, sizeof(*grp));
}
Exemplo n.º 3
0
static void
do_remove_login_from_pool(
        struct users_cache *uc,
        struct userlist_user *u)
{
  struct xml_tree *u_xml = (struct xml_tree*) u;

  if (!u) return;
  ASSERT(u->id > 0 && u->id < uc->size);

  uc->user_map[u->id] = 0;
  UNLINK_FROM_LIST(u_xml, uc->first, uc->last, left, right);
  // don't even try to free nested cntsregs and cookies
  if (u->contests) {
    u->contests->first_down = u->contests->last_down = 0;
  }
  if (u->cookies) {
    u->cookies->first_down = u->cookies->last_down = 0;
  }
  userlist_free(u_xml);
  uc->count--;
}