[PATCH libevdev 3/4] Constify libevdev_get_repeat

David Herrmann dh.herrmann at gmail.com
Thu Dec 5 09:18:25 PST 2013


Hi

On Wed, Dec 4, 2013 at 10:56 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  libevdev/libevdev.c | 2 +-
>  libevdev/libevdev.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index 2944f8f..d543dad 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -1335,7 +1335,7 @@ libevdev_event_type_get_max(unsigned int type)
>  }
>
>  LIBEVDEV_EXPORT int
> -libevdev_get_repeat(struct libevdev *dev, int *delay, int *period)
> +libevdev_get_repeat(const struct libevdev *dev, int *delay, int *period)

I really dislike the "const" on opaque structures. I only just noticed
that we do that for all read-only calls, but I cannot imagine a
situation where a user gets a read-only libevdev object. "const" makes
sense to mark read-only memory, but I've never seen a sane way to use
it for access-protection.

But I guess that's just personal taste..

Thanks
David

>  {
>         if (!libevdev_has_event_type(dev, EV_REP))
>                 return -1;
> diff --git a/libevdev/libevdev.h b/libevdev/libevdev.h
> index 23d1b32..afcf366 100644
> --- a/libevdev/libevdev.h
> +++ b/libevdev/libevdev.h
> @@ -1614,7 +1614,7 @@ int libevdev_event_code_from_name_n(unsigned int type, const char *name,
>   *
>   * @note This function is signal-safe
>   */
> -int libevdev_get_repeat(struct libevdev *dev, int *delay, int *period);
> +int libevdev_get_repeat(const struct libevdev *dev, int *delay, int *period);
>
>
>  /********* DEPRECATED SECTION *********/
> --
> 1.8.3.1
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list