summaryrefslogtreecommitdiffstats
path: root/ircxmpp.h
diff options
context:
space:
mode:
Diffstat (limited to 'ircxmpp.h')
-rw-r--r--ircxmpp.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ircxmpp.h b/ircxmpp.h
index 38b6f16..19cf1c9 100644
--- a/ircxmpp.h
+++ b/ircxmpp.h
@@ -1,3 +1,4 @@
+#define IX_S0(x) (x ? x : "")
enum ircxmpp_loglevel {
IRCXMPP_DEBUG,
IRCXMPP_INFO,
@@ -10,6 +11,18 @@ typedef void (* ircxmpp_domain_setter) (void *, const char *);
#ifdef IX_LIB /* do not use functions until #endif in programs that use libircxmpp. */
#include <libircclient.h> /* do not use members of struct ircxmpp, use opaque ircxmpp type! */
#include <strophe.h>
+#include <math.h>
+#define ISA(type, name) type * name; size_t name##_sizeof; size_t name##_length
+#define ALLOC_CHUNK 1 // \\ note: this ISA is array of type not array of type *
+#define REALLOC_K 1.5
+#define BIGGER_ARRAY(name) do { \
+ name = realloc(name, sizeof(name[0])*ceil(name##_sizeof*REALLOC_K)); \
+ for (int BA = name##_sizeof; BA < ceil(name##_sizeof*REALLOC_K); BA++) \
+ name[BA] = NULL; \
+ name##_sizeof = ceil(name##_sizeof*REALLOC_K); \
+ } while (0)
+#define MR(n) if (n##_sizeof <= n##_length) /* make room */ \
+ BIGGER_ARRAY(n)
enum irc_numeric { /* numerics from rfc 1459 */
ERR_NOSUCHNICK = 401,
ERR_NOSUCHSERVER,
@@ -179,6 +192,8 @@ struct ircxmpp {
ircxmpp_domain_setter domain_setter;
void * domain_setter_userdata;
char * domain;
+ ISA(struct bridge *, to_free_bridges);
+ ISA(char *, to_free_reasons); // static reason strings, do not free them
};
static void send_xmpp_logs_to_me (
void * const, const xmpp_log_level_t, const char * const, const char * const);