Apply clang-format

This commit is contained in:
project-repo 2021-09-19 10:25:34 +02:00
commit cc4780eb71
5 changed files with 24 additions and 24 deletions

View file

@ -61,7 +61,7 @@
#define WAIT_ANY -1
#endif
bool show_info=false;
bool show_info = false;
void
set_sig_handler(int sig, void (*action)(int)) {
@ -137,7 +137,7 @@ usage(FILE *file, const char *const cage) {
#endif
" -h\t Display this help message\n"
" -v\t Show the version number and exit\n"
" -s\t Show information about the current setup and exit\n",
" -s\t Show information about the current setup and exit\n",
cage);
}
@ -168,7 +168,7 @@ parse_args(struct cg_server *server, int argc, char *argv[]) {
fprintf(stdout, "Cagebreak version " CG_VERSION "\n");
exit(0);
case 's':
show_info=true;
show_info = true;
break;
default:
usage(stderr, argv[0]);
@ -535,12 +535,12 @@ main(int argc, char *argv[]) {
#endif
if(show_info) {
char *msg=server_show_info(&server);
char *msg = server_show_info(&server);
if(msg != NULL) {
fprintf(stderr,"%s",msg);
fprintf(stderr, "%s", msg);
free(msg);
} else {
wlr_log(WLR_ERROR,"Failed to get info on cagebreak setup\n");
wlr_log(WLR_ERROR, "Failed to get info on cagebreak setup\n");
}
exit(0);
}

View file

@ -703,7 +703,7 @@ keybinding_show_time(struct cg_server *server) {
void
keybinding_show_info(struct cg_server *server) {
char *msg=server_show_info(server);
char *msg = server_show_info(server);
if(!msg) {
return;

View file

@ -8,11 +8,11 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/util/log.h>
#include "util.h"
#include "message.h"
#include "output.h"
#include "pango.h"
#include "server.h"
#include "util.h"
cairo_subpixel_order_t
to_cairo_subpixel_order(const enum wl_output_subpixel subpixel) {
@ -153,7 +153,7 @@ void
message_printf(struct cg_output *output, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
char *buffer = malloc_vsprintf_va_list(fmt,ap);
char *buffer = malloc_vsprintf_va_list(fmt, ap);
va_end(ap);
if(buffer == NULL) {
wlr_log(WLR_ERROR, "Failed to allocate buffer in message_printf");

View file

@ -9,16 +9,15 @@
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
#include "server.h"
#include "input_manager.h"
#include "output.h"
#include "server.h"
#include "util.h"
void
@ -44,29 +43,32 @@ get_mode_index_from_name(char *const *modes, const char *mode_name) {
char *
server_show_info(struct cg_server *server) {
char *output_str=strdup(""), *output_str_tmp;
char *output_str = strdup(""), *output_str_tmp;
struct cg_output *output;
wl_list_for_each(output, &server->outputs, link) {
if(!output_str) {
return NULL;
}
output_str_tmp=output_str;
output_str=malloc_vsprintf("%s\t * %s\n",output_str, output->wlr_output->name);
output_str_tmp = output_str;
output_str = malloc_vsprintf("%s\t * %s\n", output_str,
output->wlr_output->name);
free(output_str_tmp);
}
char *input_str=strdup(""), *input_str_tmp;
char *input_str = strdup(""), *input_str_tmp;
struct cg_input_device *input;
wl_list_for_each(input, &server->input->devices, link) {
if(!input_str) {
return NULL;
}
input_str_tmp=input_str;
if(strcmp(input->identifier,"") != 0) {
input_str=malloc_vsprintf("%s\t * H:%s\n",input_str, input->identifier);
input_str_tmp = input_str;
if(strcmp(input->identifier, "") != 0) {
input_str =
malloc_vsprintf("%s\t * H:%s\n", input_str, input->identifier);
}
free(input_str_tmp);
}
char *ret=malloc_vsprintf("Outputs:\n%sInputs:\n%s",output_str,input_str);
char *ret =
malloc_vsprintf("Outputs:\n%sInputs:\n%s", output_str, input_str);
free(output_str);
free(input_str);
return ret;

6
util.c
View file

@ -49,9 +49,7 @@ malloc_vsprintf_va_list(const char *fmt, va_list ap) {
char *
malloc_vsprintf(const char *fmt, ...) {
va_list args;
va_start(args,fmt);
char *ret=malloc_vsprintf_va_list(fmt,args);
va_start(args, fmt);
char *ret = malloc_vsprintf_va_list(fmt, args);
return ret;
}