style: 禁掉 clang-format 的 AlignConsecutiveAssignments 规则并重新格式化整个项目

This commit is contained in:
2026-06-24 13:05:56 +08:00
parent 8f671bd755
commit bf3de7fb92
38 changed files with 763 additions and 731 deletions

View File

@@ -86,7 +86,7 @@ array_erase_impl(void *items, size_t item_size, size_t *count, size_t index) {
size_t tail_count = *count - index - 1;
if (tail_count > 0) {
char *dest = (char *)items + index * item_size;
char *src = dest + item_size;
char *src = dest + item_size;
memmove(dest, src, tail_count * item_size);
}
@@ -98,11 +98,11 @@ array_erase_impl(void *items, size_t item_size, size_t *count, size_t index) {
#define array_reserve(items, capacity, need) \
array_reserve_impl((void **)&(items), sizeof(*(items)), &(capacity), (need))
/* clang-format off */
/** @brief 为具体类型数组追加一个槽位。 */
#define array_push(items, count, capacity) \
( \
typeof(items) \
)array_push_impl((void **)&(items), sizeof(*(items)), &(count), &(capacity))
#define array_push(items, count, capacity)\
(typeof(items))array_push_impl((void **)&(items), sizeof(*(items)), &(count), &(capacity))
/* clang-format on */
/** @brief 删除具体类型数组中指定下标的元素。 */
#define array_erase(items, count, index) \

View File

@@ -54,9 +54,9 @@ void color_parse(const char *hex, color_t *const color) {
bool hex_color_to_rgba(const char *hex, uint32_t *rgba) {
if (hex[0] == '#') hex++;
size_t len = strlen(hex);
size_t len = strlen(hex);
char extended[9] = {0};
uint32_t color = 0x00000000;
uint32_t color = 0x00'00'00'00;
if (len == 3 || len == 4) {
extended[0] = extended[1] = hex[0];
@@ -76,7 +76,7 @@ bool hex_color_to_rgba(const char *hex, uint32_t *rgba) {
return false;
}
color = strtoul(extended, nullptr, 16) & 0xffffffff;
color = strtoul(extended, nullptr, 16) & 0xff'ff'ff'ff;
*rgba = color;
return true;
}
@@ -100,8 +100,8 @@ void extract_color_channel(
double *blue,
double *alpha
) {
*red = COLOR_SPLIT(rgba, 24);
*red = COLOR_SPLIT(rgba, 24);
*green = COLOR_SPLIT(rgba, 16);
*blue = COLOR_SPLIT(rgba, 8);
*blue = COLOR_SPLIT(rgba, 8);
*alpha = COLOR_SPLIT(rgba, 0);
}

View File

@@ -5,10 +5,7 @@
#include "base/array.h"
#include "base/memory.h"
void window_list_push(
window_list_t *window_list,
zdwm_window_id_t window_id
) {
void window_list_push(window_list_t *window_list, zdwm_window_id_t window_id) {
zdwm_window_id_t *window =
array_push(window_list->windows, window_list->count, window_list->capacity);
*window = window_id;
@@ -21,6 +18,6 @@ void window_list_reset(window_list_t *window_list) {
void window_list_cleanup(window_list_t *window_list) {
p_delete(&window_list->windows);
window_list->count = 0;
window_list->count = 0;
window_list->capacity = 0;
}