From d0a3cc3417c0de4599ef3289b5e50cdc62bc7b89 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 5 Jan 2007 14:48:20 +0000 Subject: [PATCH] Avoid creating implicit memcpy()s --- src/hci/mucurses/print.c | 7 +++---- src/hci/readline.c | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hci/mucurses/print.c b/src/hci/mucurses/print.c index dd9e299c..fc14e67e 100644 --- a/src/hci/mucurses/print.c +++ b/src/hci/mucurses/print.c @@ -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; } diff --git a/src/hci/readline.c b/src/hci/readline.c index 4fac0986..420df648 100644 --- a/src/hci/readline.c +++ b/src/hci/readline.c @@ -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 );