aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2016-02-18 13:49:55 +0000
committerDaniel Lezcano <daniel.lezcano@linaro.org>2016-02-18 15:25:27 +0000
commit83b28d0ed342a549e62cac1c2f51d69063c0c868 (patch)
tree2f97d5ed502094c48d9de4566754abe2b056a7ed
parent9db095c532d5cbb60142d4d9941a67f5556cd425 (diff)
Fix compilation warnings.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--display.c7
-rw-r--r--gpio.c11
2 files changed, 8 insertions, 10 deletions
diff --git a/display.c b/display.c
index 0000ee9..1114366 100644
--- a/display.c
+++ b/display.c
@@ -198,13 +198,13 @@ static int display_prev_panel(void)
static int display_next_line(void)
{
- int maxx, maxy;
+ int maxy;
int cursor = windata[current_win].cursor;
int nrdata = windata[current_win].nrdata;
int scrolling = windata[current_win].scrolling;
struct rowdata *rowdata = windata[current_win].rowdata;
- getmaxyx(stdscr, maxy, maxx);
+ maxy = getmaxy(stdscr);
if (cursor >= nrdata)
return cursor;
@@ -320,9 +320,6 @@ struct find_data *display_find_init(void)
const size_t len = 64;
regex_t *reg;
char *search4;
- int maxx, maxy;
-
- getmaxyx(stdscr, maxy, maxx);
reg = malloc(sizeof(*reg));
if (!reg)
diff --git a/gpio.c b/gpio.c
index 3c02b8e..7b5bbb2 100644
--- a/gpio.c
+++ b/gpio.c
@@ -325,12 +325,13 @@ void export_free_gpios(void)
FILE *fgpio, *fgpio_export;
int i, gpio_max = 0;
char *line = NULL;
- ssize_t read, len = 0;
+ ssize_t read;
+ size_t len = 0;
fgpio = fopen("/sys/kernel/debug/gpio", "r");
if (!fgpio) {
printf("failed to read debugfs gpio file\n");
- goto out;
+ return;
}
fgpio_export = fopen("/sys/class/gpio/export", "w");
@@ -342,7 +343,7 @@ void export_free_gpios(void)
/* export the gpios */
while ((read = getline(&line, &len, fgpio)) != -1) {
if (strstr(line, "GPIOs"))
- sscanf(line, "%*[^-]-%d%*", &gpio_max);
+ sscanf(line, "%*[^-]-%d", &gpio_max);
}
printf("log: total gpios = %d\n", gpio_max);
@@ -355,10 +356,10 @@ void export_free_gpios(void)
}
free(line);
-out:
+
if (fgpio)
fclose(fgpio);
-
+out:
if (fgpio_export)
fclose(fgpio_export);