refactor(peachmsg): migrate to nullptr, -std=c23; docs: update C references to C23
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ PeachWM follows a consistent style throughout the codebase. Please match it.
|
||||
|
||||
### Build and Compiler
|
||||
|
||||
- The project uses **C11** (`-std=c11`).
|
||||
- The project uses **C23** (`-std=c23`).
|
||||
- The **Makefile** is POSIX make. Do not introduce autotools, CMake, or meson.
|
||||
- Ensure your code compiles cleanly with `make debug` and `make release` --
|
||||
CI checks both targets.
|
||||
|
||||
@@ -40,7 +40,7 @@ CFLAGS = `$(PKG_CONFIG) --cflags $(PKGS) wlroots-0.20` \
|
||||
$(XWAYLAND) -g -Wall -Wextra -Wno-unused-parameter -O2 -std=c23
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS) wlroots-0.20` -lm $(LIBS)
|
||||
|
||||
SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter
|
||||
SMSG_CFLAGS = `$(PKG_CONFIG) --cflags wayland-client` -Wall -Wextra -Wno-unused-parameter -std=c23
|
||||
SMSG_LDLIBS = `$(PKG_CONFIG) --libs wayland-client`
|
||||
|
||||
SCANNER = $(shell $(PKG_CONFIG) --variable=wayland_scanner wayland-scanner)
|
||||
|
||||
@@ -33,7 +33,7 @@ PeachWM is maintained by [HuntedByTheIRS](https://github.com/HuntedByTheIRS).
|
||||
- xkbcommon
|
||||
- wayland-protocols (compile-time only)
|
||||
- pkg-config (compile-time only)
|
||||
- a C compiler (clang recommended)
|
||||
- a C23 compiler — GCC 14+ or Clang 18+ (clang recommended)
|
||||
|
||||
Install these (and their `-devel` versions if your distro has separate
|
||||
development packages) and run `make` followed by `doas/sudo make install`,
|
||||
|
||||
+2
-2
@@ -41,13 +41,13 @@ extern char *argv0;
|
||||
|
||||
#define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX))
|
||||
|
||||
#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
|
||||
#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == nullptr)?\
|
||||
((x), abort(), (char *)0) :\
|
||||
(brk_ = 1, (argv[0][1] != '\0')?\
|
||||
(&argv[0][1]) :\
|
||||
(argc--, argv++, argv[0])))
|
||||
|
||||
#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
|
||||
#define ARGF() ((argv[0][1] == '\0' && argv[1] == nullptr)?\
|
||||
(char *)0 :\
|
||||
(brk_ = 1, (argv[0][1] != '\0')?\
|
||||
(&argv[0][1]) :\
|
||||
|
||||
+6
-6
@@ -98,7 +98,7 @@ peachwm_ipc_output_active(void *data, struct zpeachwm_ipc_output_v2 *peachwm_ipc
|
||||
}
|
||||
if (active) {
|
||||
free(focused_output);
|
||||
focused_output = NULL;
|
||||
focused_output = nullptr;
|
||||
if (data) {
|
||||
focused_output = strdup(data);
|
||||
if (!focused_output)
|
||||
@@ -309,7 +309,7 @@ wl_output_name(void *data, struct wl_output *output, const char *name)
|
||||
struct zpeachwm_ipc_output_v2 *peachwm_ipc_output =
|
||||
zpeachwm_ipc_manager_v2_get_output(peachwm_ipc_manager, output);
|
||||
zpeachwm_ipc_output_v2_add_listener(peachwm_ipc_output, &peachwm_ipc_output_listener,
|
||||
output_name && *output_name ? NULL : strdup(name));
|
||||
output_name && *output_name ? nullptr : strdup(name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ global_add(void *data, struct wl_registry *wl_registry,
|
||||
struct wl_output *o = wl_registry_bind(
|
||||
wl_registry, name, &wl_output_interface,
|
||||
WL_OUTPUT_NAME_SINCE_VERSION);
|
||||
wl_output_add_listener(o, &output_listener, outputs ? &outputs[outputcount] : NULL);
|
||||
wl_output_add_listener(o, &output_listener, outputs ? &outputs[outputcount] : nullptr);
|
||||
if (!outputs) return;
|
||||
if (outputcount >= outputs_buflen) {
|
||||
outputs_buflen *= 2;
|
||||
@@ -370,7 +370,7 @@ global_add(void *data, struct wl_registry *wl_registry,
|
||||
} else if (strcmp(interface, zpeachwm_ipc_manager_v2_interface.name) == 0) {
|
||||
peachwm_ipc_manager = wl_registry_bind(wl_registry, name,
|
||||
&zpeachwm_ipc_manager_v2_interface, version < 2 ? version : 2);
|
||||
zpeachwm_ipc_manager_v2_add_listener(peachwm_ipc_manager, &peachwm_ipc_listener, NULL);
|
||||
zpeachwm_ipc_manager_v2_add_listener(peachwm_ipc_manager, &peachwm_ipc_listener, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ main(int argc, char *argv[])
|
||||
if (mode & GET && !(oflag || tflag || lflag || Oflag || Tflag || Lflag || Pflag || Fflag || cflag || vflag || mflag || fflag))
|
||||
oflag = tflag = lflag = cflag = vflag = mflag = fflag = Fflag = 1;
|
||||
|
||||
display = wl_display_connect(NULL);
|
||||
display = wl_display_connect(nullptr);
|
||||
if (!display) die("bad display");
|
||||
|
||||
if (Pflag) {
|
||||
@@ -519,7 +519,7 @@ main(int argc, char *argv[])
|
||||
registry = wl_display_get_registry(display);
|
||||
if (!registry) die("bad registry");
|
||||
|
||||
wl_registry_add_listener(registry, ®istry_listener, NULL);
|
||||
wl_registry_add_listener(registry, ®istry_listener, nullptr);
|
||||
|
||||
wl_display_dispatch(display);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
Reference in New Issue
Block a user