Browse Source

Avoid creating implicit memcpy()s

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
d0a3cc3417
2 changed files with 8 additions and 9 deletions
  1. 3
    4
      src/hci/mucurses/print.c
  2. 5
    5
      src/hci/readline.c

+ 3
- 4
src/hci/mucurses/print.c View File

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

+ 5
- 5
src/hci/readline.c View File

@@ -80,18 +80,18 @@ static void sync_console ( struct edit_string *string ) {
80 80
  */
81 81
 char * readline ( const char *prompt ) {
82 82
 	char buf[READLINE_MAX];
83
-	struct edit_string string = {
84
-		.buf = buf,
85
-		.len = sizeof ( buf ),
86
-		.cursor = 0,
87
-	};
83
+	struct edit_string string;
88 84
 	int key;
89 85
 	char *line;
90 86
 
91 87
 	if ( prompt )
92 88
 		printf ( "%s", prompt );
93 89
 
90
+	memset ( &string, 0, sizeof ( string ) );
91
+	string.buf = buf;
92
+	string.len = sizeof ( buf );
94 93
 	buf[0] = '\0';
94
+
95 95
 	while ( 1 ) {
96 96
 		key = edit_string ( &string, getkey() );
97 97
 		sync_console ( &string );

Loading…
Cancel
Save