Avoid creating implicit memcpy()s

This commit is contained in:
Michael Brown
2007-01-05 14:48:20 +00:00
parent 9780fef360
commit d0a3cc3417
2 changed files with 8 additions and 9 deletions
+5 -5
View File
@@ -80,18 +80,18 @@ static void sync_console ( struct edit_string *string ) {
*/
char * readline ( const char *prompt ) {
char buf[READLINE_MAX];
struct edit_string string = {
.buf = buf,
.len = sizeof ( buf ),
.cursor = 0,
};
struct edit_string string;
int key;
char *line;
if ( prompt )
printf ( "%s", prompt );
memset ( &string, 0, sizeof ( string ) );
string.buf = buf;
string.len = sizeof ( buf );
buf[0] = '\0';
while ( 1 ) {
key = edit_string ( &string, getkey() );
sync_console ( &string );