On Sat, Apr 18, 2020 at 5:04 PM <[email protected]> wrote:

> commit a4faed60e37174f43dce47e099a8b55b1f1a5556
> Author:     Jochen Sprickerhof <[email protected]>
> AuthorDate: Fri Apr 17 23:33:34 2020 +0200
> Commit:     Jochen Sprickerhof <[email protected]>
> CommitDate: Fri Apr 17 23:33:34 2020 +0200
>
>     Catch invalid cursor positions
>
> diff --git a/scroll.c b/scroll.c
> index 25bd3fc..09a2c3e 100644
> --- a/scroll.c
> +++ b/scroll.c
> @@ -232,6 +232,9 @@ getcursorposition(int *x, int *y)
>
>         if (sscanf(input, "\033[%d;%dR", x, y) != 2)
>                 die("parsing cursor position");
> +
> +       if (x <= 0 || y <= 0)
> +               die("invalid cursor position");
>  }
>
>  void
>
>
gcc emits this warning when using the "-Wextra" option.  Should x and y be
dereferenced?

scroll.c: In function ‘getcursorposition’:
scroll.c:236:8: warning: ordered comparison of pointer with integer zero
[-Wextra]
  236 |  if (x <= 0 || y <= 0)
      |        ^~
scroll.c:236:18: warning: ordered comparison of pointer with integer zero
[-Wextra]
  236 |  if (x <= 0 || y <= 0)
      |                  ^~

Reply via email to