david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

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

View File

@ -56,11 +56,10 @@ static void _printw_handler ( struct printf_context *ctx, unsigned int c ) {
* @ret rc return status code
*/
int vw_printw ( WINDOW *win, const char *fmt, va_list varglist ) {
struct printw_context wctx = {
.win = win,
.ctx = { .handler = _printw_handler, },
};
struct printw_context wctx;
wctx.win = win;
wctx.ctx.handler = _printw_handler;
vcprintf ( &(wctx.ctx), fmt, varglist );
return OK;
}

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 );