mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-30 11:11:05 -04:00
Merge branch 'style-mix-code-decl' into 'main'
CONTRIBUTING: Explicitly allow mixed declarations & code See merge request wayland/wayland!229
This commit is contained in:
commit
e9ff6e341e
2 changed files with 23 additions and 27 deletions
|
|
@ -139,8 +139,9 @@ try to follow the rules below.
|
||||||
- no braces in an if-body with just one statement;
|
- no braces in an if-body with just one statement;
|
||||||
- if one of the branches of an if-else condition has braces, then the
|
- if one of the branches of an if-else condition has braces, then the
|
||||||
other branch should also have braces;
|
other branch should also have braces;
|
||||||
- there is always an empty line between variable declarations and the
|
- there is always an empty line between initial variable declarations and
|
||||||
code;
|
the code;
|
||||||
|
- variable declarations may be interspersed with code
|
||||||
|
|
||||||
```c
|
```c
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
|
|
@ -252,14 +252,12 @@ wl_proxy_unref(struct wl_proxy *proxy)
|
||||||
static void
|
static void
|
||||||
validate_closure_objects(struct wl_closure *closure)
|
validate_closure_objects(struct wl_closure *closure)
|
||||||
{
|
{
|
||||||
const char *signature;
|
const char *signature = closure->message->signature;
|
||||||
struct argument_details arg;
|
int count = arg_count_for_signature(signature);
|
||||||
int i, count;
|
for (int i = 0; i < count; i++) {
|
||||||
struct wl_proxy *proxy;
|
struct wl_proxy *proxy;
|
||||||
|
struct argument_details arg;
|
||||||
|
|
||||||
signature = closure->message->signature;
|
|
||||||
count = arg_count_for_signature(signature);
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
signature = get_next_argument(signature, &arg);
|
signature = get_next_argument(signature, &arg);
|
||||||
switch (arg.type) {
|
switch (arg.type) {
|
||||||
case WL_ARG_NEW_ID:
|
case WL_ARG_NEW_ID:
|
||||||
|
|
@ -280,14 +278,13 @@ validate_closure_objects(struct wl_closure *closure)
|
||||||
static void
|
static void
|
||||||
destroy_queued_closure(struct wl_closure *closure)
|
destroy_queued_closure(struct wl_closure *closure)
|
||||||
{
|
{
|
||||||
const char *signature;
|
const char *signature = closure->message->signature;
|
||||||
struct argument_details arg;
|
int count = arg_count_for_signature(signature);
|
||||||
struct wl_proxy *proxy;
|
|
||||||
int i, count;
|
for (int i = 0; i < count; i++) {
|
||||||
|
struct wl_proxy *proxy;
|
||||||
|
struct argument_details arg;
|
||||||
|
|
||||||
signature = closure->message->signature;
|
|
||||||
count = arg_count_for_signature(signature);
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
signature = get_next_argument(signature, &arg);
|
signature = get_next_argument(signature, &arg);
|
||||||
switch (arg.type) {
|
switch (arg.type) {
|
||||||
case WL_ARG_NEW_ID:
|
case WL_ARG_NEW_ID:
|
||||||
|
|
@ -419,11 +416,11 @@ wl_display_create_queue_with_name(struct wl_display *display, const char *name)
|
||||||
static int
|
static int
|
||||||
message_count_fds(const char *signature)
|
message_count_fds(const char *signature)
|
||||||
{
|
{
|
||||||
unsigned int count, i, fds = 0;
|
unsigned int fds = 0;
|
||||||
struct argument_details arg;
|
|
||||||
|
|
||||||
count = arg_count_for_signature(signature);
|
unsigned int count = arg_count_for_signature(signature);
|
||||||
for (i = 0; i < count; i++) {
|
for (unsigned int i = 0; i < count; i++) {
|
||||||
|
struct argument_details arg;
|
||||||
signature = get_next_argument(signature, &arg);
|
signature = get_next_argument(signature, &arg);
|
||||||
if (arg.type == WL_ARG_FD)
|
if (arg.type == WL_ARG_FD)
|
||||||
fds++;
|
fds++;
|
||||||
|
|
@ -899,14 +896,13 @@ wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
|
||||||
const struct wl_interface *interface, uint32_t version,
|
const struct wl_interface *interface, uint32_t version,
|
||||||
uint32_t flags, union wl_argument *args)
|
uint32_t flags, union wl_argument *args)
|
||||||
{
|
{
|
||||||
struct wl_closure *closure;
|
|
||||||
struct wl_proxy *new_proxy = NULL;
|
struct wl_proxy *new_proxy = NULL;
|
||||||
const struct wl_message *message;
|
|
||||||
struct wl_display *disp = proxy->display;
|
struct wl_display *disp = proxy->display;
|
||||||
|
|
||||||
pthread_mutex_lock(&disp->mutex);
|
pthread_mutex_lock(&disp->mutex);
|
||||||
|
|
||||||
message = &proxy->object.interface->methods[opcode];
|
const struct wl_message *message =
|
||||||
|
&proxy->object.interface->methods[opcode];
|
||||||
if (interface) {
|
if (interface) {
|
||||||
new_proxy = create_outgoing_proxy(proxy, message,
|
new_proxy = create_outgoing_proxy(proxy, message,
|
||||||
args, interface,
|
args, interface,
|
||||||
|
|
@ -919,7 +915,8 @@ wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
|
||||||
goto err_unlock;
|
goto err_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
closure = wl_closure_marshal(&proxy->object, opcode, args, message);
|
struct wl_closure *closure =
|
||||||
|
wl_closure_marshal(&proxy->object, opcode, args, message);
|
||||||
if (closure == NULL) {
|
if (closure == NULL) {
|
||||||
wl_log("Error marshalling request for %s.%s: %s\n",
|
wl_log("Error marshalling request for %s.%s: %s\n",
|
||||||
proxy->object.interface->name, message->name,
|
proxy->object.interface->name, message->name,
|
||||||
|
|
@ -1120,11 +1117,9 @@ display_handle_error(void *data,
|
||||||
static void
|
static void
|
||||||
display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
|
display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
|
||||||
{
|
{
|
||||||
struct wl_proxy *proxy;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&display->mutex);
|
pthread_mutex_lock(&display->mutex);
|
||||||
|
|
||||||
proxy = wl_map_lookup(&display->objects, id);
|
struct wl_proxy *proxy = wl_map_lookup(&display->objects, id);
|
||||||
|
|
||||||
if (wl_object_is_zombie(&display->objects, id)) {
|
if (wl_object_is_zombie(&display->objects, id)) {
|
||||||
/* For zombie objects, the 'proxy' is actually the zombie
|
/* For zombie objects, the 'proxy' is actually the zombie
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue