Signed-off-by: Daniel Lezcano <[email protected]>
---
display.c | 7 ++-----
gpio.c | 11 ++++++-----
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);
--
1.9.1
_______________________________________________
linaro-dev mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/linaro-dev