cosmetic: replace boolean function return values with bool
For functions that test if something is true/valid and return a 1 or 0, it makes sense to switch to bool. Reviewed-by: Bryce Harrington <b.harrington@samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
4c582666dd
commit
280e7dd918
+5
-5
@@ -83,16 +83,16 @@ colord_idle_cancel_for_output(struct cms_colord *cms, struct weston_output *o)
|
|||||||
g_mutex_unlock(&cms->pending_mutex);
|
g_mutex_unlock(&cms->pending_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
edid_value_valid(const char *str)
|
edid_value_valid(const char *str)
|
||||||
{
|
{
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return 0;
|
return false;
|
||||||
if (str[0] == '\0')
|
if (str[0] == '\0')
|
||||||
return 0;
|
return false;
|
||||||
if (strcmp(str, "unknown") == 0)
|
if (strcmp(str, "unknown") == 0)
|
||||||
return 0;
|
return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
|
|||||||
+10
-10
@@ -1370,22 +1370,22 @@ weston_view_set_transform_parent(struct weston_view *view,
|
|||||||
weston_view_geometry_dirty(view);
|
weston_view_geometry_dirty(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT int
|
WL_EXPORT bool
|
||||||
weston_view_is_mapped(struct weston_view *view)
|
weston_view_is_mapped(struct weston_view *view)
|
||||||
{
|
{
|
||||||
if (view->output)
|
if (view->output)
|
||||||
return 1;
|
return true;
|
||||||
else
|
else
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT int
|
WL_EXPORT bool
|
||||||
weston_surface_is_mapped(struct weston_surface *surface)
|
weston_surface_is_mapped(struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
if (surface->output)
|
if (surface->output)
|
||||||
return 1;
|
return true;
|
||||||
else
|
else
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2626,20 +2626,20 @@ weston_subsurface_commit_to_cache(struct weston_subsurface *sub)
|
|||||||
sub->has_cached_data = 1;
|
sub->has_cached_data = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
weston_subsurface_is_synchronized(struct weston_subsurface *sub)
|
weston_subsurface_is_synchronized(struct weston_subsurface *sub)
|
||||||
{
|
{
|
||||||
while (sub) {
|
while (sub) {
|
||||||
if (sub->synchronized)
|
if (sub->synchronized)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (!sub->parent)
|
if (!sub->parent)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
sub = weston_surface_to_subsurface(sub->parent);
|
sub = weston_surface_to_subsurface(sub->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+3
-2
@@ -28,6 +28,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
@@ -1206,13 +1207,13 @@ void
|
|||||||
weston_view_set_transform_parent(struct weston_view *view,
|
weston_view_set_transform_parent(struct weston_view *view,
|
||||||
struct weston_view *parent);
|
struct weston_view *parent);
|
||||||
|
|
||||||
int
|
bool
|
||||||
weston_view_is_mapped(struct weston_view *view);
|
weston_view_is_mapped(struct weston_view *view);
|
||||||
|
|
||||||
void
|
void
|
||||||
weston_view_schedule_repaint(struct weston_view *view);
|
weston_view_schedule_repaint(struct weston_view *view);
|
||||||
|
|
||||||
int
|
bool
|
||||||
weston_surface_is_mapped(struct weston_surface *surface);
|
weston_surface_is_mapped(struct weston_surface *surface);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+4
-4
@@ -1732,7 +1732,7 @@ static const struct wl_keyboard_interface keyboard_interface = {
|
|||||||
keyboard_release
|
keyboard_release
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
should_send_modifiers_to_client(struct weston_seat *seat,
|
should_send_modifiers_to_client(struct weston_seat *seat,
|
||||||
struct wl_client *client)
|
struct wl_client *client)
|
||||||
{
|
{
|
||||||
@@ -1740,15 +1740,15 @@ should_send_modifiers_to_client(struct weston_seat *seat,
|
|||||||
seat->keyboard->focus &&
|
seat->keyboard->focus &&
|
||||||
seat->keyboard->focus->resource &&
|
seat->keyboard->focus->resource &&
|
||||||
wl_resource_get_client(seat->keyboard->focus->resource) == client)
|
wl_resource_get_client(seat->keyboard->focus->resource) == client)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
if (seat->pointer &&
|
if (seat->pointer &&
|
||||||
seat->pointer->focus &&
|
seat->pointer->focus &&
|
||||||
seat->pointer->focus->surface->resource &&
|
seat->pointer->focus->surface->resource &&
|
||||||
wl_resource_get_client(seat->pointer->focus->surface->resource) == client)
|
wl_resource_get_client(seat->pointer->focus->surface->resource) == client)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+6
-5
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -133,7 +134,7 @@ read_groups(void)
|
|||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
weston_launch_allowed(struct weston_launch *wl)
|
weston_launch_allowed(struct weston_launch *wl)
|
||||||
{
|
{
|
||||||
struct group *gr;
|
struct group *gr;
|
||||||
@@ -145,7 +146,7 @@ weston_launch_allowed(struct weston_launch *wl)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getuid() == 0)
|
if (getuid() == 0)
|
||||||
return 1;
|
return true;
|
||||||
|
|
||||||
gr = getgrnam("weston-launch");
|
gr = getgrnam("weston-launch");
|
||||||
if (gr) {
|
if (gr) {
|
||||||
@@ -154,7 +155,7 @@ weston_launch_allowed(struct weston_launch *wl)
|
|||||||
for (i = 0; groups[i]; ++i) {
|
for (i = 0; groups[i]; ++i) {
|
||||||
if (groups[i] == gr->gr_gid) {
|
if (groups[i] == gr->gr_gid) {
|
||||||
free(groups);
|
free(groups);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(groups);
|
free(groups);
|
||||||
@@ -168,13 +169,13 @@ weston_launch_allowed(struct weston_launch *wl)
|
|||||||
sd_session_get_seat(session, &seat) == 0) {
|
sd_session_get_seat(session, &seat) == 0) {
|
||||||
free(seat);
|
free(seat);
|
||||||
free(session);
|
free(session);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
free(session);
|
free(session);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user