diff options
author | Jeremy Allison <jra@samba.org> | 2006-04-11 01:43:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:58 -0500 |
commit | fc13f284179df5f3f3a1d475bf84da21dc89c970 (patch) | |
tree | f5df9fc2aa7961be3ac6afc8b033950964416c38 /source3/lib | |
parent | 41a35cfe940ceba7b89eec776ca78eec8eeb4a82 (diff) | |
download | samba-fc13f284179df5f3f3a1d475bf84da21dc89c970.tar.gz samba-fc13f284179df5f3f3a1d475bf84da21dc89c970.tar.bz2 samba-fc13f284179df5f3f3a1d475bf84da21dc89c970.zip |
r15030: On a performace hunt... Remove as many extraneous
memset's as possible.
Jeremy.
(This used to be commit 1217ed392b75aa8bfefa9c3f1ec5fa3bba841ee0)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 3 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 87f15b8759..bbc9ceddca 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -529,8 +529,9 @@ void smb_setlen(char *buf,int len) int set_message(char *buf,int num_words,int num_bytes,BOOL zero) { - if (zero) + if (zero && (num_words || num_bytes)) { memset(buf + smb_size,'\0',num_words*2 + num_bytes); + } SCVAL(buf,smb_wct,num_words); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 91c3305996..12fc2ead95 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -662,8 +662,6 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) smb_read_error = 0; - memset(buffer,'\0',smb_size + 100); - len = read_smb_length_return_keepalive(fd,buffer,timeout); if (len < 0) { DEBUG(10,("receive_smb_raw: length < 0!\n")); @@ -708,8 +706,9 @@ BOOL receive_smb_raw(int fd, char *buffer, unsigned int timeout) } if (ret != len) { - if (smb_read_error == 0) + if (smb_read_error == 0) { smb_read_error = READ_ERROR; + } return False; } |