Skip to content

Commit b0a3c4e

Browse files
committed
Update .clang-format
And reformat the existing code Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
1 parent 2b677c8 commit b0a3c4e

34 files changed

+227
-196
lines changed

.clang-format

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ BinPackArguments: true
1111
BinPackParameters: true
1212
#ReflowComments: true
1313
AlignTrailingComments: true
14+
AlignConsecutiveMacros: true
1415
SpacesBeforeTrailingComments: 8
1516
SpaceBeforeAssignmentOperators: true
1617
SpaceBeforeParens: ControlStatements
1718
AllowShortIfStatementsOnASingleLine: false
1819
AllowShortCaseLabelsOnASingleLine: true
1920
AllowShortFunctionsOnASingleLine: false
2021
IndentCaseLabels: false
21-
IndentPPDirectives: None
22+
IndentPPDirectives: AfterHash
2223
PenaltyReturnTypeOnItsOwnLine: 0
2324
PenaltyBreakAssignment: 0
2425
PenaltyBreakBeforeFirstCallParameter: 1

src/atom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include "atom.h"
55
#include "common.h"
6-
#include "utils.h"
76
#include "log.h"
7+
#include "utils.h"
88

99
static inline void *atom_getter(void *ud, const char *atom_name, int *err) {
1010
xcb_connection_t *c = ud;

src/atom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <xcb/xcb.h>
55

6-
#include "meta.h"
76
#include "cache.h"
7+
#include "meta.h"
88

99
// clang-format off
1010
// Splitted into 2 lists because of the limitation of our macros

src/backend/backend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#include <stdbool.h>
77

8-
#include "config.h"
98
#include "compiler.h"
9+
#include "config.h"
1010
#include "driver.h"
1111
#include "kernel.h"
1212
#include "region.h"

src/backend/driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ struct backend_base;
1919
/// also the generic modesetting driver.
2020
/// This enum represents _both_ drivers.
2121
enum driver {
22-
DRIVER_AMDGPU = 1, // AMDGPU for DDX, radeonsi for OpenGL
23-
DRIVER_RADEON = 2, // ATI for DDX, mesa r600 for OpenGL
22+
DRIVER_AMDGPU = 1, // AMDGPU for DDX, radeonsi for OpenGL
23+
DRIVER_RADEON = 2, // ATI for DDX, mesa r600 for OpenGL
2424
DRIVER_FGLRX = 4,
2525
DRIVER_NVIDIA = 8,
2626
DRIVER_NOUVEAU = 16,

src/backend/gl/gl_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "backend/gl/gl_common.h"
2424

2525
#define GLSL(version, ...) "#version " #version "\n" #__VA_ARGS__
26-
#define QUOTE(...) #__VA_ARGS__
26+
#define QUOTE(...) #__VA_ARGS__
2727

2828
static const GLuint vert_coord_loc = 0;
2929
static const GLuint vert_in_texcoord_loc = 1;

src/backend/gl/glx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#include "backend/gl/glx.h"
2727
#include "common.h"
2828
#include "compiler.h"
29-
#include "picom.h"
3029
#include "config.h"
3130
#include "log.h"
31+
#include "picom.h"
3232
#include "region.h"
3333
#include "utils.h"
3434
#include "win.h"

src/backend/gl/glx.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
#include <stdbool.h>
55
// Older version of glx.h defines function prototypes for these extensions...
66
// Rename them to avoid conflicts
7-
#define glXSwapIntervalMESA glXSwapIntervalMESA_
8-
#define glXBindTexImageEXT glXBindTexImageEXT_
7+
#define glXSwapIntervalMESA glXSwapIntervalMESA_
8+
#define glXBindTexImageEXT glXBindTexImageEXT_
99
#define glXReleaseTexImageEXT glXReleaseTexImageEXT
1010
#include <GL/glx.h>
1111
#undef glXSwapIntervalMESA
1212
#undef glXBindTexImageEXT
1313
#undef glXReleaseTexImageEXT
1414
#include <X11/Xlib.h>
15-
#include <xcb/xcb.h>
1615
#include <xcb/render.h>
16+
#include <xcb/xcb.h>
1717

18-
#include "log.h"
1918
#include "compiler.h"
19+
#include "log.h"
2020
#include "utils.h"
2121
#include "x.h"
2222

@@ -43,7 +43,6 @@ struct glx_fbconfig_criteria {
4343

4444
struct glx_fbconfig_info *glx_find_fbconfig(Display *, int screen, struct xvisual_info);
4545

46-
4746
struct glxext_info {
4847
bool initialized;
4948
bool has_GLX_SGI_video_sync;

src/c2.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
// libpcre
1919
#ifdef CONFIG_REGEX_PCRE
20-
#include <pcre.h>
20+
# include <pcre.h>
2121

2222
// For compatibility with <libpcre-8.20
23-
#ifndef PCRE_STUDY_JIT_COMPILE
24-
#define PCRE_STUDY_JIT_COMPILE 0
25-
#define LPCRE_FREE_STUDY(extra) pcre_free(extra)
26-
#else
27-
#define LPCRE_FREE_STUDY(extra) pcre_free_study(extra)
28-
#endif
23+
# ifndef PCRE_STUDY_JIT_COMPILE
24+
# define PCRE_STUDY_JIT_COMPILE 0
25+
# define LPCRE_FREE_STUDY(extra) pcre_free(extra)
26+
# else
27+
# define LPCRE_FREE_STUDY(extra) pcre_free_study(extra)
28+
# endif
2929

3030
#endif
3131

@@ -1060,14 +1060,14 @@ static bool c2_l_postprocess(session_t *ps, c2_l_t *pleaf) {
10601060
pleaf->ptnstr, erroffset, error);
10611061
return false;
10621062
}
1063-
#ifdef CONFIG_REGEX_PCRE_JIT
1063+
# ifdef CONFIG_REGEX_PCRE_JIT
10641064
pleaf->regex_pcre_extra =
10651065
pcre_study(pleaf->regex_pcre, PCRE_STUDY_JIT_COMPILE, &error);
10661066
if (!pleaf->regex_pcre_extra) {
10671067
printf("Pattern \"%s\": PCRE regular expression study failed: %s",
10681068
pleaf->ptnstr, error);
10691069
}
1070-
#endif
1070+
# endif
10711071

10721072
// Free the target string
10731073
// free(pleaf->tgt);

src/c2.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ c2_lptr_t *c2_parse(c2_lptr_t **pcondlst, const char *pattern, void *data);
2121

2222
c2_lptr_t *c2_free_lptr(c2_lptr_t *lp);
2323

24-
bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst, void **pdata);
24+
bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst,
25+
void **pdata);
2526

2627
bool c2_list_postprocess(session_t *ps, c2_lptr_t *list);

0 commit comments

Comments
 (0)