Commit 8c186e33 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Changes for vcc:

  Write "{ 0, NULL }" instead of "((Foo){ 0, NULL})".
Cleanup.
parent c50e11bc
/* /*
* $Id: kom-types.h,v 0.8 1993/10/10 11:59:59 ceder Exp $ * $Id: kom-types.h,v 0.9 1993/10/16 16:35:47 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -65,11 +65,11 @@ ...@@ -65,11 +65,11 @@
#include "misc-types.h" #include "misc-types.h"
typedef unsigned short Pers_no; typedef unsigned short Pers_no;
typedef unsigned short Conf_no; typedef unsigned short Conf_no;
typedef unsigned long Text_no; typedef unsigned long Text_no;
typedef unsigned long Local_text_no; typedef unsigned long Local_text_no;
typedef unsigned long Session_no; typedef unsigned long Session_no;
#ifdef PROT_a #ifdef PROT_a
...@@ -114,19 +114,16 @@ typedef unsigned long Global_text; ...@@ -114,19 +114,16 @@ typedef unsigned long Global_text;
#define MAX_LOCAL_TEXT_NO ((Local_text_no) ULONG_MAX) #define MAX_LOCAL_TEXT_NO ((Local_text_no) ULONG_MAX)
#ifdef SERVER
#ifdef SERVER # define PASSWD_LEN 64
#define PASSWD_LEN 64 typedef char Password[PASSWD_LEN];
typedef char Password[PASSWD_LEN]; typedef off_t Text_index;
typedef off_t Text_index; typedef time_t Time;
typedef time_t Time; # define NULL_TIME_i 0
# define NULL_TIME_i ((Time) 0)
#else /* CLIENT */ #else /* CLIENT */
typedef struct tm Time; typedef struct tm Time;
# define NULL_TIME_i ((Time) { 0 }) # define NULL_TIME_i {0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
#endif /* CLIENT */
#endif
...@@ -155,17 +152,17 @@ typedef struct { ...@@ -155,17 +152,17 @@ typedef struct {
} Priv_bits; } Priv_bits;
#ifdef SERVER #ifdef SERVER
# define DEFAULT_PRIV_BITS_i ((Priv_bits) \ # define DEFAULT_PRIV_BITS_i \
{ 0, 0, 0, ANYONE_CAN_CREATE_NEW_PERSONS, \ { 0, 0, 0, ANYONE_CAN_CREATE_NEW_PERSONS, \
ANYONE_CAN_CREATE_NEW_CONFS, \ ANYONE_CAN_CREATE_NEW_CONFS, \
DEFAULT_CHANGE_NAME, 0, 0, 0, 0, 0, \ DEFAULT_CHANGE_NAME, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0 \ 0, 0, 0, 0, 0 \
}) }
#else #else
# define DEFAULT_PRIV_BITS_i ((Priv_bits) \ # define DEFAULT_PRIV_BITS_i \
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0 \ 0, 0, 0, 0, 0 \
}) }
#endif #endif
extern const Priv_bits DEFAULT_PRIV_BITS; extern const Priv_bits DEFAULT_PRIV_BITS;
...@@ -175,8 +172,8 @@ extern const Priv_bits DEFAULT_PRIV_BITS; ...@@ -175,8 +172,8 @@ extern const Priv_bits DEFAULT_PRIV_BITS;
* Flags in the Person struct. * Flags in the Person struct.
*/ */
typedef struct { typedef struct {
unsigned int unread_is_secret : 1;/* FALSE if everyone is allowed to ask how */ unsigned int unread_is_secret : 1;/* FALSE if everyone is allowed to ask
/* many unread texts you have. */ how many unread texts you have. */
unsigned int flg2 : 1; unsigned int flg2 : 1;
unsigned int flg3 : 1; unsigned int flg3 : 1;
unsigned int flg4 : 1; unsigned int flg4 : 1;
...@@ -186,10 +183,9 @@ typedef struct { ...@@ -186,10 +183,9 @@ typedef struct {
unsigned int flg8 : 1; unsigned int flg8 : 1;
} Personal_flags; } Personal_flags;
#define DEFAULT_PERSONAL_FLAGS_i ((Personal_flags) \ #define DEFAULT_PERSONAL_FLAGS_i { 0, 0, 0, 0, 0, 0, 0, 0 }
{ 0, 0, 0, 0, 0, 0, 0, 0 })
extern const Personal_flags DEFAULT_PERSONAL_FLAGS;
extern const Personal_flags DEFAULT_PERSONAL_FLAGS;
/* See file doc/misc_items */ /* See file doc/misc_items */
...@@ -275,34 +271,31 @@ typedef struct { ...@@ -275,34 +271,31 @@ typedef struct {
} Text_stat; } Text_stat;
#ifdef SERVER #ifdef SERVER
#define EMPTY_TEXT_STAT_i ((Text_stat) \ # define EMPTY_TEXT_STAT_i { NULL_TIME_i, 0, 0, 0, 0, 0, 0, NULL }
{ NULL_TIME_i, 0, 0, 0, 0, 0, 0, NULL })
#else #else
#define EMPTY_TEXT_STAT_i ((Text_stat) \ # define EMPTY_TEXT_STAT_i { NULL_TIME_i, 0, 0, 0, 0, 0, NULL }
{ NULL_TIME_i, 0, 0, 0, 0, 0, NULL })
#endif #endif
extern const Text_stat EMPTY_TEXT_STAT; extern const Text_stat EMPTY_TEXT_STAT;
typedef struct { typedef struct {
unsigned int rd_prot : 1; /* !(Can anyone become a member?) */ unsigned int rd_prot : 1; /* !(Can anyone become a member?) */
unsigned int original : 1; /* Comments forbidden? */ unsigned int original : 1; /* Comments forbidden? */
unsigned int secret : 1; /* Secret conference? */ unsigned int secret : 1; /* Secret conference? */
/* Note: if a letterbox is secret it /* Note: if a letterbox is secret it
* will be very hard for that person * will be very hard for that person
* to log in, since he can't map his * to log in, since he can't map his
* name to a pers_no. He must either * name to a pers_no. He must either
* know his pers_no, or have another * know his pers_no, or have another
* identity which is his supervisor. * identity which is his supervisor.
*/ */
unsigned int letter_box : 1; /* Is this a letter box? */ unsigned int letter_box : 1; /* Is this a letter box? */
} Conf_type; } Conf_type;
#define NULL_CONF_TYPE_i ((Conf_type) { 0, 0, 0, 0 }) #define NULL_CONF_TYPE_i { 0, 0, 0, 0 }
extern const Conf_type NULL_CONF_TYPE;
extern const Conf_type NULL_CONF_TYPE;
typedef struct { typedef struct {
...@@ -310,11 +303,10 @@ typedef struct { ...@@ -310,11 +303,10 @@ typedef struct {
} Member; } Member;
/* Struct for marks */ /* Struct for marks */
typedef struct { typedef struct {
Text_no text_no; Text_no text_no;
unsigned char mark_type; /* It's up to the clients to decide the unsigned char mark_type; /* It's up to the clients to decide the
meaning of this field. */ meaning of this field. */
} Mark; } Mark;
...@@ -323,20 +315,19 @@ typedef struct { ...@@ -323,20 +315,19 @@ typedef struct {
/* Information about a person's membership in a conference */ /* Information about a person's membership in a conference */
typedef struct { typedef struct {
Conf_no conf_no; Conf_no conf_no;
unsigned char priority; /* Interrupt priority */ unsigned char priority; /* Interrupt priority */
Time last_time_read; /* Updated every time a text in this Time last_time_read; /* Updated every time a text in this
conf. is marked as read. */ conf. is marked as read. */
Local_text_no last_text_read; /* All texts before and inclusive this Local_text_no last_text_read; /* All texts before and inclusive this
are read */ are read */
unsigned short no_of_read; unsigned short no_of_read;
Local_text_no * read_texts; /* Texts after last_text_read. Sorted Local_text_no * read_texts; /* Texts after last_text_read. Sorted
in ascending order */ in ascending order */
} Membership; } Membership;
#define EMPTY_MEMBERSHIP_i ((Membership) \ #define EMPTY_MEMBERSHIP_i { 0, 0, NULL_TIME_i, 0, 0, NULL }
{ 0, 0, NULL_TIME_i, 0, 0, NULL })
extern const Membership EMPTY_MEMBERSHIP;
extern const Membership EMPTY_MEMBERSHIP;
/* Some structs to handle variable-sized arrays. */ /* Some structs to handle variable-sized arrays. */
...@@ -346,7 +337,8 @@ typedef struct { ...@@ -346,7 +337,8 @@ typedef struct {
Mark * marks; /* Pointer to an array of marks. */ Mark * marks; /* Pointer to an array of marks. */
} Mark_list; } Mark_list;
#define EMPTY_MARK_LIST_i ((Mark_list) { 0, NULL }) #define EMPTY_MARK_LIST_i { 0, NULL }
extern const Mark_list EMPTY_MARK_LIST; extern const Mark_list EMPTY_MARK_LIST;
...@@ -355,7 +347,7 @@ typedef struct { ...@@ -355,7 +347,7 @@ typedef struct {
Conf_no *conf_nos; Conf_no *conf_nos;
} Conf_no_list; } Conf_no_list;
#define EMPTY_CONF_NO_LIST_i ((Conf_no_list) { 0, NULL }) #define EMPTY_CONF_NO_LIST_i { 0, NULL }
extern const Conf_no_list EMPTY_CONF_NO_LIST; extern const Conf_no_list EMPTY_CONF_NO_LIST;
...@@ -364,18 +356,17 @@ typedef struct { ...@@ -364,18 +356,17 @@ typedef struct {
Member * members; Member * members;
} Member_list; } Member_list;
#define EMPTY_MEMBER_LIST_i ((Member_list) { 0, NULL }) #define EMPTY_MEMBER_LIST_i { 0, NULL }
extern const Member_list EMPTY_MEMBER_LIST; extern const Member_list EMPTY_MEMBER_LIST;
typedef struct { typedef struct {
Local_text_no first_local_no; Local_text_no first_local_no;
unsigned long no_of_texts; unsigned long no_of_texts;
Text_no * texts; Text_no * texts;
} Text_list; } Text_list;
#define EMPTY_TEXT_LIST_i ((Text_list) { 1, 0, NULL }) #define EMPTY_TEXT_LIST_i { 1, 0, NULL }
extern const Text_list EMPTY_TEXT_LIST; extern const Text_list EMPTY_TEXT_LIST;
...@@ -400,10 +391,10 @@ typedef struct { ...@@ -400,10 +391,10 @@ typedef struct {
} Conf_list; } Conf_list;
#define EMPTY_CONF_LIST_OLD_i ((Conf_list_old) { 0, NULL, NULL }) #define EMPTY_CONF_LIST_OLD_i { 0, NULL, NULL }
extern const Conf_list_old EMPTY_CONF_LIST_OLD; extern const Conf_list_old EMPTY_CONF_LIST_OLD;
#define EMPTY_CONF_LIST_i ((Conf_list) { 0, NULL }) #define EMPTY_CONF_LIST_i { 0, NULL }
extern const Conf_list EMPTY_CONF_LIST; extern const Conf_list EMPTY_CONF_LIST;
...@@ -413,7 +404,7 @@ typedef struct { ...@@ -413,7 +404,7 @@ typedef struct {
Pers_no * persons; Pers_no * persons;
} Pers_list; } Pers_list;
#define EMPTY_PERS_LIST_i ((Pers_list) { 0, NULL }) #define EMPTY_PERS_LIST_i { 0, NULL }
extern const Pers_list EMPTY_PERS_LIST; extern const Pers_list EMPTY_PERS_LIST;
...@@ -423,11 +414,10 @@ typedef struct { ...@@ -423,11 +414,10 @@ typedef struct {
Membership * confs; Membership * confs;
} Membership_list; } Membership_list;
#define EMPTY_MEMBERSHIP_LIST_i ((Membership_list) { 0, NULL }) #define EMPTY_MEMBERSHIP_LIST_i { 0, NULL }
extern const Membership_list EMPTY_MEMBERSHIP_LIST; extern const Membership_list EMPTY_MEMBERSHIP_LIST;
/* The Info struct */ /* The Info struct */
typedef struct { typedef struct {
long version; long version;
...@@ -471,16 +461,16 @@ typedef struct { ...@@ -471,16 +461,16 @@ typedef struct {
#ifdef CLIENT #ifdef CLIENT
# define EMPTY_CONFERENCE_i ((Conference) \ # define EMPTY_CONFERENCE_i \
{ 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \ { 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \
NULL_TIME_i, 0, 0, EMPTY_STRING_i, 0, 0, 0 \ NULL_TIME_i, 0, 0, EMPTY_STRING_i, 0, 0, 0 \
}) }
#else /* SERVER */ #else /* SERVER */
# define EMPTY_CONFERENCE_i ((Conference) \ # define EMPTY_CONFERENCE_i \
{ 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \ { 0, NULL_TIME_i, 0, 0, 0, 0, NULL_CONF_TYPE_i, \
NULL_TIME_i, 0, 0, EMPTY_STRING_i, \ NULL_TIME_i, 0, 0, EMPTY_STRING_i, \
EMPTY_MEMBER_LIST_i, EMPTY_TEXT_LIST_i \ EMPTY_MEMBER_LIST_i, EMPTY_TEXT_LIST_i \
}) }
#endif /* SERVER */ #endif /* SERVER */
extern const Conference EMPTY_CONFERENCE; extern const Conference EMPTY_CONFERENCE;
...@@ -493,11 +483,9 @@ typedef struct { ...@@ -493,11 +483,9 @@ typedef struct {
Garb_nice nice; /* Number of days to live */ Garb_nice nice; /* Number of days to live */
} Small_conf; } Small_conf;
#define EMPTY_SMALL_CONF_i ((Small_conf){EMPTY_STRING_i, NULL_CONF_TYPE_i, \ #define EMPTY_SMALL_CONF_i {EMPTY_STRING_i, NULL_CONF_TYPE_i, 0, 0};
0, 0});
extern const Small_conf EMPTY_SMALL_CONF; extern const Small_conf EMPTY_SMALL_CONF;
#endif #endif /* SERVER */
/* Struct for persons */ /* Struct for persons */
...@@ -532,24 +520,23 @@ typedef struct { ...@@ -532,24 +520,23 @@ typedef struct {
} Person; } Person;
#ifdef SERVER #ifdef SERVER
# define EMPTY_PERSON_i ((Person) \ # define EMPTY_PERSON_i \
{ 0, DEFAULT_PRIV_BITS_i, \ { 0, DEFAULT_PRIV_BITS_i, \
DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \ DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \
0, 0, 0, 0, 0, 0, EMPTY_STRING_i, \ 0, 0, 0, 0, 0, 0, EMPTY_STRING_i, \
EMPTY_TEXT_LIST_i, EMPTY_MARK_LIST_i, \ EMPTY_TEXT_LIST_i, EMPTY_MARK_LIST_i, \
EMPTY_MEMBERSHIP_LIST_i, "\001password" \ EMPTY_MEMBERSHIP_LIST_i, "\001password" \
}) }
#else #else
# define EMPTY_PERSON_i ((Person) \ # define EMPTY_PERSON_i \
{ 0, DEFAULT_PRIV_BITS_i, \ { 0, DEFAULT_PRIV_BITS_i, \
DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \ DEFAULT_PERSONAL_FLAGS_i, NULL_TIME_i, 0, 0, \
0, 0, 0, 0, 0, 0, EMPTY_STRING_i, 0, 0, 0, 0 \ 0, 0, 0, 0, 0, 0, EMPTY_STRING_i, 0, 0, 0, 0 \
}) }
#endif #endif
extern const Person EMPTY_PERSON; extern const Person EMPTY_PERSON;
/* /*
* This struct is returned from the 'who_is_on' call. * This struct is returned from the 'who_is_on' call.
*/ */
...@@ -577,11 +564,8 @@ typedef struct { ...@@ -577,11 +564,8 @@ typedef struct {
Session_no session_no; /* Serial number of connection. */ Session_no session_no; /* Serial number of connection. */
} Who_info_ident; } Who_info_ident;
#define EMPTY_WHO_INFO_IDENT_i ((Who_info_ident) \ #define EMPTY_WHO_INFO_IDENT_i \
{ 0, EMPTY_STRING_i, EMPTY_STRING_i, \ { 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
EMPTY_STRING_i, EMPTY_STRING_i, \
0, 0 })
extern const Who_info_ident EMPTY_WHO_INFO_IDENT; extern const Who_info_ident EMPTY_WHO_INFO_IDENT;
typedef struct { typedef struct {
...@@ -594,9 +578,9 @@ typedef struct { ...@@ -594,9 +578,9 @@ typedef struct {
unsigned long idle_time; /* Seconds. */ unsigned long idle_time; /* Seconds. */
} Session_info; } Session_info;
#define EMPTY_SESSION_INFO_i ((Session_info) { 0, EMPTY_STRING_i, \ #define EMPTY_SESSION_INFO_i { 0, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0, \ EMPTY_STRING_i, 0, 0, \
NULL_TIME_i, 0 }) NULL_TIME_i, 0 }
extern const Session_info EMPTY_SESSION_INFO; extern const Session_info EMPTY_SESSION_INFO;
...@@ -613,20 +597,17 @@ typedef struct { ...@@ -613,20 +597,17 @@ typedef struct {
unsigned long idle_time; /* Seconds. */ unsigned long idle_time; /* Seconds. */
} Session_info_ident; } Session_info_ident;
#define EMPTY_SESSION_INFO_IDENT_i ((Session_info_ident)\ #define EMPTY_SESSION_INFO_IDENT_i \
{ 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, \ { 0, EMPTY_STRING_i, EMPTY_STRING_i, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0, \ EMPTY_STRING_i, 0, 0, \
NULL_TIME_i, 0 }) NULL_TIME_i, 0 }
extern const Session_info_ident EMPTY_SESSION_INFO_IDENT; extern const Session_info_ident EMPTY_SESSION_INFO_IDENT;
#define EMPTY_WHO_INFO_OLD_i ((Who_info_old) { 0, EMPTY_STRING_i, 0 }) #define EMPTY_WHO_INFO_OLD_i { 0, EMPTY_STRING_i, 0 }
#define EMPTY_WHO_INFO_i { 0, EMPTY_STRING_i, EMPTY_STRING_i, 0, 0 }
#define EMPTY_WHO_INFO_i ((Who_info) { 0, EMPTY_STRING_i, \
EMPTY_STRING_i, 0, 0 })
extern const Who_info_old EMPTY_WHO_INFO_OLD; extern const Who_info_old EMPTY_WHO_INFO_OLD;
extern const Who_info EMPTY_WHO_INFO; extern const Who_info EMPTY_WHO_INFO;
...@@ -636,8 +617,8 @@ typedef struct { ...@@ -636,8 +617,8 @@ typedef struct {
Who_info_old * info; Who_info_old * info;
} Who_info_list_old; } Who_info_list_old;
#define EMPTY_WHO_INFO_LIST_OLD_i ((Who_info_list_old) { 0, NULL }) #define EMPTY_WHO_INFO_LIST_OLD_i { 0, NULL }
extern const Who_info_list_old EMPTY_WHO_INFO_LIST_OLD; extern const Who_info_list_old EMPTY_WHO_INFO_LIST_OLD;
typedef struct { typedef struct {
...@@ -645,7 +626,7 @@ typedef struct { ...@@ -645,7 +626,7 @@ typedef struct {
Who_info * info; Who_info * info;
} Who_info_list; } Who_info_list;
#define EMPTY_WHO_INFO_LIST_i ((Who_info_list) { 0, NULL }) #define EMPTY_WHO_INFO_LIST_i { 0, NULL }
extern const Who_info_list EMPTY_WHO_INFO_LIST; extern const Who_info_list EMPTY_WHO_INFO_LIST;
typedef struct { typedef struct {
...@@ -653,9 +634,9 @@ typedef struct { ...@@ -653,9 +634,9 @@ typedef struct {
Who_info_ident * info; Who_info_ident * info;
} Who_info_ident_list; } Who_info_ident_list;
#define EMPTY_WHO_INFO_IDENT_LIST_i ((Who_info_ident_list) { 0, NULL }) #define EMPTY_WHO_INFO_IDENT_LIST_i { 0, NULL }
extern const Who_info_ident_list EMPTY_WHO_INFO_IDENT_LIST; extern const Who_info_ident_list EMPTY_WHO_INFO_IDENT_LIST;
#define EMPTY_tm_i ((struct tm){0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}) #define EMPTY_tm_i {0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
#endif /* ifndef KOM_TYPES_H_ALREADY_INCLUDED__ */ #endif /* ifndef KOM_TYPES_H_ALREADY_INCLUDED__ */
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