From 3e923f6b0245d565133454002d56f45e3082923e Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Sat, 12 Nov 2016 14:42:49 +0100 Subject: [PATCH] (Finally) Add n_empty, the empty string --- accmacvar.c | 16 ++++++++-------- auxlily.c | 2 +- cmd1.c | 9 +++++---- cmd2.c | 2 +- cmd3.c | 7 ++++--- cmd_arg.c | 2 +- cmd_cnd.c | 8 ++++---- collect.c | 16 ++++++++-------- colour.c | 8 ++++---- folder.c | 4 ++-- head.c | 2 +- ignoretab.c | 2 +- lex_input.c | 6 +++--- main.c | 3 ++- mime.c | 8 ++++---- mime_enc.c | 2 +- mime_types.c | 10 +++++----- nail.h | 1 + nam_a_grp.c | 3 ++- quit.c | 2 +- send.c | 10 +++++----- shexp.c | 4 ++-- smtp.c | 2 +- socket.c | 4 ++-- spam.c | 2 +- ssl_tls.c | 12 ++++++------ strings.c | 2 +- thread.c | 4 ++-- tty.c | 18 ++++++++++-------- ui_str.c | 2 +- urlcrecry.c | 10 +++++----- 31 files changed, 95 insertions(+), 88 deletions(-) diff --git a/accmacvar.c b/accmacvar.c index 52326045..99b5a1ce 100644 --- a/accmacvar.c +++ b/accmacvar.c @@ -457,7 +457,7 @@ a_amv_mac_def(char const *name, enum a_amv_mac_flags amf){ ui32_t leaspc; char *cp; - n.i = n_lex_input(n_LEXINPUT_CTX_DEFAULT | n_LEXINPUT_NL_ESC, "", + n.i = n_lex_input(n_LEXINPUT_CTX_DEFAULT | n_LEXINPUT_NL_ESC, n_empty, &line.s, &line.l, NULL); if(n.ui == 0) continue; @@ -676,7 +676,7 @@ a_amv_var_copy(char const *str){ NYD2_ENTER; if(*str == '\0') - news = n_UNCONST(""); + news = n_UNCONST(n_empty); else if(str[1] == '\0'){ if(str[0] == '1') news = n_UNCONST(a_amv_var_1); @@ -964,7 +964,7 @@ a_amv_var_lookup(struct a_amv_var_carrier *avcp, bool_t i3val_nonew){ for(i = 0; arr[i] != NULL; ++i) if(arr[i]->avdv_okey == avcp->avc_okey){ - cp = (avmp->avm_flags & a_AMV_VF_BOOL) ? "" + cp = (avmp->avm_flags & a_AMV_VF_BOOL) ? n_empty : arr[i]->avdv_value; /* Remove this entry, hope entire block becomes no-op asap */ do @@ -994,7 +994,7 @@ a_amv_var_lookup(struct a_amv_var_carrier *avcp, bool_t i3val_nonew){ if(n_UNLIKELY(avmp->avm_flags & a_AMV_VF_DEFVAL) != 0){ for(i = 0; i < a_AMV_VAR_DEFVALS_CNT; ++i) if(a_amv_var_defvals[i].avdv_okey == avcp->avc_okey){ - cp = (avmp->avm_flags & a_AMV_VF_BOOL) ? "" + cp = (avmp->avm_flags & a_AMV_VF_BOOL) ? n_empty : a_amv_var_defvals[i].avdv_value; goto jnewval; } @@ -1105,7 +1105,7 @@ jeavmp: #endif memcpy(avp->av_name, avcp->avc_name, l); avp->av_flags = (avmp != NULL) ? avmp->avm_flags : 0; - oval = n_UNCONST(""); + oval = n_UNCONST(n_empty); }else oval = avp->av_value; @@ -1428,7 +1428,7 @@ jouter: } *cp2 = '\0'; if(c == '\0') - cp = n_UNCONST(""); + cp = n_UNCONST(n_empty); else ++cp; @@ -1810,7 +1810,7 @@ n_var_okset(enum okeys okey, uintptr_t val){ avc.avc_hash = avmp->avm_hash; avc.avc_okey = okey; - ok = a_amv_var_set(&avc, (val == 0x1 ? "" : (char const*)val), FAL0); + ok = a_amv_var_set(&avc, (val == 0x1 ? n_empty : (char const*)val), FAL0); NYD_LEAVE; return ok; } @@ -1853,7 +1853,7 @@ n_var_vokset(char const *vokey, uintptr_t val){ a_amv_var_revlookup(&avc, vokey); - ok = a_amv_var_set(&avc, (val == 0x1 ? "" : (char const*)val), FAL0); + ok = a_amv_var_set(&avc, (val == 0x1 ? n_empty : (char const*)val), FAL0); NYD_LEAVE; return ok; } diff --git a/auxlily.c b/auxlily.c index 46238212..ec1b1a8e 100644 --- a/auxlily.c +++ b/auxlily.c @@ -905,7 +905,7 @@ n_perr(char const *msg, int errval){ if(msg == NULL){ fmt = "%s%s\n"; - msg = ""; + msg = n_empty; }else fmt = "%s: %s\n"; diff --git a/cmd1.c b/cmd1.c index ad1285b7..c4d8d9d6 100644 --- a/cmd1.c +++ b/cmd1.c @@ -80,9 +80,10 @@ static int a_cmd_top(void *vp, struct ignoretab *itp); static void _show_msg_overview(FILE *obuf, struct message *mp, int msg_no) { - char const *cpre = "", *csuf = ""; + char const *cpre, *csuf; NYD_ENTER; + cpre = csuf = n_empty; #ifdef HAVE_COLOUR if (pstate & PS_COLOUR_ACTIVE) { struct n_colour_pen *cpen; @@ -245,7 +246,7 @@ jredo: } } if (name == NULL) { - name = ""; + name = n_empty; flags &= ~_ISADDR; } if (flags & _ISADDR) @@ -436,7 +437,7 @@ jputcb: } if (flags & _ISTO) /* XXX tr()! */ i -= 3; - n = fprintf(f, "%s%s", ((flags & _ISTO) ? "To " : ""), + n = fprintf(f, "%s%s", ((flags & _ISTO) ? "To " : n_empty), colalign(name, i, n, &wleft)); if (n < 0) wleft = 0; @@ -512,7 +513,7 @@ jputcb: if (subjline == NULL) subjline = __subject(mp, (threaded && (flags & _IFMT)), yetprinted); if (subjline == (char*)-1) { - n = fprintf(f, "%*s", n, ""); + n = fprintf(f, "%*s", n, n_empty); wleft = (n >= 0) ? wleft - n : 0; } else { n = fprintf(f, ((flags & _SFMT) ? "\"%s\"" : "%s"), diff --git a/cmd2.c b/cmd2.c index 32d90736..d43d1908 100644 --- a/cmd2.c +++ b/cmd2.c @@ -64,7 +64,7 @@ save1(char *str, int domark, char const *cmd, struct ignoretab *ignoret, int last = 0, *msgvec, *ip; struct message *mp; char *file = NULL, *cp, *cq; - char const *disp = "", *shell = NULL; + char const *disp = n_empty, *shell = NULL; FILE *obuf; bool_t success = FAL0, isflag; NYD_ENTER; diff --git a/cmd3.c b/cmd3.c index e5a4712f..73976e8f 100644 --- a/cmd3.c +++ b/cmd3.c @@ -255,7 +255,7 @@ jnext_msg: size_t l = strlen(tr) + strlen(rt->n_name) + 3 +1; char *sp = salloc(l); - snprintf(sp, l, tr, rt->n_name, (rt->n_flink != NULL ? "..." : "")); + snprintf(sp, l, tr, rt->n_name, (rt->n_flink != NULL ? "..." : n_empty)); if (quadify(cp, UIZ_MAX, sp, TRU1) > FAL0) rcv = reply_to; } @@ -300,7 +300,7 @@ jnext_msg: size_t l = strlen(tr) + strlen(np->n_name) + 3 +1; char *sp = salloc(l); - snprintf(sp, l, tr, np->n_name, (np->n_flink != NULL ? "..." : "")); + snprintf(sp, l, tr, np->n_name, (np->n_flink != NULL ? "..." : n_empty)); if (quadify(ok_vlook(followup_to_honour), UIZ_MAX, sp, TRU1) > FAL0) { head.h_cc = NULL; head.h_to = np; @@ -450,7 +450,8 @@ _Reply(int *msgvec, bool_t recipient_record) size_t l = strlen(tr) + strlen(rt->n_name) + 3 +1; char *sp = salloc(l); - snprintf(sp, l, tr, rt->n_name, (rt->n_flink != NULL ? "..." : "")); + snprintf(sp, l, tr, rt->n_name, (rt->n_flink != NULL ? "..." + : n_empty)); if (quadify(cp, UIZ_MAX, sp, TRU1) > FAL0) { head.h_to = cat(head.h_to, rt); continue; diff --git a/cmd_arg.c b/cmd_arg.c index e80b91d3..bcaf506c 100644 --- a/cmd_arg.c +++ b/cmd_arg.c @@ -318,7 +318,7 @@ jerr:{ "(need %" PRIuZ "%s)\n" " Input: %.*s\n" " Stopped: %.*s\n"), - cadp->cad_name, parsed_args, i, (i == cadp->cad_no ? "" : "+"), + cadp->cad_name, parsed_args, i, (i == cadp->cad_no ? n_empty : "+"), (int)shin_orig.l, shin_orig.s, (int)shin.l, shin.s); } diff --git a/cmd_cnd.c b/cmd_cnd.c index 021a14c5..11360933 100644 --- a/cmd_cnd.c +++ b/cmd_cnd.c @@ -66,10 +66,10 @@ _if_error(struct if_cmd const *icp, char const *msg_or_null, if (options & (OPT_INTERACTIVE | OPT_D_V)) { str_concat_cpa(&s, icp->ic_argv_base, - (*icp->ic_argv_base != NULL ? " " : "")); + (*icp->ic_argv_base != NULL ? " " : n_empty)); n_err(_(" Expression: %s\n"), s.s); - str_concat_cpa(&s, icp->ic_argv, (*icp->ic_argv != NULL ? " " : "")); + str_concat_cpa(&s, icp->ic_argv, (*icp->ic_argv != NULL ? " " : n_empty)); n_err(_(" Stopped at: %s\n"), s.s); } @@ -192,9 +192,9 @@ jesyn: /* A null value is treated as the empty string */ emsg = NULL; if (lhv == NULL) - lhv = n_UNCONST(""); + lhv = n_UNCONST(n_empty); if (rhv == NULL) - rhv = n_UNCONST(""); + rhv = n_UNCONST(n_empty); #ifdef HAVE_REGEX if (op[1] == '~') { diff --git a/collect.c b/collect.c index 6b1314a3..85623da3 100644 --- a/collect.c +++ b/collect.c @@ -303,7 +303,7 @@ jpager: if ((cp = ap->a_content_type) == NULL) cp = "?"; else if (ascncasecmp(cp, "text/", 5)) - csi = ""; + csi = n_empty; fprintf(obuf, " - [%s, %s%s] %s\n", cp, csi, cs, n_shexp_quote_cp(ap->a_name, FAL0)); } @@ -583,22 +583,22 @@ a_coll__hook_setter(void *arg){ /* TODO v15: drop */ hp = arg; if((val = detract(hp->h_from, GNAMEONLY)) == NULL) - val = ""; + val = n_empty; ok_vset(compose_from, val); if((val = detract(hp->h_sender, 0)) == NULL) - val = ""; + val = n_empty; ok_vset(compose_sender, val); if((val = detract(hp->h_to, GNAMEONLY)) == NULL) - val = ""; + val = n_empty; ok_vset(compose_to, val); if((val = detract(hp->h_cc, GNAMEONLY)) == NULL) - val = ""; + val = n_empty; ok_vset(compose_cc, val); if((val = detract(hp->h_bcc, GNAMEONLY)) == NULL) - val = ""; + val = n_empty; ok_vset(compose_bcc, val); if((val = hp->h_subject) == NULL) - val = ""; + val = n_empty; ok_vset(compose_subject, val); NYD2_LEAVE; } @@ -797,7 +797,7 @@ jcont: if(!(options & OPT_t_FLAG)) lif |= n_LEXINPUT_NL_ESC; } - cnt = n_lex_input(lif, "", &linebuf, &linesize, NULL); + cnt = n_lex_input(lif, n_empty, &linebuf, &linesize, NULL); } if (cnt < 0) { diff --git a/colour.c b/colour.c index f077bdcf..13766e78 100644 --- a/colour.c +++ b/colour.c @@ -417,8 +417,8 @@ jredo: jemap: /* I18N: colour command, mapping and precondition (option in quotes) */ n_err(_("`uncolour': non-existing mapping: %s%s%s\n"), - n_shexp_quote_cp(mapname, FAL0), (ctag == NULL ? "" : " "), - (ctag == NULL ? "" : n_shexp_quote_cp(ctag, FAL0))); + n_shexp_quote_cp(mapname, FAL0), (ctag == NULL ? n_empty : " "), + (ctag == NULL ? n_empty : n_shexp_quote_cp(ctag, FAL0))); goto jleave; } @@ -498,9 +498,9 @@ jredo: while(cmp != NULL){ char const *tagann, *tag; - tagann = ""; + tagann = n_empty; if((tag = cmp->cm_tag) == NULL) - tag = ""; + tag = n_empty; else if(tag == n_COLOUR_TAG_SUM_DOT) tag = "dot"; else if(tag == n_COLOUR_TAG_SUM_OLDER) diff --git a/folder.c b/folder.c index 24daeae9..96eeece8 100644 --- a/folder.c +++ b/folder.c @@ -733,7 +733,7 @@ folder_query(void){ * If folder is unset or set to null, [.] filenames beginning with * '+' shall refer to files in the current directory. * We may have the result already */ - rv = ""; + rv = n_empty; err = FAL0; if((cp = ok_vlook(folder)) == NULL) @@ -798,7 +798,7 @@ folder_query(void){ n_err(_("Can't canonicalize *folder*: %s\n"), n_shexp_quote_cp(cp, FAL0)); err = TRU1; - rv = ""; + rv = n_empty; } sp = n_string_drop_ownership(sp); #endif /* HAVE_REALPATH */ diff --git a/head.c b/head.c index 9327135a..2b9e23f8 100644 --- a/head.c +++ b/head.c @@ -1376,7 +1376,7 @@ addrspec_with_guts(int doskin, char const *name, struct addrguts *agp) memset(agp, 0, sizeof *agp); if ((agp->ag_input = name) == NULL || (agp->ag_ilen = strlen(name)) == 0) { - agp->ag_skinned = n_UNCONST(""); /* ok: NAME_SALLOC is not set */ + agp->ag_skinned = n_UNCONST(n_empty); /* ok: NAME_SALLOC is not set */ agp->ag_slen = 0; agp->ag_n_flags |= NAME_ADDRSPEC_CHECKED; NAME_ADDRSPEC_ERR_SET(agp->ag_n_flags, NAME_ADDRSPEC_ERR_EMPTY, 0); diff --git a/ignoretab.c b/ignoretab.c index b012e3d0..1eb1f7f8 100644 --- a/ignoretab.c +++ b/ignoretab.c @@ -117,7 +117,7 @@ a_ignoretab__show(struct ignoretab *itp, bool_t ignorret){ putchar('\n'); i = 2; }else if(i == 0) - pref = ""; + pref = n_empty; i += len; printf("%s%s", pref, *ap); } diff --git a/lex_input.c b/lex_input.c index 3178bd56..152087b3 100644 --- a/lex_input.c +++ b/lex_input.c @@ -428,7 +428,7 @@ jredo: #ifdef HAVE_DOCSTRINGS # define a_DS V_(cp->lc_doc) #else -# define a_DS "" +# define a_DS n_empty #endif if(!strcmp(arg, cp->lc_name)) printf("%s: %s", arg, a_DS); @@ -704,7 +704,7 @@ jrestart: if(!(s = condstack_isskip()) || (options & OPT_D_V)) n_err(_("Unknown command%s: `%s'\n"), - (s ? _(" (ignored due to `if' condition)") : ""), word); + (s ? _(" (ignored due to `if' condition)") : n_empty), word); if(s) goto jleave0; if(cmd != NULL){ @@ -1026,7 +1026,7 @@ jerr: ? _("evaluating command line") : _("evaluating macro")) : _("loading initialization resource"))), lip->li_name, - (options & OPT_DEBUG ? "" : _(" (enable *debug* for trace)"))); + (options & OPT_DEBUG ? n_empty : _(" (enable *debug* for trace)"))); } if(!(options & OPT_INTERACTIVE) && !(pstate & PS_STARTED)){ diff --git a/main.c b/main.c index 2fc1899f..90253894 100644 --- a/main.c +++ b/main.c @@ -65,6 +65,7 @@ VL char const month_names[12 + 1][4] = { }; VL char const uagent[sizeof VAL_UAGENT] = VAL_UAGENT; VL char const n_error[sizeof n_ERROR] = N_(n_ERROR); +VL char const n_empty[1] = ""; VL ui16_t const class_char[1 + 0x7F] = { #define a_BC C_BLANK | C_CNTRL #define a_SC C_SPACE | C_CNTRL @@ -258,7 +259,7 @@ _startup(void) #ifndef HAVE_SETLOCALE mb_cur_max = 1; #else - setlocale(LC_ALL, ""); + setlocale(LC_ALL, n_empty); mb_cur_max = MB_CUR_MAX; # ifdef HAVE_NL_LANGINFO if(ok_vlook(ttycharset) == NULL && (cp = nl_langinfo(CODESET)) != NULL) diff --git a/mime.c b/mime.c index b8555bc7..b3a2a1ed 100644 --- a/mime.c +++ b/mime.c @@ -394,7 +394,7 @@ jnoenc_retry: * separated from text and other encoded words with linear WS. * And if an encoded word was last, intermediate whitespace must * also be encoded, otherwise it would get stripped away! */ - wcur = n_UNCONST(""); + wcur = n_UNCONST(n_empty); if ((flags & (_ENC_LAST | _SPACE)) != _SPACE) { /* Reinclude whitespace */ flags &= ~_SPACE; @@ -465,7 +465,7 @@ jenc_retry_same: col = 1; if (!(flags & _SPACE)) { putc(' ', fo); - wcur = n_UNCONST(""); + wcur = n_UNCONST(n_empty); /*flags |= _OVERLONG;*/ goto jenc_retry_same; } else { @@ -474,7 +474,7 @@ jenc_retry_same: ++wbot; else { flags &= ~_SPACE; - wcur = n_UNCONST(""); + wcur = n_UNCONST(n_empty); } /*flags &= ~_OVERLONG;*/ goto jenc_retry; @@ -1052,7 +1052,7 @@ mime_fromaddr(char const *name) _append_str(&res, &ressz, &rescur, lastcp, PTR2SIZE(cp - lastcp)); /* TODO rescur==0: inserted to silence Coverity ...; check that */ if (rescur == 0) - res = n_UNCONST(""); + res = n_UNCONST(n_empty); else res[rescur] = '\0'; { char *x = res; diff --git a/mime_enc.c b/mime_enc.c index 83aab072..b9227840 100644 --- a/mime_enc.c +++ b/mime_enc.c @@ -394,7 +394,7 @@ mime_enc_from_conversion(enum conversion const convert){ case CONV_8BIT: rv = &a_me_ctes[a_ME_CTES_8B_OFF]; break; case CONV_TOQP: rv = &a_me_ctes[a_ME_CTES_QP_OFF]; break; case CONV_TOB64: rv = &a_me_ctes[a_ME_CTES_B64_OFF]; break; - default: rv = ""; break; + default: rv = n_empty; break; } NYD2_LEAVE; return rv; diff --git a/mime_types.c b/mime_types.c index 5108f3c6..ade50900 100644 --- a/mime_types.c +++ b/mime_types.c @@ -431,7 +431,7 @@ _mt_by_filename(struct mtlookup *mtlp, char const *name, bool_t with_result) goto jleave; if ((mtnp->mt_flags & __MT_TMASK) == _MT_OTHER) { - name = ""; + name = n_empty; j = 0; } else { name = _mt_typnames[mtnp->mt_flags & __MT_TMASK]; @@ -471,7 +471,7 @@ _mt_by_mtname(struct mtlookup *mtlp, char const *mtname) /* ..all the MIME types */ for (mtnp = _mt_list; mtnp != NULL; mtnp = mtnp->mt_next) { if ((mtnp->mt_flags & __MT_TMASK) == _MT_OTHER) { - cp = ""; + cp = n_empty; j = 0; } else { cp = _mt_typnames[mtnp->mt_flags & __MT_TMASK]; @@ -888,7 +888,7 @@ c_mimetype(void *v) default: tmark = " "; break; } typ = ((mtnp->mt_flags & __MT_TMASK) == _MT_OTHER) - ? "" : _mt_typnames[mtnp->mt_flags & __MT_TMASK]; + ? n_empty : _mt_typnames[mtnp->mt_flags & __MT_TMASK]; fprintf(fp, "%c%s %s%.*s %s\n", (mtnp->mt_flags & _MT_USR ? 'U' @@ -948,7 +948,7 @@ jdelall: size_t i; if ((mtnp->mt_flags & __MT_TMASK) == _MT_OTHER) { - typ = ""; + typ = n_empty; i = 0; } else { typ = _mt_typnames[mtnp->mt_flags & __MT_TMASK]; @@ -1104,7 +1104,7 @@ mime_type_classify_part(struct mimepart *mpp) /* FIXME charset=binary ??? */ mc = MIME_UNKNOWN; if ((ct = mpp->m_ct_type_plain) == NULL) /* TODO may not */ - ct = ""; + ct = n_empty; if ((mce.cp = ok_vlook(mime_counter_evidence)) != NULL) { char *eptr; diff --git a/nail.h b/nail.h index 009874b8..b2c81450 100644 --- a/nail.h +++ b/nail.h @@ -2442,6 +2442,7 @@ VL char const weekday_names[7 + 1][4]; VL char const uagent[sizeof VAL_UAGENT]; VL char const n_error[sizeof n_ERROR]; +VL char const n_empty[1]; VL ui16_t const class_char[1 + 0x7F]; #endif diff --git a/nam_a_grp.c b/nam_a_grp.c index 11460a5e..287964b0 100644 --- a/nam_a_grp.c +++ b/nam_a_grp.c @@ -1799,7 +1799,8 @@ c_customhdr(void *v){ if(pstate & PS_WYSHLIST_SAW_CONTROL){ n_err(_("`customhdr': control characters not allowed: %s: %s%s\n"), - hcp, n_shexp_quote_cp(*argv, FAL0), (argv[1] != NULL ? "..." : "")); + hcp, n_shexp_quote_cp(*argv, FAL0), + (argv[1] != NULL ? "..." : n_empty)); rv = 1; goto jleave; } diff --git a/quit.c b/quit.c index 03999ed3..addec9eb 100644 --- a/quit.c +++ b/quit.c @@ -621,7 +621,7 @@ save_mbox_for_possible_quitstuff(void) /* TODO try to get rid of that */ NYD_ENTER; if ((cp = expand("&")) == NULL) - cp = ""; + cp = n_empty; n_strscpy(_mboxname, cp, sizeof _mboxname); NYD_LEAVE; } diff --git a/send.c b/send.c index 775d234c..7767d30f 100644 --- a/send.c +++ b/send.c @@ -207,7 +207,7 @@ _pipefile(struct mime_handler *mhp, struct mimepart const *mpp, FILE **qbuf, /* NAIL_FILENAME */ if (mpp == NULL || (cp = mpp->m_filename) == NULL) - cp = ""; + cp = n_empty; env_addon[0] = str_concat_csvl(&s, NAILENV_FILENAME, "=", cp, NULL)->s; /* NAIL_FILENAME_GENERATED *//* TODO pathconf NAME_MAX; but user can create @@ -219,7 +219,7 @@ _pipefile(struct mime_handler *mhp, struct mimepart const *mpp, FILE **qbuf, /* NAIL_CONTENT{,_EVIDENCE} */ if (mpp == NULL || (cp = mpp->m_ct_type_plain) == NULL) - cp = ""; + cp = n_empty; env_addon[2] = str_concat_csvl(&s, NAILENV_CONTENT, "=", cp, NULL)->s; if (mpp != NULL && mpp->m_ct_type_usr_ovwr != NULL) @@ -1353,7 +1353,7 @@ put_from_(FILE *fp, struct mimepart *ip, ui64_t *stats) } else { froma = myname; date = time_current.tc_ctime; - nl = ""; + nl = n_empty; } n_COLOUR( n_colour_put(fp, n_COLOUR_ID_VIEW_FROM_, NULL); ) @@ -1392,7 +1392,7 @@ sendmp(struct message *mp, FILE *obuf, struct ignoretab *doign, sz = 0; { bool_t nozap; - char const *cpre = "", *csuf = ""; + char const *cpre = n_empty, *csuf = n_empty; #ifdef HAVE_COLOUR struct n_colour_pen *cpen = n_colour_pen_create(n_COLOUR_ID_VIEW_FROM_,NULL); struct str const *sp = n_colour_pen_to_str(cpen); @@ -1411,7 +1411,7 @@ sendmp(struct message *mp, FILE *obuf, struct ignoretab *doign, if (nozap) sz = fprintf(obuf, "%s%.*sFrom %s %s%s\n", cpre, (int)qf.qf_pfix_len, - (qf.qf_pfix_len != 0 ? qf.qf_pfix : ""), fakefrom(mp), + (qf.qf_pfix_len != 0 ? qf.qf_pfix : n_empty), fakefrom(mp), fakedate(mp->m_time), csuf); } else if (nozap) { if (qf.qf_pfix_len > 0) { diff --git a/shexp.c b/shexp.c index db1687bb..151c9688 100644 --- a/shexp.c +++ b/shexp.c @@ -272,7 +272,7 @@ a_shexp_var(struct a_shexp_var_stack *svsp) (rv = getenv(cp)) != NULL) svsp->svs_len = strlen(svsp->svs_dat = rv); else - svsp->svs_len = 0, svsp->svs_dat = n_UNCONST(""); + svsp->svs_len = 0, svsp->svs_dat = n_UNCONST(n_empty); } if (c != '\0') goto jrecurse; @@ -574,7 +574,7 @@ jerr: s2 = n_shexp_quote_cp(n_string_cp(sgcp->sgc_outer), FAL0); s3 = "/"; }else - s2 = s3 = ""; + s2 = s3 = n_empty; n_err("%s: %s%s%s\n", V_(ccp), s2, s3, n_shexp_quote_cp(sgcp->sgc_patdat, FAL0)); diff --git a/smtp.c b/smtp.c index ddb66ee8..ade57c86 100644 --- a/smtp.c +++ b/smtp.c @@ -299,7 +299,7 @@ jsend: if (options & OPT_DEBUG) { slp->buf[blen - 1] = '\0'; - n_err(">>> %s%s\n", (*slp->buf == '.' ? "." : ""), slp->buf); + n_err(">>> %s%s\n", (*slp->buf == '.' ? "." : n_empty), slp->buf); continue; } if (*slp->buf == '.') diff --git a/socket.c b/socket.c index a9d657c9..b071842a 100644 --- a/socket.c +++ b/socket.c @@ -330,7 +330,7 @@ jpseudo_jump: NULL, 0, NI_NUMERICHOST)) memcpy(hbuf, "unknown host", sizeof("unknown host")); n_err(_("%sConnecting to %s:%s ..."), - (res == res0 ? "" : "\n"), hbuf, serv); + (res == res0 ? n_empty : "\n"), hbuf, serv); } sofd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); @@ -413,7 +413,7 @@ jjumped: memcpy(&servaddr.sin_addr, *pptr, sizeof(struct in_addr)); if (options & OPT_VERB) n_err(_("%sConnecting to %s:%d ... "), - "", inet_ntoa(**pptr), (int)urlp->url_portno); + n_empty, inet_ntoa(**pptr), (int)urlp->url_portno); # ifdef HAVE_SO_SNDTIMEO (void)setsockopt(sofd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv); # endif diff --git a/spam.c b/spam.c index f22dba85..b85c558a 100644 --- a/spam.c +++ b/spam.c @@ -196,7 +196,7 @@ _spam_action(enum spam_action sa, int *ip) vc.vc_action = sa; vc.vc_verbose = ((options & OPT_VERB) != 0); vc.vc_progress = (!vc.vc_verbose && ((options & OPT_INTERACTIVE) != 0)); - vc.vc_esep = vc.vc_progress ? "\n" : ""; + vc.vc_esep = vc.vc_progress ? "\n" : n_empty; /* Check and setup the desired spam interface */ if ((cp = ok_vlook(spam_interface)) == NULL) { diff --git a/ssl_tls.c b/ssl_tls.c index 0783a84a..54f88362 100644 --- a/ssl_tls.c +++ b/ssl_tls.c @@ -451,7 +451,7 @@ _ssl_verify_cb(int success, X509_STORE_CTX *store) _ssl_msgno = 0; } n_err(_(" Certificate depth %d %s\n"), - X509_STORE_CTX_get_error_depth(store), (success ? "" : V_(n_error))); + X509_STORE_CTX_get_error_depth(store), (success ? n_empty : V_(n_error))); if ((cert = X509_STORE_CTX_get_current_cert(store)) != NULL) { X509_NAME_oneline(X509_get_subject_name(cert), data, sizeof data); @@ -681,10 +681,10 @@ _ssl_load_verifications(SSL_CTX *ctxp) if (ca_dir != NULL) { m1 = ca_dir; - m2 = (ca_file != NULL) ? _(" or ") : ""; + m2 = (ca_file != NULL) ? _(" or ") : n_empty; } else - m1 = m2 = ""; - m3 = (ca_file != NULL) ? ca_file : ""; + m1 = m2 = n_empty; + m3 = (ca_file != NULL) ? ca_file : n_empty; ssl_gen_err(_("Error loading %s%s%s\n"), m1, m2, m3); goto jleave; } @@ -1003,8 +1003,8 @@ jleave: jerr: if (dowarn) n_err(_("Could not find a certificate for %s%s%s\n"), - xname, (xname2 != NULL ? _("or ") : ""), - (xname2 != NULL ? xname2 : "")); + xname, (xname2 != NULL ? _("or ") : n_empty), + (xname2 != NULL ? xname2 : n_empty)); goto jleave; } diff --git a/strings.c b/strings.c index 3830f1c5..493c916a 100644 --- a/strings.c +++ b/strings.c @@ -817,7 +817,7 @@ n_string_cp_const(struct n_string const *self){ ((struct n_string*)n_UNCONST(self))->s_dat[self->s_len] = '\0'; rv = self->s_dat; }else - rv = ""; + rv = n_empty; NYD2_LEAVE; return rv; } diff --git a/thread.c b/thread.c index 6f097937..b6bbd3fe 100644 --- a/thread.c +++ b/thread.c @@ -751,7 +751,7 @@ c_sort(void *vp) ms[n].ms_u.ms_char = sstrdup(showname ? realname(cp) : skin(cp)); makelow(ms[n].ms_u.ms_char); } else - ms[n].ms_u.ms_char = sstrdup(""); + ms[n].ms_u.ms_char = sstrdup(n_empty); break; default: case SORT_SUBJECT: @@ -763,7 +763,7 @@ c_sort(void *vp) free(out.s); makelow(ms[n].ms_u.ms_char); } else - ms[n].ms_u.ms_char = sstrdup(""); + ms[n].ms_u.ms_char = sstrdup(n_empty); break; } ms[n++].ms_n = i; diff --git a/tty.c b/tty.c index f4ab42a6..02434ef7 100644 --- a/tty.c +++ b/tty.c @@ -1163,7 +1163,8 @@ a_tty_vinuni(struct a_tty_line *tlp){ cpre = csuf = NULL; #endif printf(_("%sPlease enter Unicode code point:%s "), - (cpre != NULL ? cpre->s : ""), (csuf != NULL ? csuf->s : "")); + (cpre != NULL ? cpre->s : n_empty), + (csuf != NULL ? csuf->s : n_empty)); } fflush(stdout); @@ -3978,7 +3979,8 @@ jredo: if(!ok_blook(line_editor_disable)) goto jredo; nn = (n_lex_input)(lif, orig_prompt, linebuf, linesize, - (n == 0 ? "" : savestrbuf(*linebuf, n)) n_MEMORY_DEBUG_ARGSCALL); + (n == 0 ? n_empty : savestrbuf(*linebuf, n)) + n_MEMORY_DEBUG_ARGSCALL); } NYD_LEAVE; return (int)nn; @@ -4202,14 +4204,14 @@ c_bind(void *v){ if(entlen & SI32_MIN){ /* struct{si32_t buf_len_iscap; si32_t cap_len; * char buf[]+NUL;} */ - for(bsep = "", + for(bsep = n_empty, u.cp = (char const*) &n_UNALIGN(si32_t const*,cnvdat)[2]; (c.c = *u.cp) != '\0'; ++u.cp){ if(asciichar(c.c) && !cntrlchar(c.c)) cbuf[1] = c.c, cbufp = cbuf; else - cbufp = ""; + cbufp = n_empty; fprintf(fp, "%s%02X%s", bsep, (ui32_t)(ui8_t)c.c, cbufp); bsep = " "; @@ -4231,13 +4233,13 @@ c_bind(void *v){ /* I18N: `bind' sequence not working, either because it is * I18N: using Unicode and that is not available in the locale, * I18N: or a termcap(5)/terminfo(5) sequence won't work out */ - ? _("# ") : ""), + ? _("# ") : n_empty), a_tty_bind_ctx_maps[lif].tbcm_name, tbcp->tbc_seq, n_shexp_quote_cp(tbcp->tbc_exp, TRU1), - (tbcp->tbc_flags & a_TTY_BIND_NOCOMMIT ? "@" : ""), - (!(options & OPT_D_VV) ? "" + (tbcp->tbc_flags & a_TTY_BIND_NOCOMMIT ? "@" : n_empty), + (!(options & OPT_D_VV) ? n_empty : (tbcp->tbc_flags & a_TTY_BIND_FUN_INTERNAL - ? _(" # MLE internal") : "")) + ? _(" # MLE internal") : n_empty)) ); } if(!aster || ++lif >= n__LEXINPUT_CTX_MAX) diff --git a/ui_str.c b/ui_str.c index 69227b89..b26f4739 100644 --- a/ui_str.c +++ b/ui_str.c @@ -490,7 +490,7 @@ bidi_info_create(struct bidi_info *bip) NYD_ENTER; memset(bip, 0, sizeof *bip); - bip->bi_start.s = bip->bi_end.s = n_UNCONST(""); + bip->bi_start.s = bip->bi_end.s = n_UNCONST(n_empty); #ifdef HAVE_NATCH_CHAR if ((options & OPT_UNICODE) && (hb = ok_vlook(headline_bidi)) != NULL) { diff --git a/urlcrecry.c b/urlcrecry.c index 1cf3f6a2..cd1b8117 100644 --- a/urlcrecry.c +++ b/urlcrecry.c @@ -565,7 +565,7 @@ _agent_shell_lookup(struct url *urlp, char const *comm) /* TODO v15-compat */ if (s.s != NULL) urlp->url_pass.s = savestrbuf(s.s, urlp->url_pass.l = s.l); else if (cl > 0) - urlp->url_pass.s = n_UNCONST(""), urlp->url_pass.l = 0; + urlp->url_pass.s = n_UNCONST(n_empty), urlp->url_pass.l = 0; rv = TRU1; jleave: if (s.s != NULL) @@ -1267,8 +1267,8 @@ jleave: ac_free(vbuf); if (ccp != NULL && (options & OPT_D_VV)) n_err(_("Credentials: host %s, user %s, pass %s\n"), - addr, (ccp->cc_user.s != NULL ? ccp->cc_user.s : ""), - (ccp->cc_pass.s != NULL ? ccp->cc_pass.s : "")); + addr, (ccp->cc_user.s != NULL ? ccp->cc_user.s : n_empty), + (ccp->cc_pass.s != NULL ? ccp->cc_pass.s : n_empty)); NYD_LEAVE; return (ccp != NULL); } @@ -1390,8 +1390,8 @@ js2pass: jleave: if (ccp != NULL && (options & OPT_D_VV)) n_err(_("Credentials: host %s, user %s, pass %s\n"), - urlp->url_h_p.s, (ccp->cc_user.s != NULL ? ccp->cc_user.s : ""), - (ccp->cc_pass.s != NULL ? ccp->cc_pass.s : "")); + urlp->url_h_p.s, (ccp->cc_user.s != NULL ? ccp->cc_user.s : n_empty), + (ccp->cc_pass.s != NULL ? ccp->cc_pass.s : n_empty)); NYD_LEAVE; return (ccp != NULL); } -- 2.11.4.GIT