[PATCH wayland] cosmetic: convert some function returns from int to bool

Pekka Paalanen ppaalanen at gmail.com
Tue Nov 4 03:05:59 PST 2014


On Fri,  3 Oct 2014 14:39:59 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> ---
>  src/scanner.c     | 5 +++--
>  src/wayland-shm.c | 9 +++++----
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/src/scanner.c b/src/scanner.c
> index 809130b..dc113f5 100644
> --- a/src/scanner.c
> +++ b/src/scanner.c
> @@ -21,6 +21,7 @@
>   * OF THIS SOFTWARE.
>   */
>  
> +#include <stdbool.h>
>  #include <stdio.h>
>  #include <stdarg.h>
>  #include <string.h>
> @@ -297,9 +298,9 @@ is_nullable_type(struct arg *arg)

I amended: changed the return type here to 'bool'. :-)


Pushed, thanks,
pq

>  	case OBJECT:
>  	case NEW_ID:
>  	case ARRAY:
> -		return 1;
> +		return true;
>  	default:
> -		return 0;
> +		return false;
>  	}
>  }
>  
> diff --git a/src/wayland-shm.c b/src/wayland-shm.c
> index 04ba4f2..b6b31d6 100644
> --- a/src/wayland-shm.c
> +++ b/src/wayland-shm.c
> @@ -27,6 +27,7 @@
>  
>  #define _GNU_SOURCE
>  
> +#include <stdbool.h>
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> @@ -99,7 +100,7 @@ static const struct wl_buffer_interface shm_buffer_interface = {
>  	shm_buffer_destroy
>  };
>  
> -static int
> +static bool
>  format_is_supported(struct wl_client *client, uint32_t format)
>  {
>  	struct wl_display *display = wl_client_get_display(client);
> @@ -109,15 +110,15 @@ format_is_supported(struct wl_client *client, uint32_t format)
>  	switch (format) {
>  	case WL_SHM_FORMAT_ARGB8888:
>  	case WL_SHM_FORMAT_XRGB8888:
> -		return 1;
> +		return true;
>  	default:
>  		formats = wl_display_get_additional_shm_formats(display);
>  		wl_array_for_each(p, formats)
>  			if(*p == format)
> -				return 1;
> +				return true;
>  	}
>  
> -	return 0;
> +	return false;
>  }
>  
>  static void



More information about the wayland-devel mailing list