Commit 783f866a authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(do_get_members): Minor code cleanup and indentation fixes.

parent 48c1dc13
/*
* $Id: membership.c,v 0.74 2002/11/06 19:46:17 ceder Exp $
* $Id: membership.c,v 0.75 2002/11/10 14:06:05 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -1570,33 +1570,34 @@ get_membership (Pers_no pers_no,
* first starts at 0.
*/
static Success
do_get_members (Conf_no conf_no,
unsigned short first,
unsigned short no_of_members,
Member_list *members)
static Success
do_get_members(Conf_no conf_no,
unsigned short first,
unsigned short no_of_members,
Member_list *members)
{
Conference * conf_c;
enum access acc;
unsigned long src, dst;
Bool is_supervisor_of_conf;
Conference *conf_c;
enum access acc;
unsigned long src;
unsigned long dst;
Bool is_supervisor_of_conf;
CHK_CONNECTION(FAILURE);
GET_C_STAT(conf_c, conf_no, FAILURE);
acc = access_perm(conf_no, active_connection, read_protected);
if ( acc == error )
if (acc == error)
return FAILURE;
if ( acc == none )
if (acc == none)
{
err_stat = conf_no;
kom_errno = KOM_UNDEF_CONF;
return FAILURE;
}
if ( first >= (conf_c->members).no_of_members )
if (first >= (conf_c->members).no_of_members)
{
err_stat = first;
kom_errno = KOM_INDEX_OUT_OF_RANGE;
......@@ -1606,15 +1607,13 @@ do_get_members (Conf_no conf_no,
*members = conf_c->members;
members->members += first;
members->no_of_members = min (no_of_members,
members->no_of_members - first);
members->members = tmp_alloc(members->no_of_members *
sizeof(Member));
src = first;
dst = 0;
members->no_of_members = min(no_of_members,
members->no_of_members - first);
members->members = tmp_alloc(members->no_of_members * sizeof(Member));
is_supervisor_of_conf = is_supervisor(conf_no, ACTPERS, ACT_P);
while (dst < members->no_of_members)
for (src = first, dst = 0; dst < members->no_of_members; src++, dst++)
{
const Member *current = &conf_c->members.members[src];
......@@ -1626,15 +1625,10 @@ do_get_members (Conf_no conf_no,
}
else
{
members->members[dst].member = 0;
members->members[dst].added_by = 0;
members->members[dst].added_at = 0;
init_member(&members->members[dst]);
set_membership_type_bits(&members->members[dst].type,
0,0,1,0,0,0,0,0);
}
src += 1;
dst += 1;
}
return OK;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment