commit a08809ec69ae6dd0ca37a31535b8a0a3405883e5 from: Brett Fisher date: Thu Jun 18 06:16:43 2026 UTC bxnotify.c, config.def.h: Name the concurrent notification cap. - Define MAX_STACK in config.def.h, replacing the previously magic-numbered [100] array dimensions and loop bounds in get_and_register_stack_y() and unregister_position(). - Add cfg_max_stack as a runtime configuration variable, following the same pattern as cfg_stack_gap and other tunable defaults. - This makes the cap on concurrent notifications explicit, configurable from a single location, and consistent with the suite's convention of promoting tunables into the config layer. commit - 95eeecbe5f3f4edfeb5f5e93b4bebd14744f30b2 commit + a08809ec69ae6dd0ca37a31535b8a0a3405883e5 blob - e3561d389654adb32ec21d28b3a67a9d0893e0c4 blob + c5ee2b825f258d251f5b5a9227cb12bcf2aac428 --- bxnotify.c +++ bxnotify.c @@ -47,6 +47,7 @@ static int cfg_win_y = WIN_Y; static int cfg_padding = PADDING; static int cfg_border_width = BORDER_WIDTH; static int cfg_stack_gap = STACK_GAP; +static int cfg_max_stack = MAX_STACK; static int cfg_align = ALIGN; static int cfg_duration = DURATION; static const char *cfg_fg = FG_COLOR; @@ -281,7 +282,7 @@ get_and_register_stack_y(int my_h) int lowest_y = 0; /* Store valid PIDs so we can rewrite the file cleanly */ - char valid_lines[100][64]; + char valid_lines[cfg_max_stack][64]; int valid_count = 0; /* Open the file descriptor as a FILE* for easy reading with fgets */ @@ -291,7 +292,7 @@ get_and_register_stack_y(int my_h) int pid, y, h; /* 1. Read existing entries and find the lowest Y */ - while (fgets(line, sizeof(line), f) && valid_count < 100) { + while (fgets(line, sizeof(line), f) && valid_count < cfg_max_stack) { if (sscanf(line, "%d %d %d", &pid, &y, &h) == 3) { if (kill(pid, 0) == 0) { /* Process is still alive */ if ((y + h) > lowest_y) @@ -334,11 +335,11 @@ unregister_position(void) FILE *f = fdopen(fd, "r+"); if (f) { char line[64]; - char keep[100][64]; + char keep[cfg_max_stack][64]; int count = 0; int my_pid = getpid(); - while (fgets(line, sizeof(line), f) && count < 100) { + while (fgets(line, sizeof(line), f) && count < cfg_max_stack) { int pid; sscanf(line, "%d", &pid); /* Keep if it's not ours AND process is alive */ blob - eb4b7c67ec56f39af16d7795e0efeae2ec64c91b blob + c776baaa995ce9eb75b97f7986a469cfc4742c6c --- config.def.h +++ config.def.h @@ -10,6 +10,7 @@ #define PADDING 6 #define BORDER_WIDTH 2 #define STACK_GAP 16 +#define MAX_STACK 100 /* Maximum concurrent notifications */ #define BORDER_COLOR "#555555" #define FG_COLOR "#ffffff" #define BG_COLOR "#000000"