bzero -> memset

This commit is contained in:
Josh Elsasser 2007-07-19 00:57:26 +00:00
parent c10e7c3288
commit 65dba27217
6 changed files with 18 additions and 18 deletions

View File

@ -145,7 +145,7 @@ client_new_sock( const char * path )
gl_proxy = 0; gl_proxy = 0;
bzero( &sun, sizeof sun ); memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL; sun.sun_family = AF_LOCAL;
strlcpy( sun.sun_path, path, sizeof sun.sun_path ); strlcpy( sun.sun_path, path, sizeof sun.sun_path );
@ -901,7 +901,7 @@ infomsg( enum ipc_msg msgid, benc_val_t * list, int64_t tag,
return; return;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.tag = tag; key.tag = tag;
resp = RB_FIND( resptree, &gl_resps, &key ); resp = RB_FIND( resptree, &gl_resps, &key );
if( NULL == resp || NULL == resp->infocb ) if( NULL == resp || NULL == resp->infocb )
@ -953,7 +953,7 @@ statmsg( enum ipc_msg msgid, benc_val_t * list, int64_t tag,
return; return;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.tag = tag; key.tag = tag;
resp = RB_FIND( resptree, &gl_resps, &key ); resp = RB_FIND( resptree, &gl_resps, &key );
if( NULL == resp || NULL == resp->statcb ) if( NULL == resp || NULL == resp->statcb )
@ -1018,7 +1018,7 @@ defmsg( enum ipc_msg msgid, benc_val_t * val, int64_t tag, void * arg UNUSED )
break; break;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.tag = tag; key.tag = tag;
resp = RB_FIND( resptree, &gl_resps, &key ); resp = RB_FIND( resptree, &gl_resps, &key );
if( NULL == resp ) if( NULL == resp )

View File

@ -223,7 +223,7 @@ getlock( const char * path )
return -1; return -1;
} }
bzero( &lk, sizeof lk ); memset( &lk, 0, sizeof lk );
lk.l_start = 0; lk.l_start = 0;
lk.l_len = 0; lk.l_len = 0;
lk.l_type = F_WRLCK; lk.l_type = F_WRLCK;
@ -262,7 +262,7 @@ getsock( const char * path )
return -1; return -1;
} }
bzero( &sun, sizeof sun ); memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL; sun.sun_family = AF_LOCAL;
strlcpy( sun.sun_path, path, sizeof sun.sun_path ); strlcpy( sun.sun_path, path, sizeof sun.sun_path );
unlink( path ); unlink( path );

View File

@ -198,7 +198,7 @@ makesock( enum confpathtype type, const char * path )
struct sockaddr_un sun; struct sockaddr_un sun;
int fd; int fd;
bzero( &sun, sizeof sun ); memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL; sun.sun_family = AF_LOCAL;
if( NULL == path ) if( NULL == path )
{ {

View File

@ -288,7 +288,7 @@ readargs( int argc, char ** argv, struct opts * opts )
int opt, gotmsg; int opt, gotmsg;
gotmsg = 0; gotmsg = 0;
bzero( opts, sizeof *opts ); memset( opts, 0, sizeof *opts );
opts->type = CONF_PATH_TYPE_DAEMON; opts->type = CONF_PATH_TYPE_DAEMON;
SLIST_INIT( &opts->files ); SLIST_INIT( &opts->files );
opts->map = -1; opts->map = -1;
@ -492,7 +492,7 @@ hasharg( const char * arg, struct strlist * list, int * all )
} }
/* try to look up the hash in the hash tree */ /* try to look up the hash in the hash tree */
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
strlcpy( key.hash, listitem->str, sizeof key.hash ); strlcpy( key.hash, listitem->str, sizeof key.hash );
treeitem = RB_FIND( torhashes, &gl_hashids, &key ); treeitem = RB_FIND( torhashes, &gl_hashids, &key );
if( NULL == treeitem ) if( NULL == treeitem )
@ -622,7 +622,7 @@ infomsg( const struct cl_info * cinfo )
return; return;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.id = cinfo->id; key.id = cinfo->id;
tinfo = RB_FIND( torlist, &gl_torinfo, &key ); tinfo = RB_FIND( torlist, &gl_torinfo, &key );
if( NULL == tinfo ) if( NULL == tinfo )
@ -667,7 +667,7 @@ statmsg( const struct cl_stat * st )
return; return;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.id = st->id; key.id = st->id;
info = RB_FIND( torlist, &gl_torinfo, &key ); info = RB_FIND( torlist, &gl_torinfo, &key );
if( NULL == info ) if( NULL == info )
@ -718,7 +718,7 @@ hashmsg( const struct cl_info * inf )
return; return;
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
strlcpy( key.hash, inf->hash, sizeof key.hash ); strlcpy( key.hash, inf->hash, sizeof key.hash );
found = RB_FIND( torhashes, &gl_hashids, &key ); found = RB_FIND( torhashes, &gl_hashids, &key );
if( NULL != found ) if( NULL != found )
@ -840,7 +840,7 @@ sendidreqs( void )
struct torhash key, * found; struct torhash key, * found;
ret = -1; ret = -1;
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
for( ii = 0; ARRAYLEN( reqs ) > ii; ii++) for( ii = 0; ARRAYLEN( reqs ) > ii; ii++)
{ {

View File

@ -301,7 +301,7 @@ byebye( struct bufferevent * ev, short what, void * arg UNUSED )
} }
} }
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.ev = ev; key.ev = ev;
client = RB_FIND( allclients, &gl_clients, &key ); client = RB_FIND( allclients, &gl_clients, &key );
assert( NULL != client ); assert( NULL != client );

View File

@ -278,7 +278,7 @@ torrent_lookup( const uint8_t * hashstr )
assert( NULL != gl_handle ); assert( NULL != gl_handle );
assert( !gl_exiting ); assert( !gl_exiting );
bzero( buf, sizeof buf ); memset( buf, 0, sizeof buf );
for( ii = 0; sizeof( hash ) > ii; ii++ ) for( ii = 0; sizeof( hash ) > ii; ii++ )
{ {
if( !isxdigit( hashstr[2*ii] ) || !isxdigit( hashstr[1+2*ii] ) ) if( !isxdigit( hashstr[2*ii] ) || !isxdigit( hashstr[1+2*ii] ) )
@ -657,7 +657,7 @@ timerfunc( int fd UNUSED, short event UNUSED, void * arg UNUSED )
if( stillmore ) if( stillmore )
{ {
bzero( &tv, sizeof tv ); memset( &tv, 0, sizeof tv );
tv.tv_sec = TIMER_SECS; tv.tv_sec = TIMER_SECS;
tv.tv_usec = TIMER_USECS; tv.tv_usec = TIMER_USECS;
evtimer_add( &gl_event, &tv ); evtimer_add( &gl_event, &tv );
@ -882,7 +882,7 @@ idlookup( int id )
{ {
struct tor key, * found; struct tor key, * found;
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
key.id = id; key.id = id;
found = RB_FIND( tortree, &gl_tree, &key ); found = RB_FIND( tortree, &gl_tree, &key );
@ -894,7 +894,7 @@ hashlookup( const uint8_t * hash )
{ {
struct tor key, * found; struct tor key, * found;
bzero( &key, sizeof key ); memset( &key, 0, sizeof key );
memcpy( key.hash, hash, sizeof key.hash ); memcpy( key.hash, hash, sizeof key.hash );
found = RB_FIND( hashtree, &gl_hashes, &key ); found = RB_FIND( hashtree, &gl_hashes, &key );