trivial: avoid -Wshadow

jklimes: read vs. read(3), use 'num' instead
This commit is contained in:
Pavel Šimerda
2013-04-15 13:40:14 +02:00
committed by Jiří Klimeš
parent 5cc26c60ef
commit b292af8e1d

View File

@@ -253,18 +253,18 @@ nmc_get_user_input (const char *ask_str)
{ {
char *line = NULL; char *line = NULL;
size_t line_ln = 0; size_t line_ln = 0;
ssize_t read; ssize_t num;
fprintf (stdout, "%s", ask_str); fprintf (stdout, "%s", ask_str);
read = getline (&line, &line_ln, stdin); num = getline (&line, &line_ln, stdin);
/* Remove newline from the string */ /* Remove newline from the string */
if (read < 1 || (read == 1 && line[0] == '\n')) { if (num < 1 || (num == 1 && line[0] == '\n')) {
g_free (line); g_free (line);
line = NULL; line = NULL;
} else { } else {
if (line[read-1] == '\n') if (line[num-1] == '\n')
line[read-1] = '\0'; line[num-1] = '\0';
} }
return line; return line;