Commit a56c161b authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Misc code cleanup.

parent 06b75610
......@@ -96,7 +96,7 @@ disambiguate( LDAPMessage *result, int matches, char **read_attrs, char *who )
for (;;) {
printf(" Do you wish to see a list of names? ");
fflush(stdout);
(void) memset(response, 0, sizeof(response));
(void) memset(response, '\0', sizeof(response));
fetch_buffer(response, sizeof(response), stdin);
switch (response[0]) {
case 'n' :
......
......@@ -397,7 +397,7 @@ get_value( char *id, char *prompt )
* Other attributes may not.
*/
count = 1;
(void) memset(buffer, 0, sizeof(buffer));
(void) memset(buffer, '\0', sizeof(buffer));
#ifdef UOFM
if (!strcmp(id, "postalAddress") || !strcmp(id, "homePostalAddress") || !strcmp(id, "multiLineDescription") || !strcmp(id, "vacationMessage"))
#else
......
......@@ -575,7 +575,7 @@ time2text( char *ldtimestr, int dateonly )
return( fmterr );
}
memset( (char *)&t, 0, sizeof( struct tm ));
memset( (char *)&t, '\0', sizeof( struct tm ));
p = ldtimestr;
......
......@@ -67,7 +67,7 @@ des_string_to_key( char *str, register des_cblock *key )
length = strlen(str);
/* init key array for bits */
memset(k_char, 0, sizeof(k_char));
memset(k_char, '\0', sizeof(k_char));
#ifdef USE_DES_DEBUG
if (des_debug)
......@@ -116,7 +116,7 @@ des_string_to_key( char *str, register des_cblock *key )
(void) des_key_sched(key,key_sked);
(void) des_cbc_cksum((des_cblock *)in_str,key,length,key_sked,key);
/* erase key_sked */
memset((char *)key_sked, 0, sizeof(key_sked));
memset((char *)key_sked, '\0', sizeof(key_sked));
/* now fix up key parity again */
des_fixup_key_parity(key);
......@@ -160,8 +160,8 @@ Andrew_StringToKey(
int i;
int passlen;
memset(key, 0, sizeof(des_cblock));
memset(password, 0, sizeof(password));
memset(key, '\0', sizeof(des_cblock));
memset(password, '\0', sizeof(password));
strncpy (password, cell, 8);
passlen = strlen (str);
......
......@@ -43,7 +43,7 @@ int * ber_errno_addr(void)
* Print stuff
*/
static void
ber_error_print( char *data )
ber_error_print( const char *data )
{
assert( data != NULL );
......@@ -147,7 +147,7 @@ ber_bprint(
assert( data != NULL );
memset( out, 0, BPLEN );
memset( out, '\0', BPLEN );
for ( ;; ) {
if ( len < 1 ) {
sprintf( buf, "\t%s\n", ( i == 0 ) ? "(end)" : out );
......@@ -174,7 +174,7 @@ ber_bprint(
char data[128 + BPLEN];
sprintf( data, "\t%s\n", out );
(*ber_pvt_log_print)(data);
memset( out, 0, BPLEN );
memset( out, '\0', BPLEN );
i = 0;
continue;
}
......
......@@ -145,7 +145,7 @@ ber_sockbuf_add_io( Sockbuf *sb, Sockbuf_IO *sbio, int layer, void *arg )
d->sbiod_level = layer;
d->sbiod_sb = sb;
d->sbiod_io = sbio;
memset( &d->sbiod_pvt, 0, sizeof( d->sbiod_pvt ) );
memset( &d->sbiod_pvt, '\0', sizeof( d->sbiod_pvt ) );
d->sbiod_next = p;
*q = d;
......@@ -561,7 +561,7 @@ sb_dgram_setup( Sockbuf_IO_Desc *sbiod, void *arg )
p = LBER_MALLOC( sizeof( *p ) );
if ( p == NULL )
return -1;
memset( p, 0, sizeof( *p ) );
memset( p, '\0', sizeof( *p ) );
sbiod->sbiod_pvt = (void *)p;
if ( arg != NULL )
sbiod->sbiod_sb->sb_fd = *((int *)arg);
......
......@@ -44,7 +44,7 @@ ldap_enable_cache( LDAP *ld, long timeout, ber_len_t maxmem )
ld->ld_errno = LDAP_NO_MEMORY;
return( -1 );
}
(void) memset( ld->ld_cache, 0, sizeof( LDAPCache ));
(void) memset( ld->ld_cache, '\0', sizeof( LDAPCache ));
ld->ld_cache->lc_memused = sizeof( LDAPCache );
}
......
......@@ -227,7 +227,7 @@ cldap_search_s( LDAP *ld,
*res = NULL;
(void) memset( &cri, 0, sizeof( cri ));
(void) memset( &cri, '\0', sizeof( cri ));
if ( logdn != NULL ) {
ld->ld_cldapdn = logdn;
......
......@@ -324,7 +324,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, const char *host,
break;
}
(void)memset((char *)&sin, 0, sizeof(struct sockaddr_in));
(void)memset((char *)&sin, '\0', sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_port = port;
p = (char *)&sin.sin_addr;
......@@ -365,7 +365,7 @@ ldap_host_connected_to( Sockbuf *sb )
ber_socket_t sd;
#define DO_RETURN(x) if (ha_buf) LDAP_FREE(ha_buf); return (x);
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
(void)memset( (char *)&sin, '\0', sizeof( struct sockaddr_in ));
len = sizeof( sin );
ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
......
......@@ -201,7 +201,7 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async)
oslocal_debug(ld, "ldap_connect_to_path: Trying %s\n", path, 0, 0);
memset( &server, 0, sizeof(server) );
memset( &server, '\0', sizeof(server) );
server.sun_family = AF_UNIX;
strcpy( server.sun_path, path );
......
......@@ -835,7 +835,7 @@ ldap_pvt_sasl_bind(
}
sasl_setprop( ld->ld_sasl_context, SASL_IP_LOCAL, &sin );
memset( &secprops, 0, sizeof( secprops ) );
memset( &secprops, '\0', sizeof( secprops ) );
secprops.min_ssf = ld->ld_options.ldo_sasl_minssf;
secprops.max_ssf = ld->ld_options.ldo_sasl_maxssf;
secprops.security_flags = SASL_SECURITY_LAYER;
......
......@@ -901,7 +901,7 @@ time2text( char *ldtimestr, int dateonly )
return( fmterr );
}
memset( (char *)&t, 0, sizeof( struct tm ));
memset( (char *)&t, '\0', sizeof( struct tm ));
p = ldtimestr;
......
......@@ -34,7 +34,7 @@ ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
{
assert( rw != NULL );
memset( rw, 0, sizeof(ldap_pvt_thread_rdwr_t) );
memset( rw, '\0', sizeof(ldap_pvt_thread_rdwr_t) );
/* we should check return results */
ldap_pvt_thread_mutex_init( &rw->ltrw_mutex );
......
......@@ -30,7 +30,7 @@ ldbm_datum_free( LDBM ldbm, Datum data )
{
if ( data.dptr ) {
free( data.dptr );
memset( &data, 0, sizeof( Datum ));
memset( &data, '\0', sizeof( Datum ));
data.dptr = NULL;
}
}
......@@ -263,7 +263,7 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize )
#elif DB_VERSION_MAJOR >= 2
DB_INFO dbinfo;
memset( &dbinfo, 0, sizeof( dbinfo ));
memset( &dbinfo, '\0', sizeof( dbinfo ));
#if defined( DB_VERSION_MAJOR ) && defined( DB_VERSION_MINOR ) && \
DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 4
......
......@@ -436,7 +436,7 @@ add_decomp(unsigned long code)
decomps = (_decomp_t *)
realloc((char *) decomps,
sizeof(_decomp_t) * (decomps_size + 8));
(void) memset((char *) (decomps + decomps_size), 0,
(void) memset((char *) (decomps + decomps_size), '\0',
sizeof(_decomp_t) << 3);
decomps_size += 8;
}
......
......@@ -1077,7 +1077,7 @@ _ure_make_symbol(ucs2_t *sym, unsigned long limit, unsigned long *consumed,
* Build the next symbol so we can test to see if it is already in the
* symbol table.
*/
(void) memset((char *) &symbol, 0, sizeof(_ure_symtab_t));
(void) memset((char *) &symbol, '\0', sizeof(_ure_symtab_t));
*consumed = _ure_compile_symbol(sym, limit, &symbol, b);
/*
......@@ -1108,7 +1108,7 @@ _ure_make_symbol(ucs2_t *sym, unsigned long limit, unsigned long *consumed,
realloc((char *) b->symtab,
sizeof(_ure_symtab_t) * (b->symtab_size + 8));
sp = b->symtab + b->symtab_size;
(void) memset((char *) sp, 0, sizeof(_ure_symtab_t) << 3);
(void) memset((char *) sp, '\0', sizeof(_ure_symtab_t) << 3);
b->symtab_size += 8;
}
......@@ -1329,7 +1329,7 @@ _ure_add_state(ucs2_t nstates, ucs2_t *states, _ure_buffer_t *b)
realloc((char *) b->states.states,
sizeof(_ure_state_t) * (b->states.states_size + 8));
sp = b->states.states + b->states.states_size;
(void) memset((char *) sp, 0, sizeof(_ure_state_t) << 3);
(void) memset((char *) sp, '\0', sizeof(_ure_state_t) << 3);
b->states.states_size += 8;
}
......@@ -1734,7 +1734,7 @@ ure_compile(ucs2_t *re, unsigned long relen, int casefold, ure_buffer_t buf)
* Construct the minimal DFA.
*/
dfa = (ure_dfa_t) malloc(sizeof(_ure_dfa_t));
(void) memset((char *) dfa, 0, sizeof(_ure_dfa_t));
(void) memset((char *) dfa, '\0', sizeof(_ure_dfa_t));
dfa->flags = buf->flags & (_URE_DFA_CASEFOLD|_URE_DFA_BLANKLINE);
......
......@@ -223,7 +223,7 @@ utbm_create_pattern(void)
utbm_pattern_t p;
p = (utbm_pattern_t) malloc(sizeof(_utbm_pattern_t));
(void) memset((char *) p, 0, sizeof(_utbm_pattern_t));
(void) memset((char *) p, '\0', sizeof(_utbm_pattern_t));
return p;
}
......
......@@ -79,7 +79,7 @@ int lutil_unlockf ( int fd ) {
int lutil_lockf ( int fd ) {
struct flock file_lock;
memset( &file_lock, 0, sizeof( file_lock ) );
memset( &file_lock, '\0', sizeof( file_lock ) );
file_lock.l_type = F_WRLCK;
file_lock.l_whence = SEEK_SET;
file_lock.l_start = 0;
......@@ -92,7 +92,7 @@ int lutil_lockf ( int fd ) {
int lutil_unlockf ( int fd ) {
struct flock file_lock;
memset( &file_lock, 0, sizeof( file_lock ) );
memset( &file_lock, '\0', sizeof( file_lock ) );
file_lock.l_type = F_UNLCK;
file_lock.l_whence = SEEK_SET;
file_lock.l_start = 0;
......
......@@ -157,14 +157,14 @@ lutil_MD5Final( unsigned char *digest, struct lutil_MD5Context *ctx )
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
memset(p, '\0', count);
lutil_MD5Transform(ctx->buf, ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
memset(ctx->in, '\0', 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count-8);
memset(p, '\0', count-8);
}
/* Append length in bits and transform */
......@@ -176,7 +176,7 @@ lutil_MD5Final( unsigned char *digest, struct lutil_MD5Context *ctx )
putu32(ctx->buf[1], digest + 4);
putu32(ctx->buf[2], digest + 8);
putu32(ctx->buf[3], digest + 12);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
memset(ctx, '\0', sizeof(ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
......
......@@ -33,7 +33,7 @@ int lutil_pair( LBER_SOCKET_T sds[2] )
if ( sd == AC_SOCKET_INVALID )
return sd;
(void) memset( (void*) &si, 0, len );
(void) memset( (void*) &si, '\0', len );
si.sin_family = AF_INET;
si.sin_port = 0;
si.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment