Skip to content

Commit

Permalink
Use macros in array declarations.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Borodin <[email protected]>
  • Loading branch information
aborodin committed Feb 3, 2025
1 parent ea726b1 commit 1f5e3c1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#define BUF_10K 10240L
#define BUF_8K 8192L
#define BUF_4K 4096L
#define BUF_2K 2048L
#define BUF_1K 1024L

#define BUF_LARGE BUF_1K
Expand Down
2 changes: 1 addition & 1 deletion lib/widget/wtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
input_complete_t completion_flags)
{
char *p_text;
char histname[64] = "inp|";
char histname[BUF_TINY] = "inp|";
gboolean is_passwd = FALSE;
char *my_str = NULL;

Expand Down
8 changes: 5 additions & 3 deletions src/editor/syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,11 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
{
FILE *g = NULL;
tty_color_pair_t color;
char last_fg[32] = "", last_bg[32] = "", last_attrs[64] = "";
char whole_right[512];
char whole_left[512];
char last_fg[BUF_TINY/2] = "";
char last_bg[BUF_TINY/2] = "";
char last_attrs[BUF_TINY] = "";
char whole_right[BUF_MEDIUM];
char whole_left[BUF_MEDIUM];
char *l = NULL;
int save_line = 0, line = 0;
context_rule_t *c = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/filemanager/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ regex_check_type (const vfs_path_t *filename_vpath, const char *ptr, gboolean ca
gboolean found = FALSE;

// Following variables are valid if *have_type is TRUE
static char content_string[2048];
static char content_string[BUF_2K];
static size_t content_shift = 0;
static int got_data = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/subshell/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ enum
/*** file scope variables ************************************************************************/

/* tcsh closes all non-standard file descriptors, so we have to use a pipe */
static char tcsh_fifo[128];
static char tcsh_fifo[BUF_SMALL];

static int subshell_pty_slave = -1;

Expand Down
3 changes: 2 additions & 1 deletion src/vfs/ftpfs/ftpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,8 @@ static void
resolve_symlink_with_ls_options (struct vfs_class *me, struct vfs_s_super *super,
struct vfs_s_inode *dir)
{
char buffer[2048] = "", *filename;
char buffer[BUF_2K] = "";
char *filename;
int sock;
FILE *fp;
struct stat s;
Expand Down
2 changes: 1 addition & 1 deletion src/vfs/sfs/sfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static int
sfs_vfmake (const vfs_path_t *vpath, vfs_path_t *cache_vpath)
{
int w;
char pad[10240];
char pad[BUF_10K];
char *s_iter, *t = pad;
gboolean was_percent = FALSE;
vfs_path_t *pname; // name of parent archive
Expand Down
2 changes: 1 addition & 1 deletion src/vfs/shell/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static gboolean
shell_open_archive_talk (struct vfs_class *me, struct vfs_s_super *super)
{
shell_super_t *shell_super = SHELL_SUPER (super);
char answer[2048];
char answer[BUF_2K];

printf ("\n%s\n", _ ("shell: Waiting for initial line..."));

Expand Down

0 comments on commit 1f5e3c1

Please sign in to comment.