From: Richard Russon Date: Sat, 23 Feb 2019 13:22:17 +0000 (+0000) Subject: replace HUGE_STRING with 8192 or STR_COMMAND X-Git-Tag: 2019-10-25~348^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F1576%2Fhead;p=neomutt replace HUGE_STRING with 8192 or STR_COMMAND --- diff --git a/alias.c b/alias.c index 986cc45f6..8cd5afa83 100644 --- a/alias.c +++ b/alias.c @@ -599,7 +599,7 @@ int mutt_alias_complete(char *buf, size_t buflen) { struct Alias *a = NULL, *tmp = NULL; struct AliasList a_list = TAILQ_HEAD_INITIALIZER(a_list); - char bestname[HUGE_STRING] = { 0 }; + char bestname[8192] = { 0 }; if (buf[0] != 0) /* avoid empty string as strstr argument */ { diff --git a/commands.c b/commands.c index 70ecc3b86..5c66a3770 100644 --- a/commands.c +++ b/commands.c @@ -339,7 +339,7 @@ int mutt_display_message(struct Email *cur) { int r; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; mutt_endwin(); snprintf(cmd, sizeof(cmd), "%s %s", NONULL(C_Pager), tempfile); r = mutt_system(cmd); @@ -374,7 +374,7 @@ void ci_bounce_message(struct Mailbox *m, struct EmailList *el) char prompt[128]; char scratch[128]; - char buf[HUGE_STRING] = { 0 }; + char buf[8192] = { 0 }; struct Address *addr = NULL; char *err = NULL; int rc; diff --git a/compose.c b/compose.c index 3a6a39451..e237fb822 100644 --- a/compose.c +++ b/compose.c @@ -519,7 +519,7 @@ static void draw_envelope(struct Email *msg, char *fcc) */ static void edit_address_list(int line, struct Address **addr) { - char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */ + char buf[8192] = ""; /* needs to be large for alias expansion */ char *err = NULL; mutt_addrlist_to_local(*addr); diff --git a/compress.c b/compress.c index 9e21ea8bf..1153d41f6 100644 --- a/compress.c +++ b/compress.c @@ -325,7 +325,7 @@ static void expand_command_str(const struct Mailbox *m, const char *cmd, char *b static int execute_command(struct Mailbox *m, const char *command, const char *progress) { int rc = 1; - char sys_cmd[HUGE_STRING]; + char sys_cmd[STR_COMMAND]; if (!m || !command || !progress) return 0; diff --git a/config/address.c b/config/address.c index fc3930bb2..37a755dd0 100644 --- a/config/address.c +++ b/config/address.c @@ -115,7 +115,7 @@ static int address_string_get(const struct ConfigSet *cs, void *var, if (!cs || !cdef) return CSR_ERR_CODE; /* LCOV_EXCL_LINE */ - char tmp[HUGE_STRING] = ""; + char tmp[8192] = ""; const char *str = NULL; if (var) diff --git a/copy.c b/copy.c index a9a45779b..52c1a5ebc 100644 --- a/copy.c +++ b/copy.c @@ -945,7 +945,7 @@ static int copy_delete_attach(struct Body *b, FILE *fpin, FILE *fpout, char *dat */ static void format_address_header(char **h, struct Address *a) { - char buf[HUGE_STRING]; + char buf[8192]; char cbuf[256]; char c2buf[256]; char *p = NULL; diff --git a/curs_lib.c b/curs_lib.c index f80249e8e..df8e6ba6a 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -307,7 +307,7 @@ int mutt_get_field_unbuffered(const char *msg, char *buf, size_t buflen, int fla */ void mutt_edit_file(const char *editor, const char *file) { - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; mutt_endwin(); mutt_file_expand_fmt_quote(cmd, sizeof(cmd), editor, file); diff --git a/edit.c b/edit.c index 8b3c73a49..ae4f27c04 100644 --- a/edit.c +++ b/edit.c @@ -92,7 +92,7 @@ static char *EditorHelp2 = static char **be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen, LOFF_T offset, int bytes, int prefix) { - char tmp[HUGE_STRING]; + char tmp[8192]; char *p = tmp; int tmplen = sizeof(tmp); @@ -266,7 +266,7 @@ static char **be_include_messages(char *msg, char **buf, int *bufmax, */ static void be_print_header(struct Envelope *env) { - char tmp[HUGE_STRING]; + char tmp[8192]; if (env->to) { @@ -308,7 +308,7 @@ static void be_print_header(struct Envelope *env) */ static void be_edit_header(struct Envelope *e, bool force) { - char tmp[HUGE_STRING]; + char tmp[8192]; mutt_window_move(MuttMessageWindow, 0, 0); diff --git a/email/address.c b/email/address.c index f49ecbb71..1a261b504 100644 --- a/email/address.c +++ b/email/address.c @@ -633,7 +633,7 @@ struct Address *mutt_addr_parse_list2(struct Address *p, const char *s) const char *q = strpbrk(s, "\"<>():;,\\"); if (!q) { - char tmp[HUGE_STRING]; + char tmp[8192]; mutt_str_strfcpy(tmp, s, sizeof(tmp)); char *r = tmp; diff --git a/handler.c b/handler.c index a722d2a0c..1d992a030 100644 --- a/handler.c +++ b/handler.c @@ -529,7 +529,7 @@ static int autoview_handler(struct Body *a, struct State *s) struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); char buffer[1024]; char type[256]; - char command[HUGE_STRING]; + char command[STR_COMMAND]; char tempfile[PATH_MAX] = ""; char *fname = NULL; FILE *fpin = NULL; diff --git a/hook.c b/hook.c index 7ce344a34..493415920 100644 --- a/hook.c +++ b/hook.c @@ -167,7 +167,7 @@ enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, !(data & (MUTT_CHARSET_HOOK | MUTT_ICONV_HOOK | MUTT_ACCOUNT_HOOK)) && (!WithCrypto || !(data & MUTT_CRYPT_HOOK))) { - char tmp[HUGE_STRING]; + char tmp[8192]; /* At this stage remain only message-hooks, reply-hooks, send-hooks, * send2-hooks, save-hooks, and fcc-hooks: All those allowing full diff --git a/imap/util.c b/imap/util.c index 95d2472ea..038fa7f66 100644 --- a/imap/util.c +++ b/imap/util.c @@ -532,7 +532,7 @@ int imap_hcache_store_uid_seqset(struct ImapMboxData *mdata) struct Buffer *b = mutt_buffer_new(); /* The seqset is likely large. Preallocate to reduce reallocs */ - mutt_buffer_increase_size(b, HUGE_STRING); + mutt_buffer_increase_size(b, 8192); imap_msn_index_to_uid_seqset(b, mdata); size_t seqset_size = b->dptr - b->data; diff --git a/mbox/mbox.c b/mbox/mbox.c index c8a2d637b..37c325443 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -188,7 +188,7 @@ static int mmdf_parse_mailbox(struct Mailbox *m) if (!adata) return -1; - char buf[HUGE_STRING]; + char buf[8192]; char return_path[1024]; int count = 0; int lines; @@ -354,7 +354,7 @@ static int mbox_parse_mailbox(struct Mailbox *m) return -1; struct stat sb; - char buf[HUGE_STRING], return_path[256]; + char buf[8192], return_path[256]; struct Email *e_cur = NULL; time_t t; int count = 0, lines = 0; diff --git a/mutt/path.c b/mutt/path.c index ec51970e7..f236be2c1 100644 --- a/mutt/path.c +++ b/mutt/path.c @@ -535,7 +535,7 @@ bool mutt_path_abbr_folder(char *buf, size_t buflen, const char *folder) */ char *mutt_path_escape(const char *src) { - static char dest[HUGE_STRING]; + static char dest[STR_COMMAND]; char *destp = dest; int destsize = 0; diff --git a/mutt/string2.h b/mutt/string2.h index adf581f5c..5f935cfab 100644 --- a/mutt/string2.h +++ b/mutt/string2.h @@ -31,7 +31,7 @@ #include #include -#define HUGE_STRING 8192 +#define STR_COMMAND 8192 ///< Enough space for a long command line #define NONULL(x) (x ? x : "") #define ISSPACE(c) isspace((unsigned char) c) diff --git a/mutt_attach.c b/mutt_attach.c index 1f3dd5610..7aac87d3b 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -111,7 +111,7 @@ int mutt_get_tmp_attachment(struct Body *a) int mutt_compose_attachment(struct Body *a) { char type[256]; - char command[HUGE_STRING]; + char command[STR_COMMAND]; char newfile[PATH_MAX] = ""; struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); bool unlink_newfile = false; @@ -248,7 +248,7 @@ bailout: int mutt_edit_attachment(struct Body *a) { char type[256]; - char command[HUGE_STRING]; + char command[STR_COMMAND]; char newfile[PATH_MAX] = ""; struct Rfc1524MailcapEntry *entry = rfc1524_new_entry(); bool unlink_newfile = false; @@ -387,7 +387,7 @@ int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Email *e, bool use_pipe = false; bool use_pager = true; char type[256]; - char command[HUGE_STRING]; + char command[STR_COMMAND]; char descrip[256]; char *fname = NULL; struct Rfc1524MailcapEntry *entry = NULL; @@ -801,7 +801,7 @@ int mutt_save_attachment(FILE *fp, struct Body *m, char *path, int flags, struct { /* message type attachments are written to mail folders. */ - char buf[HUGE_STRING]; + char buf[8192]; struct Message *msg = NULL; int chflags = 0; int r = -1; @@ -1026,7 +1026,7 @@ int mutt_print_attachment(FILE *fp, struct Body *a) if (rfc1524_mailcap_lookup(a, type, NULL, MUTT_PRINT)) { - char command[HUGE_STRING]; + char command[STR_COMMAND]; int piped = false; mutt_debug(LL_DEBUG2, "Using mailcap...\n"); diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index da47222d0..1ea55ab96 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -2606,7 +2606,7 @@ static int line_compare(const char *a, size_t n, const char *b) static int pgp_check_traditional_one_body(FILE *fp, struct Body *b) { char tempfile[PATH_MAX]; - char buf[HUGE_STRING]; + char buf[8192]; FILE *tfp = NULL; bool sgn = false; @@ -2800,7 +2800,7 @@ leave: */ static void copy_clearsigned(gpgme_data_t data, struct State *s, char *charset) { - char buf[HUGE_STRING]; + char buf[8192]; bool complete, armor_header; FILE *fp = NULL; @@ -2862,7 +2862,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) bool clearsign = false; long bytes; LOFF_T last_pos; - char buf[HUGE_STRING]; + char buf[8192]; FILE *pgpout = NULL; gpgme_error_t err = 0; diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 6d06e1698..f723a2c96 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -414,7 +414,7 @@ static int pgp_check_decryption_okay(FILE *fpin) */ static void pgp_copy_clearsigned(FILE *fpin, struct State *s, char *charset) { - char buf[HUGE_STRING]; + char buf[8192]; bool complete, armor_header; rewind(fpin); @@ -473,7 +473,7 @@ int pgp_class_application_handler(struct Body *m, struct State *s) int c = 1; long bytes; LOFF_T last_pos, offset; - char buf[HUGE_STRING]; + char buf[8192]; char tmpfname[PATH_MAX]; FILE *pgpout = NULL, *pgpin = NULL, *pgperr = NULL; FILE *tmpfp = NULL; @@ -789,7 +789,7 @@ out: static int pgp_check_traditional_one_body(FILE *fp, struct Body *b) { char tempfile[PATH_MAX]; - char buf[HUGE_STRING]; + char buf[8192]; FILE *tfp = NULL; bool sgn = false; diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 4ae05fa30..a0a73e0c0 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -211,7 +211,7 @@ static pid_t pgp_invoke(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, const char *sig_fname, const char *ids, const char *format) { struct PgpCommandContext cctx = { 0 }; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; if (!format || !*format) return (pid_t) -1; @@ -399,7 +399,7 @@ pid_t pgp_invoke_traditional(FILE **pgpin, FILE **pgpout, FILE **pgperr, void pgp_class_invoke_import(const char *fname) { char tmp_fname[PATH_MAX + 128]; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; struct PgpCommandContext cctx = { 0 }; mutt_file_quote_filename(fname, tmp_fname, sizeof(tmp_fname)); @@ -421,7 +421,7 @@ void pgp_class_invoke_getkeys(struct Address *addr) { char buf[PATH_MAX]; char tmp[1024]; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; int devnull; char *personal = NULL; @@ -524,7 +524,7 @@ pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, enum PgpRing keyring, struct ListHead *hints) { - char quoted[HUGE_STRING]; + char quoted[STR_COMMAND]; struct Buffer *uids = mutt_buffer_pool_get(); diff --git a/ncrypt/pgpmicalg.c b/ncrypt/pgpmicalg.c index 871a3050f..16025b307 100644 --- a/ncrypt/pgpmicalg.c +++ b/ncrypt/pgpmicalg.c @@ -67,7 +67,7 @@ static const char *pgp_hash_to_micalg(short id) */ static void pgp_dearmor(FILE *in, FILE *out) { - char line[HUGE_STRING]; + char line[8192]; LOFF_T start; LOFF_T end; char *r = NULL; diff --git a/ncrypt/smime.c b/ncrypt/smime.c index b7375c079..df567fd61 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -386,7 +386,7 @@ static pid_t smime_invoke(FILE **smimein, FILE **smimeout, FILE **smimeerr, const char *intermediates, const char *format) { struct SmimeCommandContext cctx = { 0 }; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; if (!format || !*format) return (pid_t) -1; @@ -2140,7 +2140,7 @@ static struct Body *smime_handle_entity(struct Body *m, struct State *s, FILE *o return NULL; } } - char buf[HUGE_STRING]; + char buf[8192]; while (fgets(buf, sizeof(buf) - 1, smimeout)) { const size_t len = mutt_str_strlen(buf); diff --git a/nntp/newsrc.c b/nntp/newsrc.c index f80766708..760ba8b73 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -573,7 +573,7 @@ int nntp_add_group(char *line, void *data) struct NntpAccountData *adata = data; struct NntpMboxData *mdata = NULL; char group[1024] = ""; - char desc[HUGE_STRING] = ""; + char desc[8192] = ""; char mod; anum_t first, last; @@ -611,7 +611,7 @@ int nntp_add_group(char *line, void *data) */ static int active_get_cache(struct NntpAccountData *adata) { - char buf[HUGE_STRING]; + char buf[8192]; char file[PATH_MAX]; time_t t; diff --git a/nntp/nntp.c b/nntp/nntp.c index 56a106e98..f9a881dfc 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -1257,7 +1257,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t struct NntpMboxData *mdata = m->mdata; struct FetchCtx fc; struct Email *e = NULL; - char buf[HUGE_STRING]; + char buf[8192]; int rc = 0; anum_t current; anum_t first_over = first; @@ -2442,7 +2442,7 @@ static int nntp_mbox_open(struct Mailbox *m) if (!m || !m->account) return -1; - char buf[HUGE_STRING]; + char buf[8192]; char server[1024]; char *group = NULL; int rc; diff --git a/query.c b/query.c index cadc7626c..d1678c537 100644 --- a/query.c +++ b/query.c @@ -137,7 +137,7 @@ static struct Query *run_query(char *s, int quiet) FILE *fp = NULL; struct Query *first = NULL; struct Query *cur = NULL; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; char *buf = NULL; size_t buflen; int dummy = 0; diff --git a/recvcmd.c b/recvcmd.c index 27f7e9fdc..2955ad42b 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -167,7 +167,7 @@ void mutt_attach_bounce(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, str return; char prompt[256]; - char buf[HUGE_STRING]; + char buf[8192]; char *err = NULL; struct Address *addr = NULL; int ret = 0; diff --git a/remailer.c b/remailer.c index 1af5e617f..2e6d1ddf7 100644 --- a/remailer.c +++ b/remailer.c @@ -167,8 +167,8 @@ static struct Remailer **mix_type2_list(size_t *l) pid_t mm_pid; int devnull; - char cmd[HUGE_STRING]; - char line[HUGE_STRING]; + char cmd[STR_COMMAND]; + char line[8192]; char *t = NULL; struct Remailer **type2_list = NULL, *p = NULL; diff --git a/rfc1524.c b/rfc1524.c index 756049aa4..cfa3c40fd 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -74,7 +74,7 @@ int rfc1524_expand_command(struct Body *a, const char *filename, { int x = 0, y = 0; int needspipe = true; - char buf[HUGE_STRING]; + char buf[STR_COMMAND]; char type2[1024]; mutt_str_strfcpy(type2, type, sizeof(type2)); diff --git a/send.c b/send.c index aea7f252b..95f9c7312 100644 --- a/send.c +++ b/send.c @@ -235,7 +235,7 @@ static struct Address *find_mailing_lists(struct Address *t, struct Address *c) */ static int edit_address(struct Address **a, const char *field) { - char buf[HUGE_STRING]; + char buf[8192]; char *err = NULL; int idna_ok = 0; @@ -267,7 +267,7 @@ static int edit_address(struct Address **a, const char *field) */ static int edit_envelope(struct Envelope *en, int flags) { - char buf[HUGE_STRING]; + char buf[8192]; #ifdef USE_NNTP if (OptNewsSend) diff --git a/sendlib.c b/sendlib.c index 75eb6b363..79713aa02 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1558,7 +1558,7 @@ struct Body *mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool a static void run_mime_type_query(struct Body *att) { FILE *fp, *fperr; - char cmd[HUGE_STRING]; + char cmd[STR_COMMAND]; char *buf = NULL; size_t buflen; int dummy = 0; @@ -1881,7 +1881,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value, const char *pfx, int wraplen, int chflags) { const char *p = value; - char buf[HUGE_STRING] = ""; + char buf[8192] = ""; int first = 1, col = 0, l = 0; const bool display = (chflags & CH_DISPLAY);