Commit 8832d442 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Use init_foo() instead fo EMPTY_FOO.

Use param."foo" (from param.h) instead of "FOO".
parent 3199915f
/*
* $Id: session.c,v 0.18 1993/10/16 17:51:03 ceder Exp $
* $Id: session.c,v 0.19 1994/02/19 04:17:14 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Session control and miscellaneous.
*/
static char *rcsid = "$Id: session.c,v 0.18 1993/10/16 17:51:03 ceder Exp $";
static char *rcsid = "$Id: session.c,v 0.19 1994/02/19 04:17:14 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -57,6 +57,7 @@ USE(rcsid);
#include "send-async.h"
#include "config.h"
#include "server/smalloc.h"
#include "param.h"
/*
* Create an oldstyle username, user%host.domain@host.domain.
......@@ -315,8 +316,9 @@ logout( void )
extern Success
pepsi (Conf_no conference)
{
Who_info info = EMPTY_WHO_INFO;
Who_info info;
init_who_info(&info);
CHK_LOGIN(FAILURE);
if ( conference != 0 )
{
......@@ -361,9 +363,11 @@ pepsi (Conf_no conference)
extern Success
change_what_i_am_doing (String what_am_i_doing)
{
Who_info info = EMPTY_WHO_INFO;
Who_info info;
init_who_info(&info);
if ( s_strlen( what_am_i_doing ) > WHAT_DO_LEN )
if ( s_strlen( what_am_i_doing ) > param.what_do_len )
{
s_clear ( &what_am_i_doing );
kom_errno = KOM_LONG_STR;
......@@ -421,7 +425,7 @@ who_is_on( Who_info_list *result )
if ( cptr->person != NULL && cptr->invisible == FALSE )
{
result->info[ i ] = EMPTY_WHO_INFO;
init_who_info(&result->info[ i ]);
result->info[ i ].person = cptr->pers_no;
result->info[ i ].what_am_i_doing = cptr->what_am_i_doing;
......@@ -474,7 +478,7 @@ who_is_on_ident( Who_info_ident_list *result )
if ( cptr->person != NULL && cptr->invisible == FALSE )
{
result->info[i] = EMPTY_WHO_INFO_IDENT;
init_who_info_ident(&result->info[i]);
result->info[i].person = cptr->pers_no;
result->info[i].what_am_i_doing = cptr->what_am_i_doing;
result->info[i].username = cptr->username;
......@@ -506,7 +510,7 @@ get_session_info (Session_no session_no,
if ( cptr != NULL )
{
*result = EMPTY_SESSION_INFO;
init_session_info(result);
result->person = cptr->pers_no;
result->what_am_i_doing = cptr->what_am_i_doing;
result->working_conference = cptr->cwc;
......@@ -540,7 +544,7 @@ get_session_info_ident (Session_no session_no,
if ( cptr != NULL )
{
*result = EMPTY_SESSION_INFO_IDENT;
init_session_info_ident(result);
result->person = cptr->pers_no;
result->what_am_i_doing = cptr->what_am_i_doing;
result->working_conference = cptr->cwc;
......@@ -630,7 +634,7 @@ who_is_on_old( Who_info_list_old *result )
if ( cptr->person != NULL && cptr->invisible == FALSE )
{
result->info[ i ] = EMPTY_WHO_INFO_OLD;
init_who_info_old(&result->info[ i ]);
result->info[ i ].person = cptr->pers_no;
result->info[ i ].what_am_i_doing = cptr->what_am_i_doing;
result->info[ i ].working_conference = cptr->cwc;
......@@ -673,8 +677,8 @@ extern Success
set_client_version (const String client_name,
const String client_version)
{
if (s_strlen(client_name) > CONF_NAME_LEN
|| s_strlen(client_version) > CONF_NAME_LEN)
if (s_strlen(client_name) > param.conf_name_len
|| s_strlen(client_version) > param.conf_name_len)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
......
/*
* $Id: simple-cache.c,v 0.42 1994/01/12 01:56:51 ceder Exp $
* $Id: simple-cache.c,v 0.43 1994/02/19 04:19:00 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -33,7 +33,7 @@
* New save algorithm by ceder.
*/
static char *rcsid = "$Id: simple-cache.c,v 0.42 1994/01/12 01:56:51 ceder Exp $";
static char *rcsid = "$Id: simple-cache.c,v 0.43 1994/02/19 04:19:00 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -571,12 +571,21 @@ free_small_conf (Small_conf *sc)
}
static void
init_small_conf(Small_conf *sc)
{
sc->name = EMPTY_STRING;
init_conf_type(&sc->type);
sc->highest_local_no = 0;
sc->nice = param.default_nice;
}
static Small_conf *
alloc_small_conf(void)
{
Small_conf *s;
s = smalloc(sizeof(Small_conf));
*s = EMPTY_SMALL_CONF;
init_small_conf(s);
++no_of_allocated_small_confs;
return s;
......@@ -785,7 +794,7 @@ cached_get_conf_stat (Conf_no conf_no)
if ( node->snap_shot != NULL )
{
node->ptr = copy_conf (node->snap_shot);
node->ptr = copy_conference (node->snap_shot);
conf_set_mru (conf_no);
++conf_mcb->hits;
return node->ptr;
......@@ -1322,7 +1331,7 @@ pre_sync(void)
}
else
{
node->snap_shot = copy_conf(node->ptr);
node->snap_shot = copy_conference(node->ptr);
}
node->s.dirty = 0;
......@@ -1820,7 +1829,7 @@ sync_part(void)
return TRUE;
case sync_idle:
if ( difftime(time(NULL), last_sync_start) < 60 * SYNC_INTERVAL )
if ( difftime(time(NULL), last_sync_start) < 60 * param.sync_interval )
{
#ifdef LOGACCESSES
syncing_or_saving = 0;
......@@ -1834,7 +1843,8 @@ sync_part(void)
break;
case sync_wait:
if ( difftime(time(NULL), last_sync_start) < 60 * SYNC_RETRY_INTERVAL )
if (difftime(time(NULL), last_sync_start)
< 60*param.sync_retry_interval)
{
#ifdef LOGACCESSES
syncing_or_saving = 0;
......@@ -1890,14 +1900,18 @@ init_cache(void)
{
int i;
Cache_node *node;
Conference tmp_conf = EMPTY_CONFERENCE;
Person tmp_pers = EMPTY_PERSON;
Text_stat tmp_text = EMPTY_TEXT_STAT;
Conference tmp_conf;
Person tmp_pers;
Text_stat tmp_text;
pers_mcb = create_cache_node_mcb(100, MAX_CONF);
conf_mcb = create_cache_node_mcb(100, MAX_CONF);
text_mcb = create_cache_node_mcb(100, MAX_TEXT);
init_conference(&tmp_conf);
init_person(&tmp_pers);
init_text_stat(&tmp_text);
#ifdef LOGACCESSES
if (param.logaccess_file)
{
......@@ -2160,7 +2174,7 @@ limit_pers(void)
node = pers_mcb->mru;
/* Skip first CACHE_PERSONS clean persons. */
for ( i = 0; node != NULL && i < CACHE_PERSONS; i++ )
for ( i = 0; node != NULL && i < param.cache_persons; i++ )
{
while (node != NULL && !throwable_p(node))
node = node->next;
......@@ -2193,7 +2207,7 @@ limit_conf(void)
node = conf_mcb->mru;
/* Skip first CACHE_CONFERENCES clean confs. */
for ( i = 0; node != NULL && i < CACHE_CONFERENCES; i++ )
for ( i = 0; node != NULL && i < param.cache_conferences; i++ )
{
while (node != NULL && !throwable_p(node))
node = node->next;
......@@ -2227,7 +2241,7 @@ limit_text_stat(void)
node = text_mcb->mru;
/* Skip first CACHE_TEXT_STATS clean text_stats. */
for ( i = 0; node != NULL && i < CACHE_TEXT_STATS; i++ )
for ( i = 0; node != NULL && i < param.cache_text_stats; i++ )
{
while (node != NULL && !throwable_p(node))
node = node->next;
......@@ -2276,13 +2290,13 @@ EXPORT void
dump_cache_stats(FILE *fp)
{
fprintf(fp, "---simple-cache.c:\n");
fprintf(fp, "\tPersons (cache size: %d):\n", CACHE_PERSONS);
fprintf(fp, "\tPersons (cache size: %d):\n", param.cache_persons);
fprintf(fp, "\t hits: %lu\n\t miss: %lu\n",
pers_mcb->hits, pers_mcb->misses);
fprintf(fp, "\tConferences (cache size: %d):\n", CACHE_CONFERENCES);
fprintf(fp, "\tConferences (cache size: %d):\n", param.cache_conferences);
fprintf(fp, "\t hits: %lu\n\t miss: %lu\n",
conf_mcb->hits, conf_mcb->misses);
fprintf(fp, "\tText_stats (cache size: %d):\n", CACHE_TEXT_STATS);
fprintf(fp, "\tText_stats (cache size: %d):\n", param.cache_text_stats);
fprintf(fp, "\t hits: %lu\n\t miss: %lu\n",
text_mcb->hits, text_mcb->misses);
}
......
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