aboutsummaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/command.c b/command.c
index 6edf4ea..13d8252 100644
--- a/command.c
+++ b/command.c
@@ -2,7 +2,6 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <assert.h>
#include <sys/time.h>
#include <sys/socket.h>
#include "command.h"
@@ -34,7 +33,6 @@ static bool send_raw_text(int fd,const char *text,i64 len){
static bool send_ok(int fd,const char *tag){
char *buf=NULL;
i64 len=asprintf(&buf,"%s ok\n",tag);
- assert(buf);
bool closed=send_raw_text(fd,buf,len);
free(buf);
return closed;
@@ -43,7 +41,6 @@ static bool send_ok(int fd,const char *tag){
static bool send_error(int fd,const char *tag,const char *msg){
char *buf=NULL;
i64 len=asprintf(&buf,"%s error %s\n",tag,msg);
- assert(buf);
bool closed=send_raw_text(fd,buf,len);
free(buf);
return closed;
@@ -52,7 +49,6 @@ static bool send_error(int fd,const char *tag,const char *msg){
static bool send_name(int fd,const char *tag,const char *name){
char *buf=NULL;
i64 len=asprintf(&buf,"%s name %s\n",tag,name);
- assert(buf);
bool closed=send_raw_text(fd,buf,len);
free(buf);
return closed;
@@ -61,7 +57,6 @@ static bool send_name(int fd,const char *tag,const char *name){
static bool send_list(int fd,const char *tag,i64 count,const char **list){
char *buf=NULL;
i64 len=asprintf(&buf,"%s list %" PRIi64,tag,count);
- assert(buf);
bool closed=send_raw_text(fd,buf,len);
free(buf);
if(closed)return true;
@@ -262,7 +257,6 @@ static bool cmd_send(struct conn_data *data,const char *tag,const char **args){
char *username=db_get_username(data->userid);
i64 pushbuflen=asprintf(&pushbuf,"_push message %s %s %" PRIi64 " %s\n",
args[0],username,timestamp,args[1]);
- assert(pushbuf);
free(username);
struct db_user_list members=db_list_members(roomid);
@@ -277,6 +271,7 @@ static bool cmd_send(struct conn_data *data,const char *tag,const char **args){
}
}
+ db_nullify_user_list(members);
free(pushbuf);
return closed;
@@ -307,7 +302,6 @@ static bool cmd_history(struct conn_data *data,const char *tag,const char **args
struct db_message_list ml=db_get_messages(roomid,nrequested);
char *buf=NULL;
i64 len=asprintf(&buf,"%s history %" PRIi64 "\n",tag,ml.count);
- assert(buf);
bool closed=send_raw_text(data->fd,buf,len);
free(buf);
@@ -320,7 +314,6 @@ static bool cmd_history(struct conn_data *data,const char *tag,const char **args
char *username=db_get_username(ml.list[i].userid);
len=asprintf(&buf,"%s history_message %" PRIi64 " %s %s %" PRIi64 " %s\n",
tag,ml.count-1-i,args[0],username,ml.list[i].timestamp,ml.list[i].message);
- assert(buf);
closed=send_raw_text(data->fd,buf,len);
free(buf);
if(closed)break;