diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-12-22 20:16:57 +0000 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-12-22 20:16:57 +0000 |
commit | 0883de2c491a8c79aec13d25bab429aea4362a10 (patch) | |
tree | 1c1e1063697f8b5e19d706ef3813f76aad21b70e /functions.h | |
parent | 85dd88a180043e991c19a4c93a6ce5c7fe0a6e88 (diff) |
Significantly reduce memory usage by only initialising channel struct elements when they are used for the first time.
Diffstat (limited to 'functions.h')
-rw-r--r-- | functions.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/functions.h b/functions.h index 7a3e398..49417e8 100644 --- a/functions.h +++ b/functions.h @@ -118,28 +118,28 @@ int sendtoserver(SSL *server_ssl, char *strsrc, int str_len, int clientfd, struc // Also set the pending statuses to 0 int disconnectclient(int fd, struct client *clients, struct ircdstate *ircdstate, struct settings *settings, struct clientcodes *clientcodes); -int createchannel(struct channel *channels, char *name, char *topic, char *topicwho, char *topicwhen); +int createchannel(struct channel *channels, struct ircdstate *ircdstate, char *name, char *topic, char *topicwho, char *topicwhen); -int setchanneltopicwhotime(struct channel *channels, char *channelname, char *who, char *when); +int setchanneltopicwhotime(struct channel *channels, int maxchannelcount, char *channelname, char *who, char *when); -int setchanneltopic(struct channel *channels, char *channelname, char *topic); +int setchanneltopic(struct channel *channels, int maxchannelcount, char *channelname, char *topic); -int getchannelcount(struct channel *channels); +int getchannelcount(struct channel *channels, int maxchannelcount); -int removechannel(struct channel *channels, char *name); +int removechannel(struct channel *channels, int maxchannelcount, char *name); // Check if we have the NAMES for the channel 'name' already. // Return the 1 if we do, 0 if we don't, or -1 if there's an error. -int channelgotnames(struct channel *channels, char *name); +int channelgotnames(struct channel *channels, int maxchannelcount, char *name); // Check if we are in a channel named "name" or not. // Return 1 if we are, or 0 if not. -int inchannel(struct channel *channels, char *name); +int inchannel(struct channel *channels, int maxchannelcount, char *name); // Returns the array index in the 'channels' array of the channel // named 'channel'. // Returns -1 if there was an error. -int channelindex(struct channel *channels, char *name); +int channelindex(struct channel *channels, int maxchannelcount, char *name); // Send the requested number of lines of replay log to the requested client. // 'sourcefd' is the client to send to, and replayseconds is the number of @@ -196,23 +196,23 @@ void replacechar(char *str, char find, char replace); // Add nick (passed as a :nick!user@host) to channel 'channel' // Returns 1 on success or 0 on failure -int addnicktochannel(char *nickuserhost, char *channel, struct channel *channels); +int addnicktochannel(char *nickuserhost, char *channel, struct channel *channels, int maxchannelcount); // Remove nick(passed as a :nick!user@host) from channel 'channel' // Returns 1 on success or 0 on failure -int removenickfromchannel(char *nickuserhost, char *channel, struct channel *channels); +int removenickfromchannel(char *nickuserhost, char *channel, struct channel *channels, int maxchannelcount); // Remove nick (passed as a :nick!user@host) from all channels // Returns 1 on success or 0 on failure -int removenickfromallchannels(char *nickuserhost, struct channel *channels); +int removenickfromallchannels(char *nickuserhost, struct channel *channels, int maxchannelcount); // Update old nick (passed as a :nick!user@host) to 'newnick' in all channels // Returns 1 on success or 0 on failure -int updatenickinallchannels(char *nickuserhost, char *newnick, struct channel *channels); +int updatenickinallchannels(char *nickuserhost, char *newnick, struct channel *channels, int maxchannelcount); // Populate our channels struct with all nicks in a RPL_NAMREPLY // Returns 1 on success or 0 on failure -int addnamereplytochannel(char *namereply, struct channel *channels); +int addnamereplytochannel(char *namereply, struct channel *channels, int maxchannelcount); // Strips all leading prefixes (colons, user modes) from a nick void stripprefixesfromnick(char *nick); |