Commit 4be6c139 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(init_connection): New function.

(alloc_connection): Use it, instead of the (now deleted) const
EMPTY_CONNECTION.
parent efbb67d4
/*
* $Id: internal-connections.c,v 0.17 1993/11/22 19:09:32 ceder Exp $
* $Id: internal-connections.c,v 0.18 1994/02/19 04:41:03 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Abstract routines on the data type Connection.
*/
static char *rcsid = "$Id: internal-connections.c,v 0.17 1993/11/22 19:09:32 ceder Exp $";
static char *rcsid = "$Id: internal-connections.c,v 0.18 1994/02/19 04:41:03 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -50,6 +50,7 @@ USE(rcsid);
#include "server/smalloc.h"
#include "lyskomd.h"
#include "log.h"
#include "kom-memory.h"
INTERNAL Connection *all_connections = NULL;
INTERNAL Session_no no_of_connection_attempts = 0;
......@@ -58,63 +59,63 @@ INTERNAL Session_no no_of_connection_attempts = 0;
INTERNAL Connection *last_conn = NULL;
INTERNAL const Connection EMPTY_CONNECTION =
{0, /* magic */
NULL, /* prev */
NULL, /* next */
/* Things used by services.c */
(Pers_no)0, /* pers_no */
(Person *)NULL, /* person */
NO_TIME, /* session_start */
(Conf_no)0, /* cwc */
EMPTY_STRING_i, /* what_am_i_doing */
(unsigned char)0, /* ena_level */
EMPTY_STRING_i, /* username */
EMPTY_STRING_i, /* hostname */
EMPTY_STRING_i, /* ident_user */
EMPTY_STRING_i, /* client_name */
EMPTY_STRING_i, /* client_version */
FALSE, /* invisible */
FALSE, /* username_valid */
/* Used by server/connections.c */
(struct mux*)NULL, /* mux */
'\0', /* protocol */
0, /* parse_pos */
0, /* fnc_parse_pos */
0, /* array_parse_pos */
0, /* struct_parse_pos */
0, /* string_parse_pos */
0, /* ref_no */
call_fnc_login_old, /* function */
/* Gather data... */
0, /* num0 */
0, /* num1 */
0, /* num2 */
0, /* num3 */
EMPTY_STRING_i, /* c_string0 */
EMPTY_STRING_i, /* c_string1 */
EMPTY_STRING_i, /* string0 */
(Misc_info*)NULL, /* c_misc_info_p */
(Local_text_no*)NULL, /* c_local_text_no_p */
DEFAULT_PRIV_BITS_i, /* priv_bits */
NULL_CONF_TYPE_i, /* conf_type */
EMPTY_tm_i, /* time */
/* Protocol independent... */
EMPTY_STRING_i, /* unparsed */
0, /* first_to_parse */
FALSE, /* more_to_parse */
NO_TIME, /* last_request */
0}; /* session_no */
static int no_of_allocated_connections = 0;
INTERNAL Connection *
static void
init_connection(Connection *conn)
{
conn->magic = 0;
conn->prev = NULL;
conn->next = NULL;
conn->pers_no = 0;
conn->person = NULL;
conn->session_start = NO_TIME;
conn->cwc = 0;
conn->what_am_i_doing = EMPTY_STRING;
conn->ena_level = 0;
conn->username = EMPTY_STRING;
conn->hostname = EMPTY_STRING;
conn->ident_user = EMPTY_STRING;
conn->client_name = EMPTY_STRING;
conn->client_version = EMPTY_STRING;
conn->invisible = FALSE;
conn->username_valid = FALSE;
conn->mux = NULL;
conn->protocol = '\0';
conn->parse_pos = 0;
conn->fnc_parse_pos = 0;
conn->array_parse_pos = 0;
conn->struct_parse_pos = 0;
conn->string_parse_pos = 0;
conn->ref_no = 0;
conn->function = call_fnc_login_old;
conn->num0 = 0;
conn->num1 = 0;
conn->num2 = 0;
conn->num3 = 0;
conn->c_string0 = EMPTY_STRING;
conn->c_string1 = EMPTY_STRING;
conn->string0 = EMPTY_STRING;
conn->c_misc_info_p = NULL;
conn->c_local_text_no_p = NULL;
conn->unparsed = EMPTY_STRING;
conn->first_to_parse = 0;
conn->more_to_parse = FALSE;
conn->last_request = NO_TIME;
conn->session_no = 0;
init_priv_bits(&conn->priv_bits);
init_conf_type(&conn->conf_type);
init_struct_tm(&conn->time);
}
static Connection *
alloc_connection(void)
{
Connection *res;
res = smalloc ( sizeof(Connection) );
*res = EMPTY_CONNECTION;
init_connection(res);
++no_of_allocated_connections;
return res;
}
......
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