src: include primary header first

This is a common practice in C projects, which simply enforces that
each header must compile cleanly without implicit dependencies on
other headers (see also the previous commit).
This commit is contained in:
John Lindgren 2025-07-28 01:02:01 -04:00 committed by Johan Malm
parent c9b576982d
commit 31d42b50e2
74 changed files with 74 additions and 72 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <assert.h>
#include "common/box.h"
#include <assert.h>
#include "common/macros.h"
bool

View file

@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/buf.h"
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "common/buf.h"
#include "common/macros.h"
#include "common/mem.h"
#include "common/string-helpers.h"

View file

@ -4,13 +4,13 @@
*
* Copyright Johan Malm 2020
*/
#include "common/dir.h"
#include <assert.h>
#include <glib.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "common/dir.h"
#include "common/buf.h"
#include "common/list.h"
#include "common/mem.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/direction.h"
#include <assert.h>
#include <wlr/types/wlr_output_layout.h>
#include "common/direction.h"
#include "view.h"
enum wlr_direction

View file

@ -1,11 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/fd-util.h"
#include <sys/resource.h>
#include <wlr/util/log.h>
#include "common/fd-util.h"
static struct rlimit original_nofile_rlimit = {0};
void

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <sys/stat.h>
#include "common/file-helpers.h"
#include <sys/stat.h>
bool
file_exists(const char *filename)

View file

@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/font.h"
#include <cairo.h>
#include <drm_fourcc.h>
#include <pango/pangocairo.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/util/box.h>
#include <wlr/util/log.h>
#include "common/font.h"
#include "common/graphic-helpers.h"
#include "common/string-helpers.h"
#include "labwc.h"

View file

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/graphic-helpers.h"
#include <cairo.h>
#include <glib.h> /* g_ascii_strcasecmp */
#include <wlr/types/wlr_scene.h>
#include "common/graphic-helpers.h"
#include "common/macros.h"
#include "xcolor-table.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/lab-scene-rect.h"
#include <assert.h>
#include <wlr/types/wlr_scene.h>
#include "common/lab-scene-rect.h"
#include "common/mem.h"
struct border_scene {

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <fnmatch.h>
#include "common/match.h"
#include <fnmatch.h>
bool
match_glob(const char *pattern, const char *string)

View file

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/mem.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "common/mem.h"
static void
die_if_null(void *ptr)

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/nodename.h"
#include <ctype.h>
#include <string.h>
#include "common/nodename.h"
char *
nodename(xmlNode *node, char *buf, int len)

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/parse-bool.h"
#include <strings.h>
#include <wlr/util/log.h>
#include "common/parse-bool.h"
enum three_state
parse_three_state(const char *str)

View file

@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/parse-double.h"
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <wlr/util/log.h>
#include "common/mem.h"
#include "common/parse-double.h"
struct dec_separator {
int index;

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/scaled-font-buffer.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@ -10,7 +11,6 @@
#include "common/graphic-helpers.h"
#include "common/mem.h"
#include "common/scaled-scene-buffer.h"
#include "common/scaled-font-buffer.h"
#include "common/string-helpers.h"
static struct lab_data_buffer *

View file

@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/scaled-icon-buffer.h"
#include <assert.h>
#include <string.h>
#include <wlr/util/log.h>
#include "buffer.h"
#include "common/macros.h"
#include "common/mem.h"
#include "common/scaled-icon-buffer.h"
#include "common/scaled-scene-buffer.h"
#include "common/string-helpers.h"
#include "config.h"

View file

@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/scaled-img-buffer.h"
#include <assert.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_scene.h>
#include "buffer.h"
#include "common/mem.h"
#include "common/scaled-img-buffer.h"
#include "common/scaled-scene-buffer.h"
#include "img/img.h"
#include "node.h"

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/scaled-scene-buffer.h"
#include <assert.h>
#include <stdlib.h>
#include <wayland-server-core.h>
@ -11,7 +12,6 @@
#include "common/list.h"
#include "common/macros.h"
#include "common/mem.h"
#include "common/scaled-scene-buffer.h"
#include "node.h"
/*

View file

@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/scene-helpers.h"
#include <assert.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/util/log.h>
#include <wlr/util/region.h>
#include <wlr/util/transform.h>
#include "common/scene-helpers.h"
#include "labwc.h"
#include "magnifier.h"
#include "output-state.h"

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <wlr/util/log.h>
#include "common/set.h"
#include <wlr/util/log.h>
bool
lab_set_contains(struct lab_set *set, uint32_t value)

View file

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#define _POSIX_C_SOURCE 200809L
#include "common/spawn.h"
#include <assert.h>
#include <fcntl.h>
#include <glib.h>
@ -9,7 +10,6 @@
#include <sys/wait.h>
#include <unistd.h>
#include <wlr/util/log.h>
#include "common/spawn.h"
#include "common/fd-util.h"
static void

View file

@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/string-helpers.h"
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
@ -7,7 +8,6 @@
#include <string.h>
#include <strings.h>
#include "common/mem.h"
#include "common/string-helpers.h"
enum str_flags {
STR_FLAG_NONE = 0,

View file

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only
#include "common/surface-helpers.h"
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_subcompositor.h>
#include <wlr/util/log.h>
#include "common/surface-helpers.h"
struct wlr_layer_surface_v1 *
subsurface_parent_layer(struct wlr_surface *wlr_surface)