diff options
-rw-r--r-- | libhashtable/libhashtable.c | 5 | ||||
-rw-r--r-- | libirc/libirc.c | 5 | ||||
-rw-r--r-- | segfault.c | 4 |
3 files changed, 4 insertions, 10 deletions
diff --git a/libhashtable/libhashtable.c b/libhashtable/libhashtable.c index 38b4ad3..02b981e 100644 --- a/libhashtable/libhashtable.c +++ b/libhashtable/libhashtable.c @@ -88,10 +88,11 @@ void ht_freevalues(struct hashtable *ht) { //this seems too complicated. int ht_setkey(struct hashtable *ht,char *key,void *value) { - if(!key) key="(null)"; - unsigned short h=hash(key); + unsigned short h; struct entry *tmp; int i; + if(!key) key="(null)"; + h=hash(key); for(i=0;i<ht->kl;i++) { if(ht->keys[i]==h) break; } diff --git a/libirc/libirc.c b/libirc/libirc.c index 54ba859..101d40e 100644 --- a/libirc/libirc.c +++ b/libirc/libirc.c @@ -38,7 +38,6 @@ int serverConnect(char *serv,char *port) { } int runit(int fd,void (*line_handler)(),void (*extra_handler)()) { - FILE *fp; fd_set master; fd_set readfs; struct timeval timeout; @@ -53,7 +52,6 @@ int runit(int fd,void (*line_handler)(),void (*extra_handler)()) { FD_ZERO(&readfs); FD_SET(fd,&master); fdmax=fd; - fp=fdopen(fd,"rw"); memset(backlog,0,CHUNK); memset(buffer,0,CHUNK); if(fd) { @@ -104,11 +102,8 @@ int runit(int fd,void (*line_handler)(),void (*extra_handler)()) { strcpy(t,"PONG "); strcat(t,line+6); write(fd,t,strlen(t)); - //fprintf(fp,"PONG %s",line+6);//a whole FILE * and fdopen JUST for this??? oy... - //fflush(fp); #ifdef DEBUG printf("%s\nPONG %s\n",line,line+6); - write(fd,"PRIVMSG %s :PONG! w00t!\r\n",DEBUG,28); #endif } else if(!strncmp(line,"ERROR",5)) { #ifdef DEBUG @@ -1,4 +1,5 @@ #include <stdio.h> +#include <string.h> #include <stdarg.h> #include <signal.h> #include <errno.h> @@ -280,7 +281,6 @@ void eofp(FILE *fp) { //feature creature void extra_handler(int fd) { int tmpo,i; - static int mmerp=0; char tmp[BS+1]; char *tmp2; if(oldtime == time(0) && lines_sent > LINES_SENT_LIMIT) {//if it is still the same second, skip this function. @@ -321,14 +321,12 @@ void extra_handler(int fd) { } else {//if there was something to read. tailf[i].lines++; - mmerp=0; if(strchr(tmp,'\r')) *strchr(tmp,'\r')=0; if(strchr(tmp,'\n')) *strchr(tmp,'\n')=0; if(tailf[i].opt & TAILO_EVAL) {//eval if(tailf[i].opt & TAILO_FORMAT) { tmp2=format_magic(fd,tailf[i].to,tailf[i].user,tmp,tailf[i].args); } else { - if(!tmp) exit(72); tmp2=strdup(tmp); } message_handler(fd,tailf[i].to,tailf[i].user,tmp2,0); |