remove some unnecessary memsets

pull/81/head
Richard Fuchs 11 years ago
parent fb667a8dba
commit d79c68f532

@ -2431,11 +2431,10 @@ void call_destroy(struct call *c) {
GList *k, *o; GList *k, *o;
struct timeval tim_result_duration; struct timeval tim_result_duration;
static const int CDRBUFLENGTH = 4096*2; static const int CDRBUFLENGTH = 4096*2;
char cdrbuffer[CDRBUFLENGTH]; memset(&cdrbuffer,0,CDRBUFLENGTH); char cdrbuffer[CDRBUFLENGTH];
char* cdrbufcur = cdrbuffer; char* cdrbufcur = cdrbuffer;
int cdrlinecnt = 0; int cdrlinecnt = 0;
int found = 0; int found = 0;
//char tmpstreampairstatus[2]; memset(&tmpstreampairstatus,0,2);
rwlock_lock_w(&m->hashlock); rwlock_lock_w(&m->hashlock);
ret = g_hash_table_remove(m->callhash, &c->callid); ret = g_hash_table_remove(m->callhash, &c->callid);

@ -100,8 +100,8 @@ static void cli_incoming_list_callid(char* buffer, int len, struct callmaster* m
GSList *l; GSList *l;
GList *k, *o; GList *k, *o;
int printlen=0; int printlen=0;
struct timeval tim_result_duration; memset(&tim_result_duration,0,sizeof(struct timeval)); struct timeval tim_result_duration;
struct timeval now; memset(&now,0,sizeof(struct timeval)); struct timeval now;
if (len<=1) { if (len<=1) {
printlen = snprintf(replybuffer,(outbufend-replybuffer), "%s\n", "More parameters required."); printlen = snprintf(replybuffer,(outbufend-replybuffer), "%s\n", "More parameters required.");
@ -247,7 +247,6 @@ static void cli_incoming_terminate(char* buffer, int len, struct callmaster* m,
if (!c->ml_deleted) { if (!c->ml_deleted) {
for (i = c->monologues; i; i = i->next) { for (i = c->monologues; i; i = i->next) {
ml = i->data; ml = i->data;
memset(&ml->terminated,0,sizeof(struct timeval));
gettimeofday(&(ml->terminated), NULL); gettimeofday(&(ml->terminated), NULL);
ml->term_reason = FORCED; ml->term_reason = FORCED;
} }
@ -272,7 +271,6 @@ static void cli_incoming_terminate(char* buffer, int len, struct callmaster* m,
if (!c->ml_deleted) { if (!c->ml_deleted) {
for (i = c->monologues; i; i = i->next) { for (i = c->monologues; i; i = i->next) {
ml = i->data; ml = i->data;
memset(&ml->terminated,0,sizeof(struct timeval));
gettimeofday(&(ml->terminated), NULL); gettimeofday(&(ml->terminated), NULL);
ml->term_reason = FORCED; ml->term_reason = FORCED;
} }
@ -294,11 +292,11 @@ static void cli_incoming(int fd, void *p, uintptr_t u) {
struct cli *cli = (void *) p; struct cli *cli = (void *) p;
socklen_t sinl; socklen_t sinl;
static const int BUFLENGTH = 4096*1024; static const int BUFLENGTH = 4096*1024;
char replybuffer[BUFLENGTH]; memset(&replybuffer,0,BUFLENGTH); char replybuffer[BUFLENGTH];
char* outbuf = replybuffer; char* outbuf = replybuffer;
const char* outbufend = replybuffer+BUFLENGTH; const char* outbufend = replybuffer+BUFLENGTH;
static const int MAXINPUT = 1024; static const int MAXINPUT = 1024;
char inbuf[MAXINPUT]; memset(&inbuf,0,MAXINPUT); char inbuf[MAXINPUT];
int inlen = 0, readbytes = 0; int inlen = 0, readbytes = 0;
int rc=0; int rc=0;

@ -77,14 +77,14 @@ int send_graphite_data() {
} }
// format hostname "." totals.subkey SPACE value SPACE timestamp // format hostname "." totals.subkey SPACE value SPACE timestamp
char hostname[256]; memset(&hostname,0,256); char hostname[256];
rc = gethostname(hostname,256); rc = gethostname(hostname,256);
if (rc<0) { if (rc<0) {
ilog(LOG_ERROR, "Could not retrieve host name information."); ilog(LOG_ERROR, "Could not retrieve host name information.");
goto error; goto error;
} }
char data_to_send[8192]; memset(&data_to_send,0,8192); char data_to_send[8192];
char* ptr = data_to_send; char* ptr = data_to_send;
struct totalstats ts; struct totalstats ts;

Loading…
Cancel
Save