size_t as, bs;
const char *a = luaL_checklstring(L, 2, &as);
const char *b = luaL_optlstring(L, 3, 0, &bs);
- char *buf = malloc(as+bs+2);
+ char *buf = (char *)malloc(as+bs+2);
memcpy(buf, a, as+1);
if (b)
memcpy(buf+as+1, b, bs+1);
// RFC 4616 spec says the three parts of the response can be up to 255 bytes long
// That's 255*3 + 2, but we'll add another NUL byte after the pass, so it's 768.
// Base64 encoding adds 4/3 overhead, so the total buffer size is 1024.
- client->saslbuf = malloc(1024);
+ client->saslbuf = (char *)malloc(1024);
client->saslbufLen = 0;
client->saslexternal = !strcmp(args[0], "EXTERNAL");
if (!client->saslbuf)
client->webircwait = 2;
if (!strcmp(args[1], "biboumi")) {
int len = strlen(args[2]);
- client->webirchostname = malloc(len+sizeof(".xmpp"));
+ client->webirchostname = (char *)malloc(len+sizeof(".xmpp"));
if (client->webirchostname) {
memcpy(client->webirchostname, args[2], len);
memcpy(client->webirchostname+len, ".xmpp", sizeof(".xmpp"));
char *u = client->username ? client->username : "*";
char *h = client->hostname;
free(client->nuh);
- client->nuh = malloc(strlen(n) + strlen(u) + strlen(h) + 3);
+ client->nuh = (char *)malloc(strlen(n) + strlen(u) + strlen(h) + 3);
if (!client->nuh)
abort();
sprintf(client->nuh, "%s!%s@%s", n, u, h);
}
struct channel *channel_new(const char *channel, const char *key, time_t creation)
{
- struct channel *chan = malloc(sizeof(struct channel));
+ struct channel *chan = (struct channel *)malloc(sizeof(struct channel));
if (!chan) abort();
memset(chan, 0, sizeof(struct channel));
chan->creation = creation;
struct jobent ent = { cl, job, then, data, len };
if (joblen == jobcap) {
jobcap = jobcap == 0 ? 16 : jobcap * 2;
- jobtab = realloc(jobtab, sizeof(struct jobent)*jobcap);
+ jobtab = (struct jobent *)realloc(jobtab, sizeof(struct jobent)*jobcap);
if (!jobtab)
abort();
}
} else {
size_t pwlen = strlen(pw)+1;
size_t len = pwlen+strlen(salt)+1;
- char *buf = malloc(len);
+ char *buf = (char *)malloc(len);
if (!buf)
abort();
memcpy(buf, pw, pwlen);
admin_init();
#endif
set_handler();
- databuf.buf = malloc(sizeof(char) * 512);
+ databuf.buf = (char *)malloc(sizeof(char) * 512);
databuf.cap = 512;
struct tls *tls_ctx = NULL;
if (sp && bang && bang < sp) {
int nlen = bang - fake->buf - 1;
if (memcmp(&fake->buf[1], fake->nick, nlen) != 0) {
- char *nnick = malloc(nlen+1);
+ char *nnick = (char *)malloc(nlen+1);
if (!nnick)
abort();
memcpy(nnick, &fake->buf[1], nlen);
if (value) {
if (root->len == root->cap) {
int ncap = root->cap ? root->cap*2 : 2;
- struct map_value *nptr = realloc(root->ptr, sizeof(struct map_value)*ncap);
+ struct map_value *nptr = (struct map_value *)realloc(root->ptr, sizeof(struct map_value)*ncap);
if (!nptr)
return -1;
root->ptr = nptr;
root->cap = ncap;
}
int slen = strlen(key)+1;
- char *nkey = malloc(slen);
+ char *nkey = (char *)malloc(slen);
if (!nkey)
return -1;
memcpy(nkey, key, slen);
struct client_data *allocClient(void)
{
- return calloc(1, sizeof(struct client_data));
+ return (struct client_data *)calloc(1, sizeof(struct client_data));
}
void update_poll_reg(struct client_data *cl)
if (d->len + len > d->cap){
while (d->len + len > d->cap)
d->cap *= 2;
- void *ndata = realloc(d->buf, d->cap);
+ char *ndata = (char *)realloc(d->buf, d->cap);
if(!ndata) abort();
d->buf = ndata;
}
}
char *mystrdup(const char *s) {
int len = strlen(s);
- char *buf = malloc(len+1);
+ char *buf = (char *)malloc(len+1);
if (buf)
memcpy(buf, s, len+1);
return buf;