From: Pierre Habouzit Date: Sun, 29 Oct 2006 13:40:43 +0000 (+0100) Subject: use m_strdup and m_strlen that are inlined for efficiency X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=7f7a0be369840b290248e5b0302beb447fa1b3cd use m_strdup and m_strlen that are inlined for efficiency --- diff --git a/Makefile.am b/Makefile.am index 8df99a3..b201ba8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -112,7 +112,7 @@ EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ mkchangelog.sh cvslog2changelog.pl mutt_idna.h \ regex.c mutt_libesmtp.h crypt-gpgme.h -muttng_dotlock_SOURCES = mutt_dotlock.c +muttng_dotlock_SOURCES = dotlock.c muttng_dotlock_LDADD = @LIBOBJS@ muttng_dotlock_DEPENDENCIES = @LIBOBJS@ @@ -124,10 +124,7 @@ pgpewrapng_SOURCES = pgpewrap.c pgpewrapng_LDADD = pgpewrapng_DEPENDENCIES = -mutt_dotlock.c: dotlock.c - cp $(srcdir)/dotlock.c mutt_dotlock.c - -CLEANFILES = mutt_dotlock.c stamp-doc-rc makedoc \ +CLEANFILES = stamp-doc-rc makedoc \ keymap_alldefs.h keymap_defs.h version.h ACLOCAL_AMFLAGS = -I m4 diff --git a/account.c b/account.c index dc877e7..c22b57d 100644 --- a/account.c +++ b/account.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -22,7 +23,6 @@ #include "account.h" #include "url.h" -#include "lib/str.h" /* mutt_account_match: compare account info (host/port/user/login) */ int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2) diff --git a/alias.c b/alias.c index 222a01c..a4e984f 100644 --- a/alias.c +++ b/alias.c @@ -15,9 +15,9 @@ #include #include +#include #include -#include "lib/str.h" #include "lib/rx.h" #include "lib/debug.h" @@ -75,7 +75,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS * a, LIST ** expn) if (!i) { u = p_new(LIST, 1); - u->data = str_dup (a->mailbox); + u->data = m_strdup(a->mailbox); u->next = *expn; *expn = u; w = rfc822_cpy_adr (t); @@ -257,7 +257,7 @@ retry_name: new = p_new(ALIAS, 1); new->self = new; - new->name = str_dup (buf); + new->name = m_strdup(buf); mutt_addrlist_to_local (adr); @@ -293,7 +293,7 @@ retry_name: mutt_free_alias (&new); return; } - new->addr->personal = str_dup (buf); + new->addr->personal = m_strdup(buf); buf[0] = 0; rfc822_write_address (buf, sizeof (buf), new->addr, 1); @@ -409,7 +409,7 @@ int mutt_alias_complete (char *s, size_t buflen) if (a->name && strstr (a->name, s) == a->name) { if (!bestname[0]) /* init */ strfcpy (bestname, a->name, - min (str_len (a->name) + 1, sizeof (bestname))); + min (m_strlen(a->name) + 1, sizeof (bestname))); else { for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++); bestname[i] = 0; @@ -421,7 +421,7 @@ int mutt_alias_complete (char *s, size_t buflen) if (bestname[0] != 0) { if (str_cmp (bestname, s) != 0) { /* we are adding something to the completion */ - strfcpy (s, bestname, str_len (bestname) + 1); + strfcpy (s, bestname, m_strlen(bestname) + 1); return 1; } diff --git a/attach.c b/attach.c index 6c7a9aa..6cbaa6b 100644 --- a/attach.c +++ b/attach.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "mx.h" #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -297,7 +297,7 @@ static int is_mmnoask (const char *buf) } } else { - lng = str_len (p); + lng = m_strlen(p); if (buf[lng] == '/' && str_ncasecmp (buf, p, lng) == 0) return (1); } @@ -315,7 +315,7 @@ void mutt_check_lookup_list (BODY * b, char *type, int len) int i; for (; t; t = t->next) { - i = str_len (t->data) - 1; + i = m_strlen(t->data) - 1; if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) { @@ -366,7 +366,7 @@ int mutt_is_autoview (BODY * b, const char *type) } for (; t; t = t->next) { - i = str_len (t->data) - 1; + i = m_strlen(t->data) - 1; if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) @@ -427,7 +427,7 @@ int mutt_view_attachment (FILE * fp, BODY * a, int flag, HEADER * hdr, strfcpy (command, entry->command, sizeof (command)); if (fp) { - fname = str_dup (a->filename); + fname = m_strdup(a->filename); mutt_sanitize_filename (fname, 1); } else diff --git a/browser.c b/browser.c index 57cdbb1..03e1db9 100644 --- a/browser.c +++ b/browser.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -34,7 +35,6 @@ #endif #include "sidebar.h" -#include "lib/str.h" #include "lib/list.h" #include @@ -442,8 +442,8 @@ static void add_folder (MUTTMENU * m, struct browser_state *state, } (state->entry)[state->entrylen].new = new; - (state->entry)[state->entrylen].name = str_dup (name); - (state->entry)[state->entrylen].desc = str_dup (name); + (state->entry)[state->entrylen].name = m_strdup(name); + (state->entry)[state->entrylen].desc = m_strdup(name); #ifdef USE_IMAP (state->entry)[state->entrylen].imap = 0; #endif @@ -484,7 +484,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, continue; nntp_sync_sidebar (data); if (prefix && *prefix && strncmp (prefix, data->group, - str_len (prefix)) != 0) + m_strlen(prefix)) != 0) continue; if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -534,7 +534,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, continue; /* we don't need . */ if (prefix && *prefix - && str_ncmp (prefix, de->d_name, str_len (prefix)) != 0) + && str_ncmp (prefix, de->d_name, m_strlen(prefix)) != 0) continue; if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -775,7 +775,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, } else { #endif - for (i = str_len (f) - 1; i > 0 && f[i] != '/'; i--); + for (i = m_strlen(f) - 1; i > 0 && f[i] != '/'; i--); if (i > 0) { if (f[0] == '/') { if (i > sizeof (LastDir) - 1) @@ -893,7 +893,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, strfcpy (OldLastDir, LastDir, sizeof (OldLastDir)); if (str_cmp (state.entry[menu->current].name, "..") == 0) { - if (str_cmp ("..", LastDir + str_len (LastDir) - 2) == 0) + if (str_cmp ("..", LastDir + m_strlen(LastDir) - 2) == 0) strcat (LastDir, "/.."); /* __STRCAT_CHECKED__ */ else { char *p = strrchr (LastDir + 1, '/'); @@ -921,7 +921,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, strfcpy (LastDir, state.entry[menu->current].name, sizeof (LastDir)); /* tack on delimiter here */ - n = str_len (LastDir) + 1; + n = m_strlen(LastDir) + 1; /* special case "" needs no delimiter */ url_parse_ciss (&url, state.entry[menu->current].name); @@ -1006,7 +1006,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, if (ff.tagged) { mutt_concat_path (full, LastDir, ff.name, sizeof (full)); mutt_expand_path (full, sizeof (full)); - tfiles[j++] = str_dup (full); + tfiles[j++] = m_strdup(full); } } *files = tfiles; @@ -1015,7 +1015,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, *numfiles = 1; tfiles = p_new(char *, *numfiles); mutt_expand_path (f, flen); - tfiles[0] = str_dup (f); + tfiles[0] = m_strdup(f); *files = tfiles; } } @@ -1129,7 +1129,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, #endif { /* add '/' at the end of the directory name if not already there */ - int len = str_len (LastDir); + int len = m_strlen(LastDir); if (len && LastDir[len - 1] != '/' && sizeof (buf) > len) buf[len] = '/'; @@ -1397,7 +1397,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat), newsgroup_format_str, (unsigned long) &folder, M_FORMAT_ARROWCURSOR); - f->desc = str_dup (buffer); */ + f->desc = m_strdup(buffer); */ if (menu->current + 1 < menu->max) menu->current++; menu->redraw = REDRAW_MOTION_RESYNCH; @@ -1495,7 +1495,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat), newsgroup_format_str, (unsigned long) &folder, M_FORMAT_ARROWCURSOR); - f->desc = str_dup (buffer); + f->desc = m_strdup(buffer); } */ } if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) { diff --git a/buffer.c b/buffer.c index bfa0dd8..7f06132 100644 --- a/buffer.c +++ b/buffer.c @@ -15,10 +15,10 @@ #include #include +#include #include "buffer.h" -#include "lib/str.h" #include "lib/debug.h" /* @@ -56,15 +56,15 @@ BUFFER *mutt_buffer_from (BUFFER * b, const char *seed) return NULL; b = mutt_buffer_init (b); - b->data = str_dup (seed); - b->dsize = str_len (seed); + b->data = m_strdup(seed); + b->dsize = m_strlen(seed); b->dptr = (char *) b->data + b->dsize; return b; } void mutt_buffer_addstr (BUFFER * buf, const char *s) { - mutt_buffer_add (buf, s, str_len (s)); + mutt_buffer_add (buf, s, m_strlen(s)); } void mutt_buffer_addch (BUFFER * buf, char c) @@ -227,8 +227,8 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags) p_delete(&expn.data); } else if (expn.data) { - expnlen = str_len (expn.data); - tok->dsize = expnlen + str_len (tok->dptr) + 1; + expnlen = m_strlen(expn.data); + tok->dsize = expnlen + m_strlen(tok->dptr) + 1; ptr = xmalloc(tok->dsize); memcpy (ptr, expn.data, expnlen); strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */ diff --git a/buffy.c b/buffy.c index f6b2d4b..09b281a 100644 --- a/buffy.c +++ b/buffy.c @@ -73,13 +73,13 @@ static int fseeko_last_message (FILE * f) * reads will be on block boundaries, which might increase efficiency. */ while ((pos -= bytes_read) >= 0) { /* we save in the buffer at the end the first 7 chars from the last read */ - strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * str_len(CRLF) */ + strncpy (buffer + BUFSIZ, buffer, 5 + 2); /* 2 == 2 * m_strlen(CRLF) */ fseeko (f, pos, SEEK_SET); bytes_read = fread (buffer, sizeof (char), bytes_read, f); if (bytes_read == -1) return -1; for (i = bytes_read; --i >= 0;) - if (!str_ncmp (buffer + i, "\n\nFrom ", str_len ("\n\nFrom "))) { /* found it - go to the beginning of the From */ + if (!str_ncmp (buffer + i, "\n\nFrom ", m_strlen("\n\nFrom "))) { /* found it - go to the beginning of the From */ fseeko (f, pos + i + 2, SEEK_SET); return 0; } @@ -222,7 +222,7 @@ int buffy_parse_mailboxes (BUFFER * path, BUFFER * s, unsigned long data, if (i < 0) { tmp = p_new(BUFFY, 1); - tmp->path = str_dup (buf); + tmp->path = m_strdup(buf); tmp->magic = 0; list_push_back (&Incoming, tmp); i = Incoming->length-1; @@ -511,7 +511,7 @@ int buffy_list (void) pos = 0; first = 1; buffylist[0] = 0; - pos += str_len (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ + pos += m_strlen(strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ if (Incoming) { for (i = 0; i < Incoming->length; i++) { tmp = (BUFFY*) Incoming->data[i]; @@ -522,19 +522,19 @@ int buffy_list (void) strfcpy (path, tmp->path, sizeof (path)); mutt_pretty_mailbox (path); - if (!first && pos + str_len (path) >= COLS - 7) + if (!first && pos + m_strlen(path) >= COLS - 7) break; if (!first) - pos += str_len (strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ + pos += m_strlen(strncat (buffylist + pos, ", ", sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ /* Prepend an asterisk to mailboxes not already notified */ if (!tmp->notified) { - /* pos += str_len (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */ + /* pos += m_strlen(strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); __STRNCAT_CHECKED__ */ tmp->notified = 1; BuffyNotify--; } - pos += str_len (strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ + pos += m_strlen(strncat (buffylist + pos, path, sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ first = 0; } } diff --git a/charset.c b/charset.c index 35d71b9..dcbe1ee 100644 --- a/charset.c +++ b/charset.c @@ -23,13 +23,13 @@ #include #include +#include #include #include "mutt.h" #include "charset.h" #include "ascii.h" -#include "lib/str.h" #ifndef EILSEQ # define EILSEQ EINVAL @@ -197,15 +197,15 @@ void mutt_set_langinfo_charset (void) mutt_canonical_charset (buff2, sizeof (buff2), buff); /* finally, set $charset */ - if (!(Charset = str_dup (buff2))) - Charset = str_dup ("iso-8859-1"); + if (!(Charset = m_strdup(buff2))) + Charset = m_strdup("iso-8859-1"); } #else void mutt_set_langinfo_charset (void) { - Charset = str_dup ("iso-8859-1"); + Charset = m_strdup("iso-8859-1"); } #endif @@ -316,7 +316,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, for (t = inrepls; *t; t++) { const char *ib1 = *t; - size_t ibl1 = str_len (*t); + size_t ibl1 = m_strlen(*t); char *ob1 = ob; size_t obl1 = obl; @@ -336,7 +336,7 @@ size_t mutt_iconv (iconv_t cd, const char **inbuf, size_t * inbytesleft, outrepl = "?"; my_iconv(cd, 0, 0, &ob, &obl); if (obl) { - int n = str_len (outrepl); + int n = m_strlen(outrepl); if (n > obl) { outrepl = "?"; @@ -387,7 +387,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to, else outrepl = "?"; - len = str_len (s); + len = m_strlen(s); ib = s, ibl = len + 1; obl = MB_LEN_MAX * ibl; ob = buf = xmalloc(obl + 1); @@ -542,7 +542,7 @@ const char *mutt_get_first_charset (const char *charset) const char *c, *c1; c = charset; - if (!str_len (c)) + if (!m_strlen(c)) return "us-ascii"; if (!(c1 = strchr (c, ':'))) return ((char*) charset); @@ -592,14 +592,14 @@ int mutt_convert_nonmime_string (char **ps) char *s = NULL; char *fromcode; size_t m, n; - size_t ulen = str_len (*ps); + size_t ulen = m_strlen(*ps); size_t slen; if (!u || !*u) return 0; c1 = strchr (c, ':'); - n = c1 ? c1 - c : str_len (c); + n = c1 ? c1 - c : m_strlen(c); if (!n) continue; fromcode = p_dupstr(c, n); diff --git a/color.c b/color.c index 3bee605..81adfbb 100644 --- a/color.c +++ b/color.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -20,7 +21,6 @@ #include "mutt_curses.h" #include "mapping.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -510,7 +510,7 @@ add_pattern (COLOR_LINE ** top, const char *s, int sensitive, return (-1); } tmp->next = *top; - tmp->pattern = str_dup (s); + tmp->pattern = m_strdup(s); #ifdef HAVE_COLOR if (fg != -1 && bg != -1) { tmp->fg = fg; diff --git a/commands.c b/commands.c index de56182..52fe118 100644 --- a/commands.c +++ b/commands.c @@ -13,6 +13,7 @@ #endif #include + #include #include "mutt.h" @@ -41,7 +42,6 @@ #include "buffy.h" #endif -#include "lib/str.h" #include "lib/debug.h" #include @@ -859,7 +859,7 @@ void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp) size_t l; for (p = b->parameter; p; p = p->next) { - l = str_len (buf); + l = m_strlen(buf); rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials); snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp); diff --git a/complete.c b/complete.c index f451e1a..a385af4 100644 --- a/complete.c +++ b/complete.c @@ -20,7 +20,7 @@ #include "nntp.h" #endif -#include "lib/str.h" +#include #include "lib/debug.h" #include @@ -60,7 +60,7 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. * find the first subscribed newsgroup */ - if ((len = str_len (filepart)) == 0) { + if ((len = m_strlen(filepart)) == 0) { for (; l; l = l->next) { NNTP_DATA *data = (NNTP_DATA *) l->data; @@ -172,7 +172,7 @@ int mutt_complete (char *s, size_t slen) * special case to handle when there is no filepart yet. find the first * file/directory which is not ``.'' or ``..'' */ - if ((len = str_len (filepart)) == 0) { + if ((len = m_strlen(filepart)) == 0) { while ((de = readdir (dirp)) != NULL) { if (str_cmp (".", de->d_name) != 0 && str_cmp ("..", de->d_name) != 0) { @@ -203,14 +203,14 @@ int mutt_complete (char *s, size_t slen) /* check to see if it is a directory */ if (dirpart[0]) { strfcpy (buf, exp_dirpart, sizeof (buf)); - strfcpy (buf + str_len (buf), "/", sizeof (buf) - str_len (buf)); + strfcpy (buf + m_strlen(buf), "/", sizeof (buf) - m_strlen(buf)); } else buf[0] = 0; - strfcpy (buf + str_len (buf), filepart, sizeof (buf) - str_len (buf)); + strfcpy (buf + m_strlen(buf), filepart, sizeof (buf) - m_strlen(buf)); if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR)) - strfcpy (filepart + str_len (filepart), "/", - sizeof (filepart) - str_len (filepart)); + strfcpy (filepart + m_strlen(filepart), "/", + sizeof (filepart) - m_strlen(filepart)); init = 1; } } @@ -221,8 +221,8 @@ int mutt_complete (char *s, size_t slen) strfcpy (s, dirpart, slen); if (str_cmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+') - strfcpy (s + str_len (s), "/", slen - str_len (s)); - strfcpy (s + str_len (s), filepart, slen - str_len (s)); + strfcpy (s + m_strlen(s), "/", slen - m_strlen(s)); + strfcpy (s + m_strlen(s), filepart, slen - m_strlen(s)); } else strfcpy (s, filepart, slen); diff --git a/compose.c b/compose.c index f057003..f5d6d2b 100644 --- a/compose.c +++ b/compose.c @@ -16,6 +16,7 @@ #endif #include +#include #include #include "mutt.h" @@ -42,7 +43,6 @@ #include "nntp.h" #endif -#include "lib/str.h" #include #include @@ -223,14 +223,14 @@ static void redraw_mix_line (LIST * chain) if (t && t[0] == '0' && t[1] == '\0') t = ""; - if (c + str_len (t) + 2 >= COLS - SW) + if (c + m_strlen(t) + 2 >= COLS - SW) break; addstr (NONULL (t)); if (chain->next) addstr (", "); - c += str_len (t) + 2; + c += m_strlen(t) + 2; } } #endif /* MIXMASTER */ @@ -621,7 +621,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ && buf[0]) { p_delete(&msg->env->newsgroups); str_skip_trailws (buf); - msg->env->newsgroups = str_dup (str_skip_initws (buf)); + msg->env->newsgroups = m_strdup(str_skip_initws (buf)); move (HDR_TO, HDR_XOFFSET); clrtoeol (); if (msg->env->newsgroups) @@ -639,7 +639,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ && buf[0]) { p_delete(&msg->env->followup_to); str_skip_trailws (buf); - msg->env->followup_to = str_dup (str_skip_initws (buf)); + msg->env->followup_to = m_strdup(str_skip_initws (buf)); move (HDR_CC, HDR_XOFFSET); clrtoeol (); if (msg->env->followup_to) @@ -656,7 +656,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0 && buf[0]) { p_delete(&msg->env->x_comment_to); - msg->env->x_comment_to = str_dup (buf); + msg->env->x_comment_to = m_strdup(buf); move (HDR_BCC, HDR_XOFFSET); clrtoeol (); if (msg->env->x_comment_to) diff --git a/compress.c b/compress.c index 1dea354..14910a8 100644 --- a/compress.c +++ b/compress.c @@ -8,6 +8,7 @@ */ #include +#include #include #include "mutt.h" @@ -18,7 +19,6 @@ #include "mbox.h" #include "mutt_curses.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -131,7 +131,7 @@ static void set_path (CONTEXT * ctx) /* Uncompress to /tmp */ mutt_mktemp (tmppath); - ctx->path = p_dupstr(tmppath, str_len(tmppath)); + ctx->path = p_dupstr(tmppath, m_strlen(tmppath)); } static int get_size (const char *path) @@ -189,7 +189,7 @@ static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx) mutt_FormatString (expanded, sizeof (expanded), cmd, compresshook_format_str, (unsigned long) ctx, 0); - return str_dup (expanded); + return m_strdup(expanded); } int mutt_check_mailbox_compressed (CONTEXT * ctx) diff --git a/copy.c b/copy.c index 05768a3..2d205de 100644 --- a/copy.c +++ b/copy.c @@ -12,6 +12,7 @@ #endif #include +#include #include "mutt.h" #include "ascii.h" @@ -23,7 +24,6 @@ #include "mutt_crypt.h" #include "mutt_idna.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -155,7 +155,7 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end, if (!headers[x]) headers[x] = this_one; else { - p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1); + p_realloc(&headers[x], m_strlen(headers[x]) + m_strlen(this_one) + 1); strcat(headers[x], this_one); /* __STRCAT_CHECKED__ */ p_delete(&this_one); } @@ -206,7 +206,7 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end, /* Find x -- the array entry where this header is to be saved */ if (flags & CH_REORDER) { for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) { - if (!ascii_strncasecmp (buf, t->data, str_len (t->data))) { + if (!ascii_strncasecmp (buf, t->data, m_strlen(t->data))) { debug_print (2, ("Reorder: %s matches %s\n", t->data, buf)); break; } @@ -219,17 +219,17 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end, if (!ignore) { debug_print (2, ("Reorder: x = %d; hdr_count = %d\n", x, hdr_count)); if (!this_one) - this_one = str_dup (buf); + this_one = m_strdup(buf); /* we do want to see all lines if this header doesn't feature * abbreviations (curline is 0), $max_display_recips is 0 and * while the number hasn't reached $max_display_recips yet */ else if (curline == 0 || MaxDispRecips == 0 || ++curline <= MaxDispRecips) { - p_realloc(&this_one, str_len(this_one) + str_len(buf) + 1); + p_realloc(&this_one, m_strlen(this_one) + m_strlen(buf) + 1); strcat (this_one, buf); /* __STRCAT_CHECKED__ */ /* only for the first line which doesn't exeeds * $max_display_recips: abbreviate it */ } else if (curline == MaxDispRecips+1) { - p_realloc(&this_one, str_len(this_one) + 5); + p_realloc(&this_one, m_strlen(this_one) + 5); strcat (this_one, " ..."); } } @@ -245,7 +245,7 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end, if (!headers[x]) headers[x] = this_one; else { - p_realloc(&headers[x], str_len(headers[x]) + str_len(this_one) + 1); + p_realloc(&headers[x], m_strlen(headers[x]) + m_strlen(this_one) + 1); strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */ p_delete(&this_one); } @@ -535,12 +535,12 @@ _mutt_copy_message (FILE * fpout, FILE * fpin, HEADER * hdr, BODY * body, char date[SHORT_STRING]; mutt_make_date (date, sizeof (date)); - date[5] = date[str_len (date) - 1] = '\"'; + date[5] = date[m_strlen(date) - 1] = '\"'; /* Count the number of lines and bytes to be deleted */ fseeko (fpin, body->offset, SEEK_SET); new_lines = hdr->lines - - count_delete_lines (fpin, body, &new_length, str_len (date)); + count_delete_lines (fpin, body, &new_length, m_strlen(date)); /* Copy the headers */ if (mutt_copy_header (fpin, hdr, fpout, @@ -818,7 +818,7 @@ static void format_address_header (char **h, ADDRESS * a) int l, linelen, buflen, count; - linelen = str_len (*h); + linelen = m_strlen(*h); buflen = linelen + 3; @@ -831,7 +831,7 @@ static void format_address_header (char **h, ADDRESS * a) rfc822_write_address (buf, sizeof (buf), a, 0); a->next = tmp; - l = str_len (buf); + l = m_strlen(buf); if (count && linelen + l > 74) { strcpy (cbuf, "\n\t"); /* __STRCPY_CHECKED__ */ linelen = l + 8; @@ -849,7 +849,7 @@ static void format_address_header (char **h, ADDRESS * a) strcpy (c2buf, ","); /* __STRCPY_CHECKED__ */ } - buflen += l + str_len (cbuf) + str_len (c2buf); + buflen += l + m_strlen(cbuf) + m_strlen(c2buf); p_realloc(h, buflen); strcat (*h, cbuf); /* __STRCAT_CHECKED__ */ strcat (*h, buf); /* __STRCAT_CHECKED__ */ diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 5879e59..af921cd 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -19,6 +19,7 @@ #ifdef CRYPT_BACKEND_GPGME #include +#include #include #include "mutt.h" @@ -34,7 +35,6 @@ #include "recvattach.h" #include "sort.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -152,7 +152,7 @@ static const char *crypt_keyid (crypt_key_t * k) if (k->kobj && k->kobj->subkeys) { s = k->kobj->subkeys->keyid; - if ((!option (OPTPGPLONGIDS)) && (str_len (s) == 16)) + if ((!option (OPTPGPLONGIDS)) && (m_strlen(s) == 16)) /* Return only the short keyID. */ s += 8; } @@ -508,7 +508,7 @@ static char *data_object_to_tempfile (gpgme_data_t data, FILE ** ret_fp) } if (ret_fp) *ret_fp = fp; - return str_dup (tempfile); + return m_strdup(tempfile); } @@ -760,7 +760,7 @@ static BODY *sign_message (BODY * a, int use_smime) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("signed"); + t->subtype = m_strdup("signed"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -784,15 +784,15 @@ static BODY *sign_message (BODY * a, int use_smime) t = t->parts->next; t->type = TYPEAPPLICATION; if (use_smime) { - t->subtype = str_dup ("pkcs7-signature"); + t->subtype = m_strdup("pkcs7-signature"); mutt_set_parameter ("name", "smime.p7s", &t->parameter); t->encoding = ENCBASE64; t->use_disp = 1; t->disposition = DISPATTACH; - t->d_filename = str_dup ("smime.p7s"); + t->d_filename = m_strdup("smime.p7s"); } else { - t->subtype = str_dup ("pgp-signature"); + t->subtype = m_strdup("pgp-signature"); t->use_disp = 0; t->disposition = DISPINLINE; t->encoding = ENC7BIT; @@ -847,7 +847,7 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("encrypted"); + t->subtype = m_strdup("encrypted"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -857,18 +857,18 @@ BODY *pgp_gpgme_encrypt_message (BODY * a, char *keylist, int sign) t->parts = mutt_new_body (); t->parts->type = TYPEAPPLICATION; - t->parts->subtype = str_dup ("pgp-encrypted"); + t->parts->subtype = m_strdup("pgp-encrypted"); t->parts->encoding = ENC7BIT; t->parts->next = mutt_new_body (); t->parts->next->type = TYPEAPPLICATION; - t->parts->next->subtype = str_dup ("octet-stream"); + t->parts->next->subtype = m_strdup("octet-stream"); t->parts->next->encoding = ENC7BIT; t->parts->next->filename = outfile; t->parts->next->use_disp = 1; t->parts->next->disposition = DISPINLINE; t->parts->next->unlink = 1; /* delete after sending the message */ - t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime + t->parts->next->d_filename = m_strdup("msg.asc"); /* non pgp/mime can save */ return t; @@ -905,13 +905,13 @@ BODY *smime_gpgme_build_smime_entity (BODY * a, char *keylist) t = mutt_new_body (); t->type = TYPEAPPLICATION; - t->subtype = str_dup ("pkcs7-mime"); + t->subtype = m_strdup("pkcs7-mime"); mutt_set_parameter ("name", "smime.p7m", &t->parameter); mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter); t->encoding = ENCBASE64; /* The output of OpenSSL SHOULD be binary */ t->use_disp = 1; t->disposition = DISPATTACH; - t->d_filename = str_dup ("smime.p7m"); + t->d_filename = m_strdup("smime.p7m"); t->filename = outfile; t->unlink = 1; /*delete after sending the message */ t->parts = 0; @@ -1033,10 +1033,10 @@ static void show_fingerprint (gpgme_key_t key, STATE * state) return; is_pgp = (key->protocol == GPGME_PROTOCOL_OpenPGP); - buf = xmalloc(str_len (prefix) + str_len (s) * 4 + 2); + buf = xmalloc(m_strlen(prefix) + m_strlen(s) * 4 + 2); strcpy (buf, prefix); /* __STRCPY_CHECKED__ */ - p = buf + str_len (buf); - if (is_pgp && str_len (s) == 40) { /* PGP v4 style formatted. */ + p = buf + m_strlen(buf); + if (is_pgp && m_strlen(s) == 40) { /* PGP v4 style formatted. */ for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) { *p++ = s[0]; *p++ = s[1]; @@ -1301,7 +1301,7 @@ static int verify_one (BODY * sigbdy, STATE * s, if (notation->value) { state_attach_puts (notation->value, s); if (!(*notation->value - && (notation->value[str_len (notation->value) - 1] == + && (notation->value[m_strlen(notation->value) - 1] == '\n'))) state_attach_puts ("\n", s); } @@ -1799,7 +1799,7 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s) break; offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */ last_pos = offset; if (!str_ncmp ("-----BEGIN PGP ", buf, 15)) { @@ -1829,13 +1829,13 @@ int pgp_gpgme_application_handler (BODY * m, STATE * s) /* Copy PGP material to an data container */ armored_data = create_gpgme_data (); - gpgme_data_write (armored_data, buf, str_len (buf)); + gpgme_data_write (armored_data, buf, m_strlen(buf)); while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) { offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */ last_pos = offset; - gpgme_data_write (armored_data, buf, str_len (buf)); + gpgme_data_write (armored_data, buf, m_strlen(buf)); if ((needpass && !str_cmp ("-----END PGP MESSAGE-----\n", buf)) || (!needpass @@ -2485,7 +2485,7 @@ static int print_dn_part (FILE * fp, struct dn_array_s *dn, const char *key) if (!str_cmp (dn->key, key)) { if (any) fputs (" + ", fp); - print_utf8 (fp, dn->value, str_len (dn->value)); + print_utf8 (fp, dn->value, m_strlen(dn->value)); any = 1; } } @@ -2760,7 +2760,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) putc (' ', fp); } if (is_pgp) - print_utf8 (fp, s, str_len (s)); + print_utf8 (fp, s, m_strlen(s)); else parse_and_print_user_id (fp, s); putc ('\n', fp); @@ -2822,7 +2822,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) if (key->subkeys) { s = key->subkeys->fpr; fputs (_("Fingerprint: "), fp); - if (is_pgp && str_len (s) == 40) { + if (is_pgp && m_strlen(s) == 40) { for (i = 0; *s && s[1] && s[2] && s[3] && s[4]; s += 4, i++) { putc (*s, fp); putc (s[1], fp); @@ -2868,7 +2868,7 @@ static void print_key_info (gpgme_key_t key, FILE * fp) s = subkey->keyid; putc ('\n', fp); - if (str_len (s) == 16) + if (m_strlen(s) == 16) s += 8; /* display only the short keyID */ fprintf (fp, _("Subkey ....: 0x%s"), s); if (subkey->revoked) { @@ -3110,7 +3110,7 @@ static crypt_key_t *get_candidates (LIST * hints, unsigned int app, patarr = p_new(char *, n + 1); for (l = hints, n = 0; l; l = l->next) { if (l->data && *l->data) - patarr[n++] = str_dup (l->data); + patarr[n++] = m_strdup(l->data); } patarr[n] = NULL; err = gpgme_op_keylist_ext_start (ctx, (const char **) patarr, secret, 0); @@ -3215,12 +3215,12 @@ static LIST *crypt_add_string_to_hints (LIST * hints, const char *str) char *scratch; char *t; - if ((scratch = str_dup (str)) == NULL) + if ((scratch = m_strdup(str)) == NULL) return hints; for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (str_len (t) > 3) + if (m_strlen(t) > 3) hints = mutt_add_list (hints, t); } @@ -3640,8 +3640,8 @@ static crypt_key_t *crypt_ask_for_key (char *tag, l = p_new(struct crypt_cache, 1); l->next = id_defaults; id_defaults = l; - l->what = str_dup (whatfor); - l->dflt = str_dup (resp); + l->what = m_strdup(whatfor); + l->dflt = m_strdup(resp); } } @@ -3766,12 +3766,12 @@ static char *find_keys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc, *r_application &= ~APPLICATION_SMIME; #endif - keylist_size += str_len (s) + 4 + 1; + keylist_size += m_strlen(s) + 4 + 1; p_realloc(&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s%s", /* __SPRINTF_CHECKED__ */ keylist_used ? " " : "", s, forced_valid ? "!" : ""); } - keylist_used = str_len (keylist); + keylist_used = m_strlen(keylist); crypt_free_key (&key); rfc822_free_address (&addr); @@ -3925,9 +3925,9 @@ static int verify_sender (HEADER * h, gpgme_protocol_t protocol) int sender_length = 0; int uid_length = 0; - sender_length = str_len (sender->mailbox); + sender_length = m_strlen(sender->mailbox); for (uid = key->uids; uid && ret; uid = uid->next) { - uid_length = str_len (uid->email); + uid_length = m_strlen(uid->email); if (1 && (uid->email[0] == '<') && (uid->email[uid_length - 1] == '>') && (uid_length == sender_length + 2) diff --git a/crypt.c b/crypt.c index 1512286..56b1571 100644 --- a/crypt.c +++ b/crypt.c @@ -16,6 +16,7 @@ # include "config.h" #endif +#include #include #include @@ -28,7 +29,6 @@ #include "mutt_crypt.h" #include "pgp.h" -#include "lib/str.h" #include #include @@ -389,7 +389,7 @@ int mutt_is_application_smime (BODY * m) /* no .p7c, .p10 support yet. */ - len = str_len (t) - 4; + len = m_strlen(t) - 4; if (len > 0 && *(t + len) == '.') { len++; if (!ascii_strcasecmp ((t + len), "p7m")) diff --git a/curs_lib.c b/curs_lib.c index ddac70b..80c81dd 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -16,6 +16,7 @@ #endif #include +#include #include #include "mutt.h" @@ -25,7 +26,6 @@ #include "pager.h" #include "mbyte.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -205,7 +205,7 @@ int mutt_yesorno (const char *msg, int def) answer_string = p_new(char, COLS + 1); snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no, def == M_YES ? no : yes); - answer_string_len = str_len (answer_string); + answer_string_len = m_strlen(answer_string); printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); p_delete(&answer_string); @@ -465,7 +465,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, *redraw = REDRAW_FULL; } else { - char *pc = p_new(char, str_len(prompt) + 3); + char *pc = p_new(char, m_strlen(prompt) + 3); sprintf (pc, "%s: ", prompt); /* __SPRINTF_CHECKED__ */ mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0); @@ -545,7 +545,7 @@ int mutt_multi_choice (char *prompt, char *letters) } else if (ch.ch <= '9' && ch.ch > '0') { choice = ch.ch - '0'; - if (choice <= str_len (letters)) + if (choice <= m_strlen(letters)) break; } } @@ -665,7 +665,7 @@ static void mutt_format_s_x (char *dest, } mutt_format_string (dest, destlen, min_width, max_width, - right_justify, ' ', s, str_len (s), arboreal); + right_justify, ' ', s, m_strlen(s), arboreal); } void mutt_format_s (char *dest, @@ -690,7 +690,7 @@ void mutt_paddstr (int n, const char *s) wchar_t wc; int w; size_t k; - size_t len = str_len (s); + size_t len = m_strlen(s); mbstate_t mbstate; memset (&mbstate, 0, sizeof (mbstate)); @@ -714,7 +714,7 @@ void mutt_paddstr (int n, const char *s) } /* - * mutt_strwidth is like str_len except that it returns the width + * mutt_strwidth is like m_strlenexcept that it returns the width * refering to the number of characters cells. */ @@ -728,7 +728,7 @@ int mutt_strwidth (const char *s) if (!s) return 0; - n = str_len (s); + n = m_strlen(s); memset (&mbstate, 0, sizeof (mbstate)); for (w = 0; n && (k = mbrtowc (&wc, s, n, &mbstate)); s += k, n -= k) { diff --git a/curs_main.c b/curs_main.c index d367b39..fe65287 100644 --- a/curs_main.c +++ b/curs_main.c @@ -15,6 +15,7 @@ #endif #include +#include #include #include "mutt.h" @@ -48,7 +49,6 @@ #include "mutt_sasl.h" #endif -#include "lib/str.h" #include "lib/debug.h" #include @@ -966,7 +966,7 @@ int mutt_index_menu (void) unset_option (OPTHIDEREAD); } p_delete(&Context->pattern); - Context->pattern = str_dup (buf); + Context->pattern = m_strdup(buf); } if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) || mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0) diff --git a/dotlock.c b/dotlock.c index e08a467..43d3058 100644 --- a/dotlock.c +++ b/dotlock.c @@ -126,7 +126,7 @@ static int dotlock_lock (const char *); #define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0]) -size_t str_len (const char* s) { +size_t m_strlen(const char* s) { return (s ? strlen (s) : 0); } @@ -453,7 +453,7 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd) dirname = "."; } - if (str_len (basename) + 1 > l) + if (m_strlen(basename) + 1 > l) return -1; strfcpy (bn, basename, l); diff --git a/edit.c b/edit.c index f5f93ac..e1bc6df 100644 --- a/edit.c +++ b/edit.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -22,7 +23,6 @@ #include "mutt_curses.h" #include "mutt_idna.h" -#include "lib/str.h" #include #include @@ -66,7 +66,7 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen, tmp[sizeof (tmp) - 1] = 0; if (prefix) { strfcpy (tmp, NONULL (Prefix), sizeof (tmp)); - tmplen = str_len (tmp); + tmplen = m_strlen(tmp); p = tmp + tmplen; tmplen = sizeof (tmp) - tmplen; } @@ -75,10 +75,10 @@ static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen, while (bytes > 0) { if (fgets (p, tmplen - 1, f) == NULL) break; - bytes -= str_len (p); + bytes -= m_strlen(p); if (*bufmax == *buflen) p_realloc(&buf, *bufmax += 25); - buf[(*buflen)++] = str_dup (tmp); + buf[(*buflen)++] = m_strdup(tmp); } if (buf && *bufmax == *buflen) { /* Do not smash memory past buf */ p_realloc(&buf, ++*bufmax); @@ -158,7 +158,7 @@ static char **be_include_messages (char *msg, char **buf, int *bufmax, if (*bufmax == *buflen) p_realloc(&buf, *bufmax += 25); - buf[(*buflen)++] = str_dup (tmp); + buf[(*buflen)++] = m_strdup(tmp); bytes = Context->hdrs[n]->content->length; if (inc_hdrs) { @@ -172,7 +172,7 @@ static char **be_include_messages (char *msg, char **buf, int *bufmax, if (*bufmax == *buflen) p_realloc(&buf, *bufmax += 25); - buf[(*buflen)++] = str_dup ("\n"); + buf[(*buflen)++] = m_strdup("\n"); } else printw (_("%d: invalid message number.\n"), n); @@ -319,7 +319,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (EscChar && tmp[0] == EscChar[0] && tmp[1] != EscChar[0]) { /* remove trailing whitespace from the line */ - p = tmp + str_len (tmp) - 1; + p = tmp + m_strlen(tmp) - 1; while (p >= tmp && ISSPACE (*p)) *p-- = 0; @@ -348,9 +348,9 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (Context) { if (!*p && cur) { /* include the current message */ - p = tmp + str_len (tmp) + 1; - snprintf (tmp + str_len (tmp), - sizeof (tmp) - str_len (tmp), " %d", + p = tmp + m_strlen(tmp) + 1; + snprintf (tmp + m_strlen(tmp), + sizeof (tmp) - m_strlen(tmp), " %d", cur->msgno + 1); } buf = be_include_messages (p, buf, &bufmax, &buflen, @@ -392,7 +392,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) if (buflen) { buflen--; strfcpy (tmp, buf[buflen], sizeof (tmp)); - tmp[str_len (tmp) - 1] = 0; + tmp[m_strlen(tmp) - 1] = 0; p_delete(&buf[buflen]); buf[buflen] = NULL; continue; @@ -442,7 +442,7 @@ int mutt_builtin_editor (const char *path, HEADER * msg, HEADER * cur) str_cat (tmp, sizeof (tmp), "\n"); if (buflen == bufmax) p_realloc(&buf, bufmax += 25); - buf[buflen++] = str_dup (tmp[1] == '~' ? tmp + 1 : tmp); + buf[buflen++] = m_strdup(tmp[1] == '~' ? tmp + 1 : tmp); } tmp[0] = 0; diff --git a/editmsg.c b/editmsg.c index 3e2bd0f..347b6ae 100644 --- a/editmsg.c +++ b/editmsg.c @@ -14,12 +14,12 @@ #endif #include +#include #include "mutt.h" #include "copy.h" #include "mx.h" -#include "lib/str.h" #include #include diff --git a/enter.c b/enter.c index 4841111..b742739 100644 --- a/enter.c +++ b/enter.c @@ -503,7 +503,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, goto bye; } else if (flags & M_COMMAND) { my_wcstombs (buf, buflen, state->wbuf, state->curpos); - i = str_len (buf); + i = m_strlen(buf); if (i && buf[i - 1] == '=' && mutt_var_value_complete (buf, buflen, i)) state->tabs = 0; @@ -639,7 +639,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, *numfiles = 1; tfiles = p_new(char *, *numfiles); mutt_expand_path (buf, buflen); - tfiles[0] = str_dup (buf); + tfiles[0] = m_strdup(buf); *files = tfiles; } rv = 0; diff --git a/from.c b/from.c index f1b47cb..1ac13f5 100644 --- a/from.c +++ b/from.c @@ -12,11 +12,11 @@ #endif #include +#include #include #include "mutt.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -44,7 +44,7 @@ static int is_day_name (const char *s) { int i; - if ((str_len (s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3))) + if ((m_strlen(s) < 3) || !*(s + 3) || !ISSPACE (*(s + 3))) return 0; for (i = 0; i < 7; i++) if (str_ncasecmp (s, Weekdays[i], 3) == 0) diff --git a/globals.h b/globals.h index 9d20bb9..62f829b 100644 --- a/globals.h +++ b/globals.h @@ -11,7 +11,7 @@ #include "alias.h" -#include "lib/str.h" +#include #include "lib/list.h" #include "lib/rx.h" diff --git a/gnupgparse.c b/gnupgparse.c index ce4d92e..4d2d72d 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -34,6 +34,7 @@ #include #include +#include #include "mutt.h" #include "pgp.h" @@ -42,7 +43,6 @@ /* for hexval */ #include "mime.h" -#include "lib/str.h" #include "lib/debug.h" /**************** @@ -97,7 +97,7 @@ static void fix_uid (char *uid) memcpy (uid, buf, ob - buf); uid[ob - buf] = '\0'; } - else if (ob - buf == n && (buf[n] = 0, str_len (buf) < n)) + else if (ob - buf == n && (buf[n] = 0, m_strlen(buf) < n)) memcpy (uid, buf, n); } p_delete(&buf); @@ -249,7 +249,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) uid = p_new(pgp_uid_t, 1); fix_uid (p); - uid->addr = str_dup (p); + uid->addr = m_strdup(p); uid->trust = trust; uid->flags |= flags; uid->parent = k; diff --git a/handler.c b/handler.c index b3d65e5..61efc4b 100644 --- a/handler.c +++ b/handler.c @@ -19,6 +19,7 @@ #include #include +#include #include #include "mutt.h" @@ -37,7 +38,6 @@ #include "attach.h" #include "lib.h" -#include "lib/str.h" #include "lib/debug.h" typedef int handler_f (BODY *, STATE *); @@ -199,7 +199,7 @@ void mutt_decode_quoted (STATE * s, long len, int istext, iconv_t cd) if (fgets (line, MIN ((ssize_t) sizeof (line), len + 1), s->fpin) == NULL) break; - linelen = str_len (line); + linelen = m_strlen(line); len -= linelen; /* @@ -326,14 +326,14 @@ void mutt_decode_uuencoded (STATE * s, long len, int istext, iconv_t cd) while (len > 0) { if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL) return; - len -= str_len (tmps); + len -= m_strlen(tmps); if ((!str_ncmp (tmps, "begin", 5)) && ISSPACE (tmps[5])) break; } while (len > 0) { if ((fgets (tmps, sizeof (tmps), s->fpin)) == NULL) return; - len -= str_len (tmps); + len -= m_strlen(tmps); if (!str_ncmp (tmps, "end", 3)) break; pt = tmps; @@ -474,7 +474,7 @@ static void enriched_wrap (struct enriched_state *stte) stte->indent_len = 0; if (stte->s->prefix) { state_puts (stte->s->prefix, stte->s); - stte->indent_len += str_len (stte->s->prefix); + stte->indent_len += m_strlen(stte->s->prefix); } if (stte->tag_level[RICH_EXCERPT]) { @@ -482,11 +482,11 @@ static void enriched_wrap (struct enriched_state *stte) while (x) { if (stte->s->prefix) { state_puts (stte->s->prefix, stte->s); - stte->indent_len += str_len (stte->s->prefix); + stte->indent_len += m_strlen(stte->s->prefix); } else { state_puts ("> ", stte->s); - stte->indent_len += str_len ("> "); + stte->indent_len += m_strlen("> "); } x--; } @@ -588,7 +588,7 @@ static void enriched_puts (const char *s, struct enriched_state *stte) { const char *p; - if (stte->buff_len < stte->buff_used + str_len (s)) { + if (stte->buff_len < stte->buff_used + m_strlen(s)) { stte->buff_len += LONG_STRING; p_realloc(&stte->buffer, stte->buff_len + 1); } @@ -692,7 +692,7 @@ int text_enriched_handler (BODY * a, STATE * s) if (s->prefix) { state_puts (s->prefix, s); - stte.indent_len += str_len (s->prefix); + stte.indent_len += m_strlen(s->prefix); } while (state != DONE) { @@ -831,7 +831,7 @@ static int alternative_handler (BODY * a, STATE * s) } else { wild = 1; - btlen = str_len (t->data); + btlen = m_strlen(t->data); } if (a && a->parts) @@ -1096,7 +1096,7 @@ static int autoview_handler (BODY * a, STATE * s) snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW); - fname = str_dup (a->filename); + fname = m_strdup(a->filename); mutt_sanitize_filename (fname, 1); rfc1524_expand_filename (entry->nametemplate, fname, tempfile, sizeof (tempfile)); diff --git a/hcache.c b/hcache.c index fd706db..c7e13ba 100644 --- a/hcache.c +++ b/hcache.c @@ -128,7 +128,7 @@ static unsigned char *dump_char (char *c, unsigned char *d, int *off) return d; } - size = str_len (c) + 1; + size = m_strlen(c) + 1; d = dump_int (size, d, off); lazy_realloc (&d, *off + size); memcpy (d + *off, c, size); @@ -451,35 +451,35 @@ static int generate_crc32 () crc = crc32 (crc, (unsigned char const *) MUTTNG_HCACHE_ID "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613", - str_len + m_strlen (MUTTNG_HCACHE_ID "sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20041108231548|29613")); #if HAVE_LANGINFO_CODESET - crc = crc32 (crc, (unsigned char const *) Charset, str_len (Charset)); + crc = crc32 (crc, (unsigned char const *) Charset, m_strlen(Charset)); crc = crc32 (crc, (unsigned char const *) "HAVE_LANGINFO_CODESET", - str_len ("HAVE_LANGINFO_CODESET")); + m_strlen("HAVE_LANGINFO_CODESET")); #endif #ifdef USE_POP crc = - crc32 (crc, (unsigned char const *) "USE_POP", str_len ("USE_POP")); + crc32 (crc, (unsigned char const *) "USE_POP", m_strlen("USE_POP")); #endif #ifdef MIXMASTER crc = crc32 (crc, (unsigned char const *) "MIXMASTER", - str_len ("MIXMASTER")); + m_strlen("MIXMASTER")); #endif #ifdef USE_IMAP crc = - crc32 (crc, (unsigned char const *) "USE_IMAP", str_len ("USE_IMAP")); + crc32 (crc, (unsigned char const *) "USE_IMAP", m_strlen("USE_IMAP")); #endif #ifdef USE_NNTP crc = - crc32 (crc, (unsigned char const *) "USE_NNTP", str_len ("USE_NNTP")); + crc32 (crc, (unsigned char const *) "USE_NNTP", m_strlen("USE_NNTP")); #endif return crc; } @@ -518,7 +518,7 @@ static const char *mutt_hcache_per_folder (const char *path, } MD5Init (&md5); - MD5Update (&md5, (unsigned char *) folder, str_len (folder)); + MD5Update (&md5, (unsigned char *) folder, m_strlen(folder)); MD5Final (md5sum, &md5); ret = snprintf (mutt_hcache_per_folder_path, _POSIX_PATH_MAX, @@ -597,7 +597,7 @@ HEADER *mutt_hcache_restore (const unsigned char *d, HEADER ** oh) /* this is needed for maildir style mailboxes */ if (oh) { h->old = (*oh)->old; - h->path = str_dup ((*oh)->path); + h->path = m_strdup((*oh)->path); mutt_free_header (oh); } @@ -611,7 +611,7 @@ mutt_hcache_open(const char *path, const char *folder) struct header_cache *h = p_new(HEADER_CACHE, 1); int flags = VL_OWRITER | VL_OCREAT; h->db = NULL; - h->folder = str_dup(folder); + h->folder = m_strdup(folder); h->crc = generate_crc32(); if (!path || path[0] == '\0') @@ -734,7 +734,7 @@ void *mutt_hcache_open (const char *path, const char *folder) int pagesize = atoi (HeaderCachePageSize) ? atoi (HeaderCachePageSize) : 16384; h->db = NULL; - h->folder = str_dup (folder); + h->folder = m_strdup(folder); h->crc = generate_crc32 (); if (!path || path[0] == '\0') { @@ -789,7 +789,7 @@ void *mutt_hcache_fetch (void *db, const char *filename, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - str_len (path)); + strncat (path, filename, sizeof (path) - m_strlen(path)); key.dptr = path; key.dsize = keylen (path); @@ -819,7 +819,7 @@ mutt_hcache_store (void *db, const char *filename, HEADER * header, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - str_len (path)); + strncat (path, filename, sizeof (path) - m_strlen(path)); key.dptr = path; key.dsize = keylen (path); @@ -846,7 +846,7 @@ mutt_hcache_delete (void *db, const char *filename, } strncpy (path, h->folder, sizeof (path)); - strncat (path, filename, sizeof (path) - str_len (path)); + strncat (path, filename, sizeof (path) - m_strlen(path)); key.dptr = path; key.dsize = keylen (path); diff --git a/hdrline.c b/hdrline.c index 716a5df..2ba1266 100644 --- a/hdrline.c +++ b/hdrline.c @@ -20,7 +20,7 @@ #include "mutt_idna.h" #include "mime.h" -#include "lib/str.h" +#include #include "lib/rx.h" #include @@ -590,7 +590,7 @@ static const char *hdr_format_str (char *dest, snprintf (dest, destlen, fmt, (Tochars && ((i = mutt_user_is_recipient (hdr))) < - str_len (Tochars)) ? Tochars[i] : ' '); + m_strlen(Tochars)) ? Tochars[i] : ' '); break; case 'u': @@ -681,7 +681,7 @@ static const char *hdr_format_str (char *dest, ((i = mutt_user_is_recipient (hdr)) < - str_len (Tochars)) ? + m_strlen(Tochars)) ? Tochars[i] : ' '))); mutt_format_s (dest, destlen, prefix, buf2); break; diff --git a/headers.c b/headers.c index 3cedeb6..031e2a9 100644 --- a/headers.c +++ b/headers.c @@ -152,7 +152,7 @@ void mutt_edit_headers (const char *editor, strfcpy (path, p, sizeof (path)); mutt_expand_path (path, sizeof (path)); if ((body = mutt_make_file_attach (path))) { - body->description = str_dup (q); + body->description = m_strdup(q); for (parts = msg->content; parts->next; parts = parts->next); parts->next = body; } diff --git a/help.c b/help.c index 2f13577..abccfac 100644 --- a/help.c +++ b/help.c @@ -14,7 +14,7 @@ #endif #include -#include "lib/str.h" +#include #include "mutt.h" #include "mutt_curses.h" @@ -72,7 +72,7 @@ char *mutt_compile_help (char *buf, size_t buflen, int menu, buflen -= 2; } mutt_make_help (pbuf, buflen, _(items[i].name), menu, items[i].value); - len = str_len (pbuf); + len = m_strlen(pbuf); pbuf += len; buflen -= len; } @@ -85,7 +85,7 @@ static int print_macro (FILE * f, int maxwidth, const char **macro) wchar_t wc; int w; size_t k; - size_t len = str_len (*macro); + size_t len = m_strlen(*macro); mbstate_t mbstate1, mbstate2; memset (&mbstate1, 0, sizeof (mbstate1)); @@ -168,7 +168,7 @@ static void format_line (FILE * f, int ismacro, else { col_a = COLS > 83 ? (COLS - 32) >> 2 : 12; col_b = COLS > 49 ? (COLS - 10) >> 1 : 19; - col = pad (f, str_len (t1), col_a); + col = pad (f, m_strlen(t1), col_a); } if (ismacro > 0) { @@ -179,7 +179,7 @@ static void format_line (FILE * f, int ismacro, if (!split) { col += print_macro (f, col_b - col - 4, &t2); - if (str_len (t2) > col_b - col) + if (m_strlen(t2) > col_b - col) t2 = "..."; } } @@ -202,7 +202,7 @@ static void format_line (FILE * f, int ismacro, SKIPWS (t3); /* FIXME: this is completely wrong */ - if ((n = str_len (t3)) > COLS - col) { + if ((n = m_strlen(t3)) > COLS - col) { n = COLS - col; for (col_a = n; col_a > 0 && t3[col_a] != ' '; col_a--); if (col_a) diff --git a/hook.c b/hook.c index 3eb5cd1..d6db820 100644 --- a/hook.c +++ b/hook.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -23,7 +24,6 @@ #include "compress.h" #endif -#include "lib/str.h" #include "lib/rx.h" #include @@ -92,7 +92,7 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data, _mutt_expand_path (path, sizeof (path), 1); p_delete(&pattern.data); memset (&pattern, 0, sizeof (pattern)); - pattern.data = str_dup (path); + pattern.data = m_strdup(path); } #ifdef USE_COMPRESSED else if (data & (M_APPENDHOOK | M_OPENHOOK | M_CLOSEHOOK)) { @@ -111,7 +111,7 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data, mutt_check_simple (tmp, sizeof (tmp), DefaultHook); p_delete(&pattern.data); memset (&pattern, 0, sizeof (pattern)); - pattern.data = str_dup (tmp); + pattern.data = m_strdup(tmp); } if (data & (M_MBOXHOOK | M_SAVEHOOK | M_FCCHOOK)) { @@ -119,7 +119,7 @@ int mutt_parse_hook (BUFFER * buf, BUFFER * s, unsigned long data, mutt_expand_path (path, sizeof (path)); p_delete(&command.data); memset (&command, 0, sizeof (command)); - command.data = str_dup (path); + command.data = m_strdup(path); } /* check to make sure that a matching hook doesn't already exist */ diff --git a/imap/auth.c b/imap/auth.c index 2e6b8ca..47f305f 100644 --- a/imap/auth.c +++ b/imap/auth.c @@ -55,7 +55,7 @@ int imap_authenticate (IMAP_DATA * idata) if (ImapAuthenticators && *ImapAuthenticators) { /* Try user-specified list of authentication methods */ - methods = str_dup (ImapAuthenticators); + methods = m_strdup(ImapAuthenticators); for (method = methods; method; method = delim) { delim = strchr (method, ':'); diff --git a/imap/auth_cram.c b/imap/auth_cram.c index 1eda8d9..e4ea149 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -101,7 +101,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA * idata, const char *method) */ mutt_to_base64 ((unsigned char *) ibuf, (unsigned char *) obuf, - str_len (obuf), sizeof (ibuf) - 2); + m_strlen(obuf), sizeof (ibuf) - 2); str_cat (ibuf, sizeof (ibuf), "\r\n"); mutt_socket_write (idata->conn, ibuf); @@ -134,8 +134,8 @@ static void hmac_md5 (const char *password, char *challenge, unsigned int secret_len, chal_len; int i; - secret_len = str_len (password); - chal_len = str_len (challenge); + secret_len = m_strlen(password); + chal_len = m_strlen(challenge); /* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5 * digests */ diff --git a/imap/auth_gss.c b/imap/auth_gss.c index fa51467..e5f1bce 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -60,7 +60,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method) /* get an IMAP service ticket for the server */ snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host); request_buf.value = buf1; - request_buf.length = str_len (buf1) + 1; + request_buf.length = m_strlen(buf1) + 1; maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name, &target_name); if (maj_stat != GSS_S_COMPLETE) { @@ -202,7 +202,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA * idata, const char *method) /* server decides if principal can log in as user */ strncpy (buf1 + 4, idata->conn->account.user, sizeof (buf1) - 4); request_buf.value = buf1; - request_buf.length = 4 + str_len (idata->conn->account.user) + 1; + request_buf.length = 4 + m_strlen(idata->conn->account.user) + 1; maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf, &cflags, &send_token); if (maj_stat != GSS_S_COMPLETE) { diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 436b331..75ec4d4 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -110,7 +110,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) if (irc == IMAP_CMD_RESPOND) { if (sasl_decode64 - (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf, + (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf, LONG_STRING - 1, &len) != SASL_OK) { debug_print (1, ("error base64-decoding server response.\n")); diff --git a/imap/browse.c b/imap/browse.c index 39bf980..2ee4bff 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -18,9 +18,9 @@ #include #include +#include #include -#include "lib/str.h" #include "lib/debug.h" #include "mutt.h" @@ -82,7 +82,7 @@ int imap_browse (char *path, struct browser_state *state) if (!mx.mbox) { home_namespace = 1; mbox[0] = '\0'; /* Do not replace "" with "INBOX" here */ - mx.mbox = str_dup (ImapHomeNamespace); + mx.mbox = m_strdup(ImapHomeNamespace); if (mutt_bit_isset (idata->capabilities, NAMESPACE)) { mutt_message _("Getting namespaces..."); @@ -103,7 +103,7 @@ int imap_browse (char *path, struct browser_state *state) imap_unquote_string (buf); /* As kludgy as it gets */ mbox[sizeof (mbox) - 1] = '\0'; strncpy (mbox, buf, sizeof (mbox) - 1); - n = str_len (mbox); + n = m_strlen(mbox); debug_print (3, ("mbox: %s\n", mbox)); @@ -121,7 +121,7 @@ int imap_browse (char *path, struct browser_state *state) imap_unmunge_mbox_name (cur_folder); if (!noinferiors && cur_folder[0] && - (n = str_len (mbox)) < LONG_STRING - 1) { + (n = m_strlen(mbox)) < LONG_STRING - 1) { mbox[n++] = idata->delim; mbox[n] = '\0'; } @@ -136,7 +136,7 @@ int imap_browse (char *path, struct browser_state *state) if (!home_namespace) showparents = 1; imap_qualify_path (buf, sizeof (buf), &mx, mbox); - state->folder = str_dup (buf); + state->folder = m_strdup(buf); n--; } @@ -165,7 +165,7 @@ int imap_browse (char *path, struct browser_state *state) ctmp = mbox[n]; mbox[n] = '\0'; imap_qualify_path (buf, sizeof (buf), &mx, mbox); - state->folder = str_dup (buf); + state->folder = m_strdup(buf); } mbox[n] = ctmp; } @@ -179,7 +179,7 @@ int imap_browse (char *path, struct browser_state *state) imap_add_folder (idata->delim, relpath, 1, 0, state, 1); if (!state->folder) { imap_qualify_path (buf, sizeof (buf), &mx, relpath); - state->folder = str_dup (buf); + state->folder = m_strdup(buf); } } } @@ -187,7 +187,7 @@ int imap_browse (char *path, struct browser_state *state) /* no namespace, no folder: set folder to host only */ if (!state->folder) { imap_qualify_path (buf, sizeof (buf), &mx, NULL); - state->folder = str_dup (buf); + state->folder = m_strdup(buf); } if (home_namespace && mbox[0] != '\0') { @@ -263,7 +263,7 @@ int imap_mailbox_create (const char *folder) strfcpy (buf, NONULL (mx.mbox), sizeof (buf)); /* append a delimiter if necessary */ - n = str_len (buf); + n = m_strlen(buf); if (n && (n < sizeof (buf) - 1) && (buf[n - 1] != idata->delim)) { buf[n++] = idata->delim; buf[n] = '\0'; @@ -272,7 +272,7 @@ int imap_mailbox_create (const char *folder) if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), M_FILE) < 0) goto fail; - if (!str_len (buf)) { + if (!m_strlen(buf)) { mutt_error (_("Mailbox must have a name.")); mutt_sleep (1); goto fail; @@ -315,7 +315,7 @@ int imap_mailbox_rename (const char *mailbox) if (mutt_get_field (buf, newname, sizeof (newname), M_FILE) < 0) goto fail; - if (!str_len (newname)) { + if (!m_strlen(newname)) { mutt_error (_("Mailbox must have a name.")); mutt_sleep (1); goto fail; @@ -366,7 +366,7 @@ static int browse_add_list_result (IMAP_DATA * idata, const char *cmd, if (isparent) noselect = 1; /* prune current folder from output */ - if (isparent || str_ncmp (name, mx.mbox, str_len (name))) + if (isparent || str_ncmp (name, mx.mbox, m_strlen(name))) imap_add_folder (idata->delim, name, noselect, noinferiors, state, isparent); } @@ -402,8 +402,8 @@ static void imap_add_folder (char delim, char *folder, int noselect, if (isparent) strfcpy (relpath, "../", sizeof (relpath)); /* strip current folder from target, to render a relative path */ - else if (!str_ncmp (mx.mbox, folder, str_len (mx.mbox))) - strfcpy (relpath, folder + str_len (mx.mbox), sizeof (relpath)); + else if (!str_ncmp (mx.mbox, folder, m_strlen(mx.mbox))) + strfcpy (relpath, folder + m_strlen(mx.mbox), sizeof (relpath)); else strfcpy (relpath, folder, sizeof (relpath)); @@ -416,15 +416,15 @@ static void imap_add_folder (char delim, char *folder, int noselect, } imap_qualify_path (tmp, sizeof (tmp), &mx, folder); - (state->entry)[state->entrylen].name = str_dup (tmp); + (state->entry)[state->entrylen].name = m_strdup(tmp); /* mark desc with delim in browser if it can have subfolders */ - if (!isparent && !noinferiors && str_len (relpath) < sizeof (relpath) - 1) { - relpath[str_len (relpath) + 1] = '\0'; - relpath[str_len (relpath)] = delim; + if (!isparent && !noinferiors && m_strlen(relpath) < sizeof (relpath) - 1) { + relpath[m_strlen(relpath) + 1] = '\0'; + relpath[m_strlen(relpath)] = delim; } - (state->entry)[state->entrylen].desc = str_dup (relpath); + (state->entry)[state->entrylen].desc = m_strdup(relpath); (state->entry)[state->entrylen].imap = 1; /* delimiter at the root is useless. */ diff --git a/imap/command.c b/imap/command.c index 02d49d7..36762a1 100644 --- a/imap/command.c +++ b/imap/command.c @@ -74,7 +74,7 @@ int imap_cmd_start (IMAP_DATA * idata, const char *cmd) cmd_make_sequence (idata); /* seq, space, cmd, \r\n\0 */ - outlen = str_len (idata->cmd.seq) + str_len (cmd) + 4; + outlen = m_strlen(idata->cmd.seq) + m_strlen(cmd) + 4; out = p_new(char, outlen); snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd); @@ -188,7 +188,7 @@ int imap_exec (IMAP_DATA * idata, const char *cmd, int flags) /* create sequence for command */ cmd_make_sequence (idata); /* seq, space, cmd, \r\n\0 */ - outlen = str_len (idata->cmd.seq) + str_len (cmd) + 4; + outlen = m_strlen(idata->cmd.seq) + m_strlen(cmd) + 4; out = p_new(char, outlen); snprintf (out, outlen, "%s %s\r\n", idata->cmd.seq, cmd); @@ -434,7 +434,7 @@ static void cmd_parse_capabilities (IMAP_DATA * idata, char *s) s = imap_next_word (s); p_delete(&idata->capstr); - idata->capstr = str_dup (s); + idata->capstr = m_strdup(s); memset (idata->capabilities, 0, sizeof (idata->capabilities)); diff --git a/imap/imap.c b/imap/imap.c index 7ead95a..03ef513 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -16,6 +16,7 @@ #endif #include +#include #include "mutt.h" #include "ascii.h" @@ -32,7 +33,6 @@ #include "buffy.h" #include -#include "lib/str.h" #include "lib/debug.h" #include @@ -559,11 +559,11 @@ int imap_open_mailbox (CONTEXT * ctx) /* Clean up path and replace the one in the ctx */ imap_fix_path (idata, mx.mbox, buf, sizeof (buf)); p_delete(&(idata->mailbox)); - idata->mailbox = str_dup (buf); + idata->mailbox = m_strdup(buf); imap_qualify_path (buf, sizeof (buf), &mx, idata->mailbox); p_delete(&(ctx->path)); - ctx->path = str_dup (buf); + ctx->path = m_strdup(buf); idata->ctx = ctx; @@ -1208,8 +1208,8 @@ int imap_mailbox_check (char *path, int new) /* The mailbox name may or may not be quoted here. We could try to * munge the server response and compare with quoted (or vise versa) * but it is probably more efficient to just strncmp against both. */ - if (str_ncmp (mbox_unquoted, s, str_len (mbox_unquoted)) == 0 - || str_ncmp (mbox, s, str_len (mbox)) == 0) { + if (str_ncmp (mbox_unquoted, s, m_strlen(mbox_unquoted)) == 0 + || str_ncmp (mbox, s, m_strlen(mbox)) == 0) { s = imap_next_word (s); s = imap_next_word (s); if (isdigit ((unsigned char) *s)) { @@ -1508,7 +1508,7 @@ static int imap_complete_hosts (char *dest, size_t len) { int matchlen; int i = 0; - matchlen = str_len (dest); + matchlen = m_strlen(dest); if (list_empty (Incoming)) return (-1); for (i = 0; i < Incoming->length; i++) { @@ -1602,14 +1602,14 @@ int imap_complete (char *dest, size_t dlen, char *path) { /* if the folder isn't selectable, append delimiter to force browse * to enter it on second tab. */ if (noselect) { - clen = str_len (list_word); + clen = m_strlen(list_word); list_word[clen++] = delim; list_word[clen] = '\0'; } /* copy in first word */ if (!completions) { strfcpy (completion, list_word, sizeof (completion)); - matchlen = str_len (completion); + matchlen = m_strlen(completion); completions++; continue; } diff --git a/imap/message.c b/imap/message.c index 660f954..2e5b614 100644 --- a/imap/message.c +++ b/imap/message.c @@ -18,6 +18,7 @@ #include #include +#include #include "mutt.h" #include "ascii.h" @@ -33,7 +34,6 @@ #endif #include -#include "lib/str.h" #include "lib/debug.h" #if HAVE_STDINT_H @@ -355,7 +355,7 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) cache->uid = HEADER_DATA (h)->uid; mutt_mktemp (path); - cache->path = str_dup (path); + cache->path = m_strdup(path); if (!(msg->fp = safe_fopen (path, "w+"))) { p_delete(&cache->path); return -1; @@ -894,7 +894,7 @@ static int msg_fetch_header (CONTEXT * ctx, IMAP_HEADER * h, char *buf, #ifdef USE_HCACHE static size_t imap_hcache_keylen (const char *fn) { - return str_len (fn); + return m_strlen(fn); } /* msg_fetch_header: import IMAP FETCH response into an IMAP_HEADER. @@ -950,7 +950,7 @@ static int msg_has_flag (LIST * flag_list, const char *flag) flag_list = flag_list->next; while (flag_list) { - if (!ascii_strncasecmp (flag_list->data, flag, str_len (flag_list->data))) + if (!ascii_strncasecmp (flag_list->data, flag, m_strlen(flag_list->data))) return 1; flag_list = flag_list->next; diff --git a/imap/mx_imap.c b/imap/mx_imap.c index 29abeec..a851537 100644 --- a/imap/mx_imap.c +++ b/imap/mx_imap.c @@ -10,6 +10,7 @@ #include #include +#include #include "mutt.h" #include "imap_private.h" @@ -17,7 +18,6 @@ #include "mx.h" #include "mx_imap.h" -#include "lib/str.h" #include "url.h" @@ -43,7 +43,7 @@ static int imap_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr) mutt_perror (tmp); return (-1); } - msg->path = str_dup (tmp); + msg->path = m_strdup(tmp); return 0; } diff --git a/imap/utf7.c b/imap/utf7.c index f4a84a1..76ea696 100644 --- a/imap/utf7.c +++ b/imap/utf7.c @@ -232,7 +232,7 @@ bail: void imap_utf7_encode (char **s) { if (Charset) { - char *t = str_dup (*s); + char *t = m_strdup(*s); if (!mutt_convert_string (&t, Charset, "UTF-8", 0)) { char *u7 = utf8_to_utf7 (t, strlen (t), NULL, 0); @@ -246,7 +246,7 @@ void imap_utf7_encode (char **s) void imap_utf7_decode (char **s) { if (Charset) { - char *t = utf7_to_utf8 (*s, str_len (*s), 0, 0); + char *t = utf7_to_utf8 (*s, m_strlen(*s), 0, 0); if (t && !mutt_convert_string (&t, "UTF-8", Charset, 0)) { p_delete(s); diff --git a/imap/util.c b/imap/util.c index 1f02969..992423e 100644 --- a/imap/util.c +++ b/imap/util.c @@ -96,7 +96,7 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx) mx->account.port = ImapPort; mx->account.type = M_ACCT_TYPE_IMAP; - c = str_dup (path); + c = m_strdup(path); url_parse_ciss (&url, c); if (!(url.scheme == U_IMAP || url.scheme == U_IMAPS) || @@ -105,7 +105,7 @@ int imap_parse_path (const char *path, IMAP_MBOX * mx) return -1; } - mx->mbox = str_dup (url.path); + mx->mbox = m_strdup(url.path); if (url.scheme == U_IMAPS) mx->account.flags |= M_ACCT_SSL; @@ -132,10 +132,10 @@ void imap_pretty_mailbox (char *path) if (imap_parse_path (path, &target) < 0) return; - tlen = str_len (target.mbox); + tlen = m_strlen(target.mbox); /* check whether we can do '=' substitution */ if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) { - hlen = str_len (home.mbox); + hlen = m_strlen(home.mbox); if (tlen && mutt_account_match (&home.account, &target.account) && !str_ncmp (home.mbox, target.mbox, hlen)) { if (!hlen) @@ -426,7 +426,7 @@ void imap_munge_mbox_name (char *dest, size_t dlen, const char *src) { char *buf; - buf = str_dup (src); + buf = m_strdup(src); imap_utf7_encode (&buf); imap_quote_string (dest, dlen, buf); @@ -440,10 +440,10 @@ void imap_unmunge_mbox_name (char *s) imap_unquote_string (s); - buf = str_dup (s); + buf = m_strdup(s); if (buf) { imap_utf7_decode (&buf); - strncpy (s, buf, str_len (s)); + strncpy (s, buf, m_strlen(s)); } p_delete(&buf); diff --git a/init.c b/init.c index 550fcfd..f00ec21 100644 --- a/init.c +++ b/init.c @@ -15,6 +15,7 @@ #endif #include +#include #include #include "mutt.h" @@ -41,7 +42,6 @@ #include "mx.h" #include "init.h" -#include "lib/str.h" #include "lib/rx.h" #include "lib/list.h" #include "lib/debug.h" @@ -272,7 +272,7 @@ static void sys_to_string (char* dst, size_t dstlen, } else if (ascii_strcmp ("muttng_folder_name", option->option) == 0 && CurrentFolder && *CurrentFolder) { - size_t Maildirlength = str_len (Maildir); + size_t Maildirlength = m_strlen(Maildir); /* * if name starts with $folder, just strip it to keep hierarchy @@ -280,7 +280,7 @@ static void sys_to_string (char* dst, size_t dstlen, */ if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir, Maildirlength) == 0 && - str_len (CurrentFolder) > Maildirlength) { + m_strlen(CurrentFolder) > Maildirlength) { val = CurrentFolder + Maildirlength; if (Maildir[strlen(Maildir)-1]!='/') val += 1; @@ -337,14 +337,14 @@ static int user_from_string (struct option_t* dst, const char* val, * just silently ignore it */ if (!dst) return (1); - if (str_len ((char*) dst->data) == 0) - dst->data = (unsigned long) str_dup (val); + if (m_strlen((char*) dst->data) == 0) + dst->data = (unsigned long) m_strdup(val); else { char* s = (char*) dst->data; str_replace (&s, val); } - if (str_len (dst->init) == 0) - dst->init = str_dup ((char*) dst->data); + if (m_strlen(dst->init) == 0) + dst->init = m_strdup((char*) dst->data); return (1); } @@ -548,7 +548,7 @@ int mutt_option_value (const char* val, char* dst, size_t dstlen) { debug_print (1, ("orig == '%s'\n", tmp)); t = strchr (tmp, '='); t++; - l = str_len (t); + l = m_strlen(t); if (l >= 2) { if (t[l-1] == '"' && *t == '"') { t[l-1] = '\0'; @@ -565,7 +565,7 @@ int mutt_option_value (const char* val, char* dst, size_t dstlen) { /* for synonym warning reports: adds synonym to end of list */ static void syn_add (struct option_t* n, struct option_t* o) { syn_t* tmp = p_new(syn_t, 1); - tmp->f = str_dup (CurRCFile); + tmp->f = m_strdup(CurRCFile); tmp->l = CurRCLine; tmp->n = n; tmp->o = o; @@ -642,7 +642,7 @@ static void add_to_list (LIST ** list, const char *str) if (!*list || last) { t = p_new(LIST, 1); - t->data = str_dup (str); + t->data = m_strdup(str); if (last) { last->next = t; last = last->next; @@ -720,7 +720,7 @@ static int add_to_spam_list (SPAM_LIST ** list, const char *pat, } /* Now t is the SPAM_LIST* that we want to modify. It is prepared. */ - t->template = str_dup (templ); + t->template = m_strdup(templ); /* Find highest match number in template string */ t->nmatch = 0; @@ -841,8 +841,8 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data, continue; for (j = 0; b[j].name; j++) - if (!ascii_strncasecmp (tmp->data, b[j].name, str_len (tmp->data)) - && (str_len (b[j].name) == str_len (tmp->data))) { + if (!ascii_strncasecmp (tmp->data, b[j].name, m_strlen(tmp->data)) + && (m_strlen(b[j].name) == m_strlen(tmp->data))) { res = 1; break; } @@ -850,10 +850,10 @@ static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data, } /* check for feature_* */ if (!res && ascii_strncasecmp (tmp->data, "feature_", 8) == 0 && - (j = str_len (tmp->data)) > 8) { + (j = m_strlen(tmp->data)) > 8) { i = 0; while (Features[i]) { - if (str_len (Features[i]) == j-8 && + if (m_strlen(Features[i]) == j-8 && ascii_strncasecmp (Features[i], tmp->data+8, j-8) == 0) { res = 1; break; @@ -1108,11 +1108,11 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, /* some cheap hacks that I expect to remove */ if (!str_casecmp(buf->data, "any")) - a->major = str_dup("*/.*"); + a->major = m_strdup("*/.*"); else if (!str_casecmp(buf->data, "none")) - a->major = str_dup("cheap_hack/this_should_never_match"); + a->major = m_strdup("cheap_hack/this_should_never_match"); else - a->major = str_dup(buf->data); + a->major = m_strdup(buf->data); if ((p = strchr(a->major, '/'))) { *p = '\0'; @@ -1122,7 +1122,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, a->minor = "unknown"; } - len = str_len (a->minor); + len = m_strlen(a->minor); tmpminor = p_new(char, len + 3); strcpy(&tmpminor[1], a->minor); /* __STRCPY_CHECKED__ */ tmpminor[0] = '^'; @@ -1164,11 +1164,11 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er mutt_extract_token (buf, s, 0); if (!str_casecmp(buf->data, "any")) - tmp = str_dup("*/.*"); + tmp = m_strdup("*/.*"); else if (!str_casecmp(buf->data, "none")) - tmp = str_dup("cheap_hack/this_should_never_match"); + tmp = m_strdup("cheap_hack/this_should_never_match"); else - tmp = str_dup(buf->data); + tmp = m_strdup(buf->data); if ((minor = strchr(tmp, '/'))) { *minor = '\0'; @@ -1432,7 +1432,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, unsigned long data, /* create a new alias */ tmp = p_new(ALIAS, 1); tmp->self = tmp; - tmp->name = str_dup (buf->data); + tmp->name = m_strdup(buf->data); /* give the main addressbook code a chance */ if (CurrentMenu == MENU_ALIAS) set_option (OPTMENUCALLER); @@ -1489,7 +1489,7 @@ parse_unmy_hdr (BUFFER * buf, BUFFER * s, unsigned long data, BUFFER * err) tmp = UserHeader; last = NULL; - l = str_len (buf->data); + l = m_strlen(buf->data); if (buf->data[l - 1] == ':') l--; @@ -1595,8 +1595,8 @@ static void mutt_set_default(const char *name, void* p, unsigned long more) return; mutt_option_value(ptr->option, buf, sizeof(buf)); - if (str_len(ptr->init) == 0 && buf && *buf) - ptr->init = str_dup(buf); + if (m_strlen(ptr->init) == 0 && buf && *buf) + ptr->init = m_strdup(buf); } static struct option_t* add_option (const char* name, const char* init, @@ -1605,10 +1605,10 @@ static struct option_t* add_option (const char* name, const char* init, debug_print (1, ("adding $%s\n", name)); - option->option = str_dup (name); + option->option = m_strdup(name); option->type = type; if (init) - option->init = dodup ? str_dup (init) : (char*) init; + option->init = dodup ? m_strdup(init) : (char*) init; return (option); } @@ -1641,23 +1641,23 @@ static int init_expand (char** dst, struct option_t* src) { if (src->init && *src->init) { memset (&token, 0, sizeof(BUFFER)); memset (&in, 0, sizeof(BUFFER)); - len = str_len (src->init) + 2; + len = m_strlen(src->init) + 2; in.data = p_new(char, len + 1); snprintf (in.data, len, "\"%s\"", src->init); in.dptr = in.data; in.dsize = len; mutt_extract_token (&token, &in, 0); if (token.data && *token.data) - *dst = str_dup (token.data); + *dst = m_strdup(token.data); else - *dst = str_dup (""); + *dst = m_strdup(""); p_delete(&in.data); p_delete(&token.data); } else - *dst = str_dup (""); + *dst = m_strdup(""); } else /* for non-string: take value as is */ - *dst = str_dup (src->init); + *dst = m_strdup(src->init); return (1); } @@ -2086,7 +2086,7 @@ static int source_rc (const char *rcfile, BUFFER * err) while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL) { conv = ConfigCharset && (*ConfigCharset) && Charset; if (conv) { - currentline = str_dup (linebuf); + currentline = m_strdup(linebuf); if (!currentline) continue; mutt_convert_string (¤tline, ConfigCharset, Charset, 0); @@ -2169,7 +2169,7 @@ int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err) memset (&expn, 0, sizeof(expn)); expn.data = expn.dptr = line; - expn.dsize = str_len (line); + expn.dsize = m_strlen(line); *err->data = 0; @@ -2293,8 +2293,8 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) /* loop through all the possible prefixes (no, inv, ...) */ if (!str_ncmp (buffer, "set", 3)) { for (num = 0; prefixes[num]; num++) { - if (!str_ncmp (pt, prefixes[num], str_len (prefixes[num]))) { - pt += str_len (prefixes[num]); + if (!str_ncmp (pt, prefixes[num], m_strlen(prefixes[num]))) { + pt += m_strlen(prefixes[num]); break; } } @@ -2403,7 +2403,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) if (str_ncmp (buffer, "set", 3) == 0) { strfcpy (var, pt, sizeof(var)); /* ignore the trailing '=' when comparing */ - var[str_len (var) - 1] = 0; + var[m_strlen(var) - 1] = 0; if (!(option = hash_find (ConfigOptions, var))) return 0; /* no such variable. */ else { @@ -2601,18 +2601,18 @@ void mutt_init (int skip_sys_rc, LIST * commands) /* on one of the systems I use, getcwd() does not return the same prefix as is listed in the passwd file */ if ((p = getenv ("HOME"))) - Homedir = str_dup (p); + Homedir = m_strdup(p); /* Get some information about the user */ if ((pw = getpwuid (getuid ()))) { char rnbuf[STRING]; - Username = str_dup (pw->pw_name); + Username = m_strdup(pw->pw_name); if (!Homedir) - Homedir = str_dup (pw->pw_dir); + Homedir = m_strdup(pw->pw_dir); - Realname = str_dup (mutt_gecos_name (rnbuf, sizeof(rnbuf), pw)); - Shell = str_dup (pw->pw_shell); + Realname = m_strdup(mutt_gecos_name (rnbuf, sizeof(rnbuf), pw)); + Shell = m_strdup(pw->pw_shell); endpwent (); } else { @@ -2622,13 +2622,13 @@ void mutt_init (int skip_sys_rc, LIST * commands) exit (1); } if ((p = getenv ("USER"))) - Username = str_dup (p); + Username = m_strdup(p); else { mutt_endwin (NULL); fputs (_("unable to determine username"), stderr); exit (1); } - Shell = str_dup ((p = getenv ("SHELL")) ? p : "/bin/sh"); + Shell = m_strdup((p = getenv ("SHELL")) ? p : "/bin/sh"); } debug_start(Homedir); @@ -2642,20 +2642,20 @@ void mutt_init (int skip_sys_rc, LIST * commands) strfcpy (buffer, p, sizeof(buffer)); /* save the domain for below */ } else - Hostname = str_dup (utsname.nodename); + Hostname = m_strdup(utsname.nodename); #ifndef DOMAIN #define DOMAIN buffer if (!p && getdnsdomainname (buffer, sizeof(buffer)) == -1) - Fqdn = str_dup ("@"); + Fqdn = m_strdup("@"); else #endif /* DOMAIN */ if (*DOMAIN != '@') { - Fqdn = p_new(char, str_len(DOMAIN) + str_len(Hostname) + 2); + Fqdn = p_new(char, m_strlen(DOMAIN) + m_strlen(Hostname) + 2); sprintf (Fqdn, "%s.%s", NONULL (Hostname), DOMAIN); /* __SPRINTF_CHECKED__ */ } else - Fqdn = str_dup (NONULL (Hostname)); + Fqdn = m_strdup(NONULL (Hostname)); #ifdef USE_NNTP { @@ -2671,37 +2671,37 @@ void mutt_init (int skip_sys_rc, LIST * commands) while (*q && !isspace(*q)) q++; *q = '\0'; - NewsServer = str_dup (p); + NewsServer = m_strdup(p); fclose (f); } } if ((p = getenv ("NNTPSERVER"))) - NewsServer = str_dup (p); + NewsServer = m_strdup(p); #endif if ((p = getenv ("MAIL"))) - Spoolfile = str_dup (p); + Spoolfile = m_strdup(p); else if ((p = getenv ("MAILDIR"))) - Spoolfile = str_dup (p); + Spoolfile = m_strdup(p); else { #ifdef HOMESPOOL mutt_concat_path (buffer, NONULL (Homedir), MAILPATH, sizeof(buffer)); #else mutt_concat_path (buffer, MAILPATH, NONULL (Username), sizeof(buffer)); #endif - Spoolfile = str_dup (buffer); + Spoolfile = m_strdup(buffer); } if ((p = getenv ("MAILCAPS"))) - MailcapPath = str_dup (p); + MailcapPath = m_strdup(p); else { /* Default search path from RFC1524 */ MailcapPath = - str_dup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR + m_strdup("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"); } - Tempdir = str_dup ((p = getenv ("TMPDIR")) ? p : "/tmp"); + Tempdir = m_strdup((p = getenv ("TMPDIR")) ? p : "/tmp"); p = getenv ("VISUAL"); if (!p) { @@ -2709,8 +2709,8 @@ void mutt_init (int skip_sys_rc, LIST * commands) if (!p) p = "vi"; } - Editor = str_dup (p); - Visual = str_dup (p); + Editor = m_strdup(p); + Visual = m_strdup(p); if ((p = getenv ("REPLYTO")) != NULL) { BUFFER buf, token; @@ -2719,7 +2719,7 @@ void mutt_init (int skip_sys_rc, LIST * commands) memset (&buf, 0, sizeof(buf)); buf.data = buf.dptr = buffer; - buf.dsize = str_len (buffer); + buf.dsize = m_strlen(buffer); memset (&token, 0, sizeof(token)); parse_my_hdr (&token, &buf, 0, &err); @@ -2789,16 +2789,16 @@ void mutt_init (int skip_sys_rc, LIST * commands) NONULL (Homedir)); default_rc = 1; - Muttrc = str_dup (buffer); + Muttrc = m_strdup(buffer); } else { strfcpy (buffer, Muttrc, sizeof(buffer)); p_delete(&Muttrc); mutt_expand_path (buffer, sizeof(buffer)); - Muttrc = str_dup (buffer); + Muttrc = m_strdup(buffer); } p_delete(&AliasFile); - AliasFile = str_dup (NONULL (Muttrc)); + AliasFile = m_strdup(NONULL (Muttrc)); /* Process the global rc file if it exists and the user hasn't explicity requested not to via "-n". */ diff --git a/keymap.c b/keymap.c index 707a8cb..586d4fa 100644 --- a/keymap.c +++ b/keymap.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -23,7 +24,6 @@ #include "mapping.h" #include "mutt_crypt.h" -#include "lib/str.h" #include #include @@ -194,8 +194,8 @@ void km_bind (const char *s, int menu, int op, char *macro, char *descr) map = allocKeys (len, buf); map->op = op; - map->macro = str_dup (macro); - map->descr = str_dup (descr); + map->macro = m_strdup(macro); + map->descr = m_strdup(descr); tmp = Keymaps[menu]; @@ -252,7 +252,7 @@ static int get_op (struct binding_t *bindings, const char *start, size_t len) for (i = 0; bindings[i].name; i++) { if (!ascii_strncasecmp (start, bindings[i].name, len) && - str_len (bindings[i].name) == len) + m_strlen(bindings[i].name) == len) return bindings[i].op; } @@ -274,7 +274,7 @@ static const char *get_func (struct binding_t *bindings, int op) static void push_string (char *s) { - char *pp, *p = s + str_len (s) - 1; + char *pp, *p = s + m_strlen(s) - 1; size_t l; int i, op = OP_NULL; @@ -493,7 +493,7 @@ int km_expand_key (char *s, size_t len, struct keymap_t *map) FOREVER { strfcpy (s, km_keyname (map->keys[p]), len); - len -= (l = str_len (s)); + len -= (l = m_strlen(s)); if (++p >= map->len || !len) return (1); @@ -837,7 +837,7 @@ int mutt_parse_macro (BUFFER * buf, BUFFER * s, unsigned long data, } else { if (MoreArgs (s)) { - seq = str_dup (buf->data); + seq = m_strdup(buf->data); mutt_extract_token (buf, s, M_TOKEN_CONDENSE); if (MoreArgs (s)) { @@ -885,9 +885,9 @@ int mutt_parse_exec (BUFFER * buf, BUFFER * s, unsigned long data, && CurrentMenu != MENU_PAGER) bindings = OpGeneric; - ops[nops] = get_op (bindings, function, str_len (function)); + ops[nops] = get_op (bindings, function, m_strlen(function)); if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER) - ops[nops] = get_op (OpGeneric, function, str_len (function)); + ops[nops] = get_op (OpGeneric, function, m_strlen(function)); if (ops[nops] == OP_NULL) { mutt_flushinp (); diff --git a/lib-lib/Makefile.am b/lib-lib/Makefile.am index 8faa8ab..3233c27 100644 --- a/lib-lib/Makefile.am +++ b/lib-lib/Makefile.am @@ -1,6 +1,7 @@ noinst_LIBRARIES = liblib.a -liblib_a_SOURCES = mem.c +liblib_a_SOURCES = mem.h str.h \ + str.c -noinst_HEADERS = mem.h +noinst_HEADERS = mem.h str.h diff --git a/lib-lib/macros.h b/lib-lib/macros.h index e8e6a61..14eba96 100644 --- a/lib-lib/macros.h +++ b/lib-lib/macros.h @@ -1,3 +1,21 @@ +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright © 2006 Pierre Habouzit + */ + #ifndef MUTT_LIB_LIB_MACROS_H #define MUTT_LIB_LIB_MACROS_H diff --git a/lib-lib/mem.c b/lib-lib/mem.c deleted file mode 100644 index e69de29..0000000 diff --git a/lib-lib/mem.h b/lib-lib/mem.h index c95feac..c462c19 100644 --- a/lib-lib/mem.h +++ b/lib-lib/mem.h @@ -13,7 +13,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Author: Pierre Habouzit + * Copyright © 2006 Pierre Habouzit */ #ifndef MUTT_LIB_LIB_MEM_H diff --git a/lib.c b/lib.c index eee11e5..7c704b9 100644 --- a/lib.c +++ b/lib.c @@ -35,10 +35,10 @@ #endif #include +#include #include "lib.h" -#include "lib/str.h" #include "lib/debug.h" extern short Umask; @@ -218,7 +218,7 @@ int safe_symlink (const char *oldpath, const char *newpath) char abs_oldpath[_POSIX_PATH_MAX]; if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) || - (str_len (abs_oldpath) + 1 + str_len (oldpath) + 1 > + (m_strlen(abs_oldpath) + 1 + m_strlen(oldpath) + 1 > sizeof abs_oldpath)) return -1; @@ -479,7 +479,7 @@ char *mutt_concat_path (char *d, const char *dir, const char *fname, size_t l) { const char *fmt = "%s/%s"; - if (!*fname || (*dir && dir[str_len (dir) - 1] == '/')) + if (!*fname || (*dir && dir[m_strlen(dir) - 1] == '/')) fmt = "%s%s"; snprintf (d, l, fmt, dir, fname); diff --git a/lib/debug.c b/lib/debug.c index 5136175..beefe12 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -16,11 +16,11 @@ #include #include +#include #include "debug.h" #include "mutt.h" #include "globals.h" -#include "str.h" short DebugLevel = -1; FILE* DebugFile = NULL; diff --git a/lib/exit.c b/lib/exit.c index be9ecad..b83953b 100644 --- a/lib/exit.c +++ b/lib/exit.c @@ -2,8 +2,8 @@ #include #include +#include #include "exit.h" -#include "str.h" #include /* XXX remove after modularization*/ diff --git a/lib/list.c b/lib/list.c index 23dcf26..8edcec2 100644 --- a/lib/list.c +++ b/lib/list.c @@ -11,10 +11,10 @@ #include #include +#include #include "list.h" -#include "str.h" list2_t* list_new (void) { return p_new(list2_t, 1); @@ -118,9 +118,9 @@ list2_t* list_from_str (const char* str, const char* delim) { if (!str || !*str || !delim || !*delim) return (NULL); - tmp = str_dup (str); + tmp = m_strdup(str); for (p = strtok (tmp, delim); p; p = strtok (NULL, delim)) { - list_push_back (&ret, str_dup (p)); + list_push_back (&ret, m_strdup(p)); } p_delete(&tmp); return (ret); diff --git a/lib/rx.c b/lib/rx.c index 4465255..5595108 100644 --- a/lib/rx.c +++ b/lib/rx.c @@ -9,15 +9,15 @@ #endif #include +#include #include "rx.h" -#include "str.h" rx_t *rx_compile (const char *s, int flags) { rx_t *pp = p_new(rx_t, 1); - pp->pattern = str_dup (s); + pp->pattern = m_strdup(s); pp->rx = p_new(regex_t, 1); if (REGCOMP(pp->rx, NONULL (s), flags) != 0) rx_free (&pp); diff --git a/lib/str.c b/lib/str.c index e40e614..7eb2efc 100644 --- a/lib/str.c +++ b/lib/str.c @@ -13,16 +13,10 @@ #include #include +#include #include "str.h" -char *str_dup (const char *s) -{ - if (!s || !*s) - return NULL; - return p_dupstr(s, str_len(s)); -} - char *str_cat (char *d, size_t l, const char *s) { char *p = d; @@ -81,11 +75,6 @@ int str_ncasecmp (const char *a, const char *b, size_t l) return strncasecmp (NONULL (a), NONULL (b), l); } -size_t str_len (const char *a) -{ - return a ? strlen (a) : 0; -} - int str_coll (const char *a, const char *b) { return strcoll (NONULL (a), NONULL (b)); @@ -94,14 +83,14 @@ int str_coll (const char *a, const char *b) void str_replace (char **p, const char *s) { p_delete(p); - *p = str_dup (s); + *p = m_strdup(s); } void str_adjust (char **p) { if (!p || !*p) return; - p_realloc(p, str_len (*p) + 1); + p_realloc(p, m_strlen(*p) + 1); } /* convert all characters in the string to lowercase */ @@ -159,9 +148,9 @@ const char *str_isstr (const char *haystack, const char *needle) } int str_eq (const char* s1, const char* s2) { - int l = str_len (s1); + int l = m_strlen(s1); - if (l != str_len (s2)) + if (l != m_strlen(s2)) return (0); return (str_ncmp (s1, s2, l) == 0); } @@ -174,6 +163,6 @@ char* str_skip_initws (char* s) { void str_skip_trailws (char *s) { char *p; - for (p = s + str_len (s) - 1; p >= s && ISSPACE (*p); p--) + for (p = s + m_strlen(s) - 1; p >= s && ISSPACE (*p); p--) *p = 0; } diff --git a/lib/str.h b/lib/str.h index ef5211d..249ca20 100644 --- a/lib/str.h +++ b/lib/str.h @@ -41,7 +41,6 @@ * safety wrappers/replacements * (mostly only difference: safely handle NULL strings) */ -char *str_dup (const char*); char *str_cat (char*, size_t, const char*); char *str_ncat (char*, size_t, const char*, size_t); int str_cmp (const char*, const char*); @@ -49,7 +48,6 @@ int str_casecmp (const char*, const char*); int str_ncmp (const char*, const char*, size_t); int str_ncasecmp (const char*, const char*, size_t); int str_coll (const char*, const char*); -size_t str_len (const char*); /* * tools diff --git a/list.c b/list.c index 550604a..54218b9 100644 --- a/list.c +++ b/list.c @@ -14,16 +14,16 @@ #include #include +#include #include "list.h" -#include "lib/str.h" LIST *mutt_copy_list (LIST * p) { LIST *t, *r = NULL, *l = NULL; for (; p; p = p->next) { t = p_new(LIST, 1); - t->data = str_dup (p->data); + t->data = m_strdup(p->data); t->next = NULL; if (l) { r->next = t; @@ -37,7 +37,7 @@ LIST *mutt_copy_list (LIST * p) { LIST *mutt_add_list (LIST * head, const char *data) { - size_t len = str_len (data); + size_t len = m_strlen(data); return (mutt_add_list_n (head, data, len ? len + 1 : 0)); } diff --git a/main.c b/main.c index 9af3581..27b8bc2 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,7 @@ #endif #include +#include #include #include "mutt.h" @@ -30,7 +31,6 @@ #include "mutt_idna.h" #include "xterm.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -872,7 +872,7 @@ int main (int argc, char **argv) } if (subject) - msg->env->subject = str_dup (subject); + msg->env->subject = m_strdup(subject); if (includeFile) infile = includeFile; @@ -899,7 +899,7 @@ int main (int argc, char **argv) fin = NULL; mutt_mktemp (buf); - tempfile = str_dup (buf); + tempfile = m_strdup(buf); if (draftFile) msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0); diff --git a/mbox.c b/mbox.c index cc3af4c..1485ad7 100644 --- a/mbox.c +++ b/mbox.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -28,7 +29,6 @@ #include "compress.h" #endif -#include "lib/str.h" #include "lib/debug.h" #include diff --git a/menu.c b/menu.c index 981382b..54d36dd 100644 --- a/menu.c +++ b/menu.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -25,7 +26,6 @@ #include "imap.h" #endif -#include "lib/str.h" #include #include @@ -38,7 +38,7 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) { wchar_t wc; size_t k; - size_t n = str_len ((char *) s); + size_t n = m_strlen((char *) s); mbstate_t mbstate; memset (&mbstate, 0, sizeof (mbstate)); @@ -157,7 +157,7 @@ void menu_pad_string (char *s, size_t n) cols = COLS - shift - SidebarWidth; else cols = COLS - shift; - mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, str_len (s), 1); + mutt_format_string (tmpbuf, n, cols, cols, 0, ' ', s, m_strlen(s), 1); tmpbuf[n - 1] = 0; snprintf (s, n, "%s", tmpbuf); /* overkill */ p_delete(&tmpbuf); diff --git a/mh.c b/mh.c index 905f6cc..fc75d78 100644 --- a/mh.c +++ b/mh.c @@ -18,6 +18,7 @@ #endif #include +#include #include #include "mutt.h" @@ -30,7 +31,6 @@ #include "thread.h" #include "hcache.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -211,7 +211,7 @@ static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt) } } else { - *tgt = str_dup (path); + *tgt = m_strdup(path); break; } } @@ -307,11 +307,11 @@ void mh_update_sequences (CONTEXT * ctx) /* first, copy unknown sequences */ if ((ofp = fopen (sequences, "r"))) { while ((buff = mutt_read_line (buff, &s, ofp, &l))) { - if (!str_ncmp (buff, seq_unseen, str_len (seq_unseen))) + if (!str_ncmp (buff, seq_unseen, m_strlen(seq_unseen))) continue; - if (!str_ncmp (buff, seq_flagged, str_len (seq_flagged))) + if (!str_ncmp (buff, seq_flagged, m_strlen(seq_flagged))) continue; - if (!str_ncmp (buff, seq_replied, str_len (seq_replied))) + if (!str_ncmp (buff, seq_replied, m_strlen(seq_replied))) continue; fprintf (nfp, "%s\n", buff); @@ -398,17 +398,17 @@ static void mh_sequences_add_one (CONTEXT * ctx, int n, short unseen, snprintf (sequences, sizeof (sequences), "%s/.mh_sequences", ctx->path); if ((ofp = fopen (sequences, "r"))) { while ((buff = mutt_read_line (buff, &sz, ofp, &line))) { - if (unseen && !strncmp (buff, seq_unseen, str_len (seq_unseen))) { + if (unseen && !strncmp (buff, seq_unseen, m_strlen(seq_unseen))) { fprintf (nfp, "%s %d\n", buff, n); unseen_done = 1; } else if (flagged - && !strncmp (buff, seq_flagged, str_len (seq_flagged))) { + && !strncmp (buff, seq_flagged, m_strlen(seq_flagged))) { fprintf (nfp, "%s %d\n", buff, n); flagged_done = 1; } else if (replied - && !strncmp (buff, seq_replied, str_len (seq_replied))) { + && !strncmp (buff, seq_replied, m_strlen(seq_replied))) { fprintf (nfp, "%s %d\n", buff, n); replied_done = 1; } @@ -640,10 +640,10 @@ static int maildir_parse_entry (CONTEXT * ctx, struct maildir ***last, if (subdir) { snprintf (buf, sizeof (buf), "%s/%s", subdir, fname); - h->path = str_dup (buf); + h->path = m_strdup(buf); } else - h->path = str_dup (fname); + h->path = m_strdup(fname); entry = p_new(struct maildir, 1); entry->h = h; @@ -843,7 +843,7 @@ static size_t maildir_hcache_keylen (const char *fn) { const char *p = strchr (fn, ':'); - return p ? (size_t) (p - fn) : str_len (fn); + return p ? (size_t) (p - fn) : m_strlen(fn); } #endif @@ -1009,7 +1009,7 @@ static void maildir_flags (char *dest, size_t destlen, HEADER * hdr) hdr->read ? "S" : "", hdr->deleted ? "T" : "", NONULL (hdr->maildir_flags)); if (hdr->maildir_flags) - qsort (tmp, str_len (tmp), 1, ch_compar); + qsort (tmp, m_strlen(tmp), 1, ch_compar); snprintf (dest, destlen, ":2,%s", tmp); } } @@ -1063,7 +1063,7 @@ static int maildir_open_new_message (MESSAGE * msg, CONTEXT * dest, HEADER * hdr } else { debug_print (2, ("success.\n")); - msg->path = str_dup (path); + msg->path = m_strdup(path); break; } } @@ -1613,7 +1613,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint, int unused) for (p = md; p; p = p->next) { maildir_canon_filename (buf, p->h->path, sizeof (buf)); - p->canon_fname = str_dup (buf); + p->canon_fname = m_strdup(buf); hash_insert (fnames, p->canon_fname, p, 0); } diff --git a/mutt_idna.c b/mutt_idna.c index 14d8f45..4b160f2 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -19,7 +20,6 @@ #include "charset.h" #include "mutt_idna.h" -#include "lib/str.h" #include "lib/debug.h" /* The low-level interface we use. */ @@ -28,13 +28,13 @@ int mutt_idna_to_local (const char *in, char **out, int flags) { - *out = str_dup (in); + *out = m_strdup(in); return 1; } int mutt_local_to_idna (const char *in, char **out) { - *out = str_dup (in); + *out = m_strdup(in); return 0; } @@ -64,7 +64,7 @@ int mutt_idna_to_local (const char *in, char **out, int flags) if ((flags & MI_MAY_BE_IRREVERSIBLE) == 0) { int irrev = 0; char *t2 = NULL; - char *tmp = str_dup (*out); + char *tmp = m_strdup(*out); if (mutt_convert_string (&tmp, Charset, "utf-8", M_ICONV_HOOK_FROM) == -1) irrev = 1; @@ -86,14 +86,14 @@ int mutt_idna_to_local (const char *in, char **out, int flags) notrans: p_delete(out); - *out = str_dup (in); + *out = m_strdup(in); return 1; } int mutt_local_to_idna (const char *in, char **out) { int rv = 0; - char *tmp = str_dup (in); + char *tmp = m_strdup(in); *out = NULL; @@ -110,7 +110,7 @@ int mutt_local_to_idna (const char *in, char **out) p_delete(&tmp); if (rv < 0) { p_delete(out); - *out = str_dup (in); + *out = m_strdup(in); } return rv; } @@ -131,7 +131,7 @@ static int mbox_to_udomain (const char *mbx, char **user, char **domain) if (!p || !p[1]) return -1; *user = p_dupstr(mbx, p - mbx); - *domain = str_dup (p + 1); + *domain = m_strdup(p + 1); return 0; } @@ -153,10 +153,10 @@ int mutt_addrlist_to_idna (ADDRESS * a, char **err) if (mutt_local_to_idna (domain, &tmp) < 0) { e = 1; if (err) - *err = str_dup (domain); + *err = m_strdup(domain); } else { - p_realloc(&a->mailbox, str_len(user) + str_len(tmp) + 2); + p_realloc(&a->mailbox, m_strlen(user) + m_strlen(tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ } @@ -183,7 +183,7 @@ int mutt_addrlist_to_local (ADDRESS * a) continue; if (mutt_idna_to_local (domain, &tmp, 0) == 0) { - p_realloc(&a->mailbox, str_len(user) + str_len(tmp) + 2); + p_realloc(&a->mailbox, m_strlen(user) + m_strlen(tmp) + 2); sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ } @@ -217,7 +217,7 @@ const char *mutt_addr_for_display (ADDRESS * a) return a->mailbox; } - p_realloc(&buff, str_len(tmp) + str_len(user) + 2); + p_realloc(&buff, m_strlen(tmp) + m_strlen(user) + 2); sprintf (buff, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */ p_delete(&tmp); p_delete(&user); diff --git a/mutt_libesmtp.c b/mutt_libesmtp.c index 9b45062..ab858f1 100644 --- a/mutt_libesmtp.c +++ b/mutt_libesmtp.c @@ -15,13 +15,13 @@ #endif #include +#include #include #include "mutt.h" #include "ascii.h" #include "enter.h" -#include "lib/str.h" #if defined (USE_SSL) || (defined (USE_GNUTLS) && defined (HAVE_GNUTLS_OPENSSL_H)) #include @@ -334,7 +334,7 @@ int mutt_libesmtp_invoke (ADDRESS * from, /* the sender */ /* Create hostname:port string and tell libesmtp */ /* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */ - hostportlen = str_len (SmtpHost) + 7; + hostportlen = m_strlen(SmtpHost) + 7; hostportstr = p_new(char, hostportlen); snprintf (hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort); if (!smtp_set_server (session, hostportstr)) diff --git a/mutt_sasl.c b/mutt_sasl.c index 5bc1b70..15f8c0e 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -116,7 +116,7 @@ static int iptostring (const struct sockaddr *addr, socklen_t addrlen, if (ret) return getnameinfo_err (ret); - if (outlen < str_len (hbuf) + str_len (pbuf) + 2) + if (outlen < m_strlen(hbuf) + m_strlen(pbuf) + 2) return SASL_BUFOVER; snprintf (out, outlen, "%s;%s", hbuf, pbuf); @@ -331,7 +331,7 @@ int mutt_sasl_interact (sasl_interact_t * interaction) if (mutt_get_field (prompt, resp, sizeof (resp), 0)) return SASL_FAIL; - interaction->len = str_len (resp) + 1; + interaction->len = m_strlen(resp) + 1; interaction->result = p_dupstr(resp, interaction->len - 1); interaction++; } @@ -429,7 +429,7 @@ static int mutt_sasl_cb_authname (void *context, int id, const char **result, } if (len) - *len = str_len (*result); + *len = m_strlen(*result); return SASL_OK; } @@ -449,7 +449,7 @@ static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id, if (mutt_account_getpass (account)) return SASL_FAIL; - len = str_len (account->pass); + len = m_strlen(account->pass); *psecret = xmalloc(sizeof(sasl_secret_t) + len); (*psecret)->len = len; diff --git a/mutt_socket.c b/mutt_socket.c index 1a02f24..2c49da9 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -26,7 +27,6 @@ #include "mutt_idna.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -104,7 +104,7 @@ int mutt_socket_write_d (CONNECTION * conn, const char *buf, int dbg) return -1; } - len = str_len (buf); + len = m_strlen(buf); if ((rc = conn->conn_write (conn, buf, len)) < 0) { debug_print (1, ("error writing, closing socket\n")); mutt_socket_close (conn); @@ -170,7 +170,7 @@ int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION * conn, debug_print (dbg, ("< %s\n", buf)); - /* number of bytes read, not str_len */ + /* number of bytes read, not m_strlen*/ return i + 1; } @@ -267,7 +267,7 @@ static int socket_preconnect (void) int rc; int save_errno; - if (str_len (Preconnect)) { + if (m_strlen(Preconnect)) { debug_print (2, ("Executing preconnect: %s\n", Preconnect)); rc = mutt_system (Preconnect); debug_print (2, ("Preconnect result: %d\n", rc)); diff --git a/mutt_ssl.c b/mutt_ssl.c index 091eb84..804183c 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -21,6 +21,7 @@ #include #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "mutt_curses.h" #include "mutt_ssl.h" -#include "lib/str.h" #include "lib/debug.h" #if OPENSSL_VERSION_NUMBER >= 0x00904000L @@ -416,7 +416,7 @@ static char *x509_get_part (char *line, const char *ndx) c = strstr (line, ndx); if (c) { - c += str_len (ndx); + c += m_strlen(ndx); c2 = strchr (c, '/'); if (c2) *c2 = '\0'; diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c index f6d8b2d..c8e0ce0 100644 --- a/mutt_ssl_gnutls.c +++ b/mutt_ssl_gnutls.c @@ -21,6 +21,7 @@ #endif #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "mutt_menu.h" #include "mutt_ssl.h" -#include "lib/str.h" #include "lib/rx.h" typedef struct _tlssockdata { diff --git a/mutt_tunnel.c b/mutt_tunnel.c index 13a08ee..92fcea5 100644 --- a/mutt_tunnel.c +++ b/mutt_tunnel.c @@ -13,13 +13,13 @@ #endif #include +#include #include #include "mutt.h" #include "mutt_socket.h" #include "mutt_tunnel.h" -#include "lib/str.h" #include #include diff --git a/muttlib.c b/muttlib.c index bb48e07..857305a 100644 --- a/muttlib.c +++ b/muttlib.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -35,7 +36,6 @@ #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -94,7 +94,7 @@ void mutt_adv_mktemp (const char* dir, char *s, size_t l) mktemp (s); if (period != NULL) { *period = '.'; - sl = str_len (s); + sl = m_strlen(s); strfcpy (s + sl, period, l - sl); } } @@ -131,19 +131,19 @@ int mutt_copy_body (FILE * fp, BODY ** tgt, BODY * src) b->parts = NULL; b->next = NULL; - b->filename = str_dup (tmp); + b->filename = m_strdup(tmp); b->use_disp = use_disp; b->unlink = 1; if (mutt_is_text_part (b)) b->noconv = 1; - b->xtype = str_dup (b->xtype); - b->subtype = str_dup (b->subtype); - b->form_name = str_dup (b->form_name); - b->filename = str_dup (b->filename); - b->d_filename = str_dup (b->d_filename); - b->description = str_dup (b->description); + b->xtype = m_strdup(b->xtype); + b->subtype = m_strdup(b->subtype); + b->form_name = m_strdup(b->form_name); + b->filename = m_strdup(b->filename); + b->d_filename = m_strdup(b->d_filename); + b->description = m_strdup(b->description); /* * we don't seem to need the HEADER structure currently. @@ -157,8 +157,8 @@ int mutt_copy_body (FILE * fp, BODY ** tgt, BODY * src) for (par = b->parameter, ppar = &b->parameter; par; ppar = &(*ppar)->next, par = par->next) { *ppar = mutt_new_parameter (); - (*ppar)->attribute = str_dup (par->attribute); - (*ppar)->value = str_dup (par->value); + (*ppar)->attribute = m_strdup(par->attribute); + (*ppar)->value = m_strdup(par->value); } mutt_stamp_attachment (b); @@ -253,7 +253,7 @@ void mutt_free_header (HEADER ** h) int mutt_matches_ignore (const char *s, LIST * t) { for (; t; t = t->next) { - if (!ascii_strncasecmp (s, t->data, str_len (t->data)) + if (!ascii_strncasecmp (s, t->data, m_strlen(t->data)) || *t->data == '*') return 1; } @@ -341,7 +341,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) #ifdef USE_IMAP /* if folder = imap[s]://host/: don't append slash */ if (imap_is_magic (NONULL (Maildir), NULL) == M_IMAP && - Maildir[str_len (Maildir) - 1] == '/') + Maildir[m_strlen(Maildir) - 1] == '/') strfcpy (p, NONULL (Maildir), sizeof (p)); else #endif @@ -466,7 +466,7 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) else strfcpy (dest, pw->pw_gecos, destlen); - pwnl = str_len (pw->pw_name); + pwnl = m_strlen(pw->pw_name); for (idx = 0; dest[idx]; idx++) { if (dest[idx] == '&') { @@ -508,8 +508,8 @@ void mutt_set_parameter (const char *attribute, const char *value, } q = mutt_new_parameter (); - q->attribute = str_dup (attribute); - q->value = str_dup (value); + q->attribute = m_strdup(attribute); + q->value = m_strdup(value); q->next = *p; *p = q; } @@ -722,15 +722,15 @@ void mutt_pretty_mailbox (char *s) } *q = 0; - if (str_ncmp (s, Maildir, (len = str_len (Maildir))) == 0 && + if (str_ncmp (s, Maildir, (len = m_strlen(Maildir))) == 0 && s[len] == '/') { *s++ = '='; - memmove (s, s + len, str_len (s + len) + 1); + memmove (s, s + len, m_strlen(s + len) + 1); } - else if (str_ncmp (s, Homedir, (len = str_len (Homedir))) == 0 && + else if (str_ncmp (s, Homedir, (len = m_strlen(Homedir))) == 0 && s[len] == '/') { *s++ = '~'; - memmove (s, s + len - 1, str_len (s + len - 1) + 1); + memmove (s, s + len - 1, m_strlen(s + len - 1) + 1); } } @@ -770,7 +770,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt, size_t slen; int found = 0; - slen = str_len (src); + slen = m_strlen(src); destlen--; for (p = fmt, d = dest; destlen && *p; p++) { @@ -922,7 +922,7 @@ int mutt_skipchars (const char *s, const char *c) ret++; s++; } - return (str_len (p)); + return (m_strlen(p)); } void mutt_FormatString (char *dest, /* output buffer */ @@ -1020,7 +1020,7 @@ void mutt_FormatString (char *dest, /* output buffer */ if (count > col) { count -= col; /* how many columns left on this line */ mutt_FormatString (buf, sizeof (buf), src, callback, data, flags); - wid = str_len (buf); + wid = m_strlen(buf); if (count > wid) { count -= wid; /* how many chars to pad */ memset (wptr, ch, count); @@ -1078,7 +1078,7 @@ void mutt_FormatString (char *dest, /* output buffer */ *p = '_'; } - if ((len = str_len (buf)) + wlen > destlen) + if ((len = m_strlen(buf)) + wlen > destlen) len = (destlen - wlen > 0) ? (destlen - wlen) : 0; memcpy (wptr, buf, len); @@ -1145,11 +1145,11 @@ void mutt_FormatString (char *dest, /* output buffer */ then we assume it is a commmand to run instead of a normal file. */ FILE *mutt_open_read (const char *path, pid_t * thepid) { - int len = str_len (path); + int len = m_strlen(path); FILE *f; if (path[len - 1] == '|') { - char *s = str_dup (path); + char *s = m_strdup(path); /* read from a pipe */ diff --git a/mx.c b/mx.c index bbaf57d..4160eeb 100644 --- a/mx.c +++ b/mx.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -54,7 +55,6 @@ #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/list.h" #include "lib/debug.h" @@ -343,7 +343,7 @@ void mx_unlink_empty (const char *path) int mx_get_magic (const char *path) { int i = 0; - if (str_len (path) == 0) + if (m_strlen(path) == 0) return (-1); if ((i = mx_get_idx (path)) >= 0) return (MX_COMMAND(i,type)); @@ -521,7 +521,7 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT * pctx) if (!ctx) ctx = p_new(CONTEXT, 1); p_clear(ctx, 1); - ctx->path = str_dup (path); + ctx->path = m_strdup(path); ctx->msgnotreadyet = -1; ctx->collapsed = 0; diff --git a/nntp/mx_nntp.c b/nntp/mx_nntp.c index 84a9d64..675a7aa 100644 --- a/nntp/mx_nntp.c +++ b/nntp/mx_nntp.c @@ -10,6 +10,7 @@ #include #include +#include #include "mutt.h" #include "nntp.h" @@ -17,7 +18,6 @@ #include "mx.h" #include "mx_nntp.h" -#include "lib/str.h" #include "url.h" diff --git a/nntp/newsrc.c b/nntp/newsrc.c index d3d9a6c..1de5085 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -26,7 +27,6 @@ #include "rfc1524.h" #include "rfc2047.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -75,7 +75,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line) len = sizeof (group); strfcpy (group, line, len); if ((data = (NNTP_DATA *) hash_find (news->newsgroups, group)) == NULL) { - data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1); + data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1); data->group = (char *) data + sizeof (NNTP_DATA); strcpy (data->group, group); data->nserv = news; @@ -206,7 +206,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) return 0; rewind (index); while (fgets (buf, sizeof (buf), index)) { - buf[str_len (buf) - 1] = 0; /* strip ending '\n' */ + buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */ if (!str_ncmp (buf, "#: ", 3) && !str_casecmp (buf + 3, news->conn->account.host)) break; @@ -222,12 +222,12 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) break; sscanf (cp + 1, "%s %d %d", file, &l, &m); if (!str_cmp (buf, "ALL")) { - news->cache = str_dup (file); + news->cache = m_strdup(file); news->newgroups_time = m; } else if (news->newsgroups) { if ((data = (NNTP_DATA *) hash_find (news->newsgroups, buf)) == NULL) { - data = xmalloc(sizeof(NNTP_DATA) + str_len(buf) + 1); + data = xmalloc(sizeof(NNTP_DATA) + m_strlen(buf) + 1); data->group = (char *) data + sizeof (NNTP_DATA); strcpy (data->group, buf); data->nserv = news; @@ -238,7 +238,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) hash_insert (news->newsgroups, data->group, data, 0); nntp_add_to_list (news, data); } - data->cache = str_dup (file); + data->cache = m_strdup(file); t = 0; if (!data->firstMessage || data->lastMessage < m) t = 1; @@ -287,7 +287,7 @@ int nntp_parse_url (const char *server, ACCOUNT * acct, acct->port = NNTP_PORT; acct->type = M_ACCT_TYPE_NNTP; - c = str_dup (server); + c = m_strdup(server); url_parse_ciss (&url, c); if (url.scheme == U_NNTP || url.scheme == U_NNTPS) { @@ -311,7 +311,7 @@ void nntp_expand_path (char *line, size_t len, ACCOUNT * acct) { ciss_url_t url; - url.path = str_dup (line); + url.path = m_strdup(line); mutt_account_tourl (acct, &url); url_ciss_tostring (&url, line, len, 0); p_delete(&url.path); @@ -344,7 +344,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) return NULL; } - buf = p = p_new(char, str_len (server) + 10); + buf = p = p_new(char, m_strlen(server) + 10); if (url_check_scheme (server) == U_UNKNOWN) { strcpy (buf, "nntp://"); p = strchr (buf, '\0'); @@ -396,7 +396,7 @@ NNTP_SERVER *mutt_select_newsserver (char *server) /* New newsserver */ serv = p_new(NNTP_SERVER, 1); serv->conn = conn; - serv->newsrc = str_dup (file); + serv->newsrc = m_strdup(file); serv->newsgroups = hash_create (1009); slurp_newsrc (serv); /* load .newsrc */ nntp_parse_cacheindex (serv); /* load .index */ @@ -513,8 +513,8 @@ static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf, line = *buf + (*pline - line); } strcpy (line, data->group); - len -= str_len (line) + 1; - line += str_len (line); + len -= m_strlen(line) + 1; + line += m_strlen(line); *line++ = data->subscribed ? ':' : '!'; *line++ = ' '; *line = '\0'; @@ -760,7 +760,7 @@ int mutt_newsrc_update (NNTP_SERVER * news) continue; nntp_create_newsrc_line (data, &buf, &line, &llen); debug_print (2, ("Added to newsrc: %s\n", line)); - line += str_len (line); + line += m_strlen(line); } /* newrc being fully rewritten */ if (news->newsrc && @@ -786,7 +786,7 @@ static FILE *mutt_mkname (char *s) return fp; nntp_cache_expand (buf, "cache-XXXXXX"); - pc = buf + str_len (buf) - 12; /* positioning to "cache-XXXXXX" */ + pc = buf + m_strlen(buf) - 12; /* positioning to "cache-XXXXXX" */ if ((fd = mkstemp (buf)) == -1) return NULL; strcpy (s, pc); /* generated name */ @@ -856,7 +856,7 @@ int nntp_save_cache_index (NNTP_SERVER * news) else { strfcpy (buf, news->conn->account.host, sizeof (buf)); f = mutt_mkname (buf); - news->cache = str_dup (buf); + news->cache = m_strdup(buf); nntp_cache_expand (file, buf); } if (!f) @@ -912,7 +912,7 @@ int nntp_save_cache_group (CONTEXT * ctx) ((NNTP_DATA *) ctx->data)->nserv->conn->account.host, ((NNTP_DATA *) ctx->data)->group); f = mutt_mkname (buf); - ((NNTP_DATA *) ctx->data)->cache = str_dup (buf); + ((NNTP_DATA *) ctx->data)->cache = m_strdup(buf); nntp_cache_expand (file, buf); } if (!f) @@ -992,7 +992,7 @@ NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER * news, char *group) if (!news || !news->newsgroups || !group || !*group) return NULL; if (!(data = (NNTP_DATA *) hash_find (news->newsgroups, group))) { - data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1); + data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1); data->group = (char *) data + sizeof (NNTP_DATA); strcpy (data->group, group); data->nserv = news; diff --git a/nntp/nntp.c b/nntp/nntp.c index 4cc318d..2b9ead7 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -30,7 +31,6 @@ #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -369,7 +369,7 @@ static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query, char *msg, pos += chunk; if (chunk >= sizeof (buf)) { - lenbuf += str_len (p); + lenbuf += m_strlen(p); } else { if (bar) { @@ -514,7 +514,7 @@ static int parse_description (char *line, void *n) if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL && str_cmp (d, data->desc)) { p_delete(&data->desc); - data->desc = str_dup (d); + data->desc = m_strdup(d); } return 0; #undef news @@ -555,10 +555,10 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) int x, done = 0; hdr->env = mutt_new_envelope (); - hdr->env->newsgroups = str_dup (nntp_data->group); + hdr->env->newsgroups = m_strdup(nntp_data->group); hdr->content = mutt_new_body (); hdr->content->type = TYPETEXT; - hdr->content->subtype = str_dup ("plain"); + hdr->content->subtype = m_strdup("plain"); hdr->content->encoding = ENC7BIT; hdr->content->disposition = DISPINLINE; hdr->content->length = -1; @@ -579,7 +579,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) nntp_get_status (ctx, hdr, NULL, hdr->article_num); break; case 1: - hdr->env->subject = str_dup (b); + hdr->env->subject = m_strdup(b); break; case 2: rfc822_free_address (&hdr->env->from); @@ -591,7 +591,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) * bothered me for _years_ */ if (!hdr->env->from) { hdr->env->from = rfc822_new_address (); - hdr->env->from->personal = str_dup (b); + hdr->env->from->personal = m_strdup(b); } break; case 3: @@ -600,7 +600,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) break; case 4: p_delete(&hdr->env->message_id); - hdr->env->message_id = str_dup (b); + hdr->env->message_id = m_strdup(b); break; case 5: mutt_free_list (&hdr->env->references); @@ -616,7 +616,7 @@ static int nntp_parse_xover (CONTEXT * ctx, char *buf, HEADER * hdr) if (!hdr->read) p_delete(&hdr->env->xref); b = b + 6; /* skips the "Xref: " */ - hdr->env->xref = str_dup (b); + hdr->env->xref = m_strdup(b); nntp_parse_xref (ctx, nntp_data->group, b, hdr); } rfc2047_decode_envelope (hdr->env); @@ -865,7 +865,7 @@ int nntp_open_mailbox (CONTEXT * ctx) /* create NNTP-specific state struct if nof found in list */ if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL) { - nntp_data = xmalloc(sizeof(NNTP_DATA) + str_len(buf) + 1); + nntp_data = xmalloc(sizeof(NNTP_DATA) + m_strlen(buf) + 1); nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA); strcpy (nntp_data->group, buf); hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0); @@ -956,7 +956,7 @@ int nntp_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) cache->index = ctx->hdrs[msgno]->index; mutt_mktemp (path); - cache->path = str_dup (path); + cache->path = m_strdup(path); if (!(msg->fp = safe_fopen (path, "w+"))) { p_delete(&cache->path); return -1; @@ -1052,7 +1052,7 @@ int nntp_post (const char *msg) buf[0] = '.'; buf[1] = '\0'; while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL) { - len = str_len (buf); + len = m_strlen(buf); if (buf[len - 1] == '\n') { buf[len - 1] = '\r'; buf[len] = '\n'; @@ -1066,7 +1066,7 @@ int nntp_post (const char *msg) } fclose (f); - if (buf[str_len (buf) - 1] != '\n') + if (buf[m_strlen(buf) - 1] != '\n') mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR); mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR); if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0) { @@ -1276,7 +1276,7 @@ static int add_group (char *buf, void *serv) return 0; if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL) { n++; - nntp_data = xmalloc(sizeof(NNTP_DATA) + str_len(group) + 1); + nntp_data = xmalloc(sizeof(NNTP_DATA) + m_strlen(group) + 1); nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA); strcpy (nntp_data->group, group); nntp_data->nserv = s; @@ -1295,7 +1295,7 @@ static int add_group (char *buf, void *serv) if (nntp_data->desc) p_delete(&nntp_data->desc); if (*desc) - nntp_data->desc = str_dup (desc); + nntp_data->desc = m_strdup(desc); if (nntp_data->rc || nntp_data->lastCached) mutt_newsgroup_stat (nntp_data); else if (nntp_data->lastMessage && diff --git a/pager.c b/pager.c index 8b98c73..2a5cadf 100644 --- a/pager.c +++ b/pager.c @@ -16,6 +16,7 @@ #endif #include +#include #include #include "mutt.h" @@ -40,7 +41,6 @@ #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/rx.h" #include "lib/debug.h" diff --git a/parse.c b/parse.c index acf362d..fe0a40d 100644 --- a/parse.c +++ b/parse.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -26,7 +27,6 @@ #include "mutt_crypt.h" #include "url.h" -#include "lib/str.h" #include "lib/rx.h" #include "lib/debug.h" @@ -52,7 +52,7 @@ char *mutt_read_rfc822_line (FILE * f, char *line, size_t * linelen) return (line); } - buf += str_len (buf) - 1; + buf += m_strlen(buf) - 1; if (*buf == '\n') { /* we did get a full line. remove trailing space */ while (ISSPACE (*buf)) @@ -101,17 +101,17 @@ LIST *mutt_parse_references (char *s, int in_reply_to) new = NULL; if (*s == '<') { - n = str_len (s); + n = m_strlen(s); if (s[n - 1] != '>') { o = s; s = NULL; continue; } - new = str_dup (s); + new = m_strdup(s); } else if (o) { - m = str_len (s); + m = m_strlen(s); if (s[m - 1] == '>') { new = p_new(char, n + m + 1); strcpy (new, o); /* __STRCPY_CHECKED__ */ @@ -234,7 +234,7 @@ static PARAMETER *parse_parameters (const char *s) buffer[i] = 0; } - new->value = str_dup (buffer); + new->value = m_strdup(buffer); debug_print (2, ("`%s' = `%s'\n", new->attribute ? new->attribute : "", new->value ? new->value : "")); @@ -321,7 +321,7 @@ void mutt_parse_content_type (char *s, BODY * ct) * let that take precedence, and don't set it here */ if ((pc = mutt_get_parameter ("name", ct->parameter)) != 0 && !ct->filename) - ct->filename = str_dup (pc); + ct->filename = m_strdup(pc); #ifdef SUN_ATTACHMENT /* this is deep and utter perversion */ @@ -336,7 +336,7 @@ void mutt_parse_content_type (char *s, BODY * ct) *subtype++ = '\0'; for (pc = subtype; *pc && !ISSPACE (*pc) && *pc != ';'; pc++); *pc = '\0'; - ct->subtype = str_dup (subtype); + ct->subtype = m_strdup(subtype); } /* Finally, get the major type */ @@ -344,11 +344,11 @@ void mutt_parse_content_type (char *s, BODY * ct) #ifdef SUN_ATTACHMENT if (ascii_strcasecmp ("x-sun-attachment", s) == 0) - ct->subtype = str_dup ("x-sun-attachment"); + ct->subtype = m_strdup("x-sun-attachment"); #endif if (ct->type == TYPEOTHER) { - ct->xtype = str_dup (s); + ct->xtype = m_strdup(s); } if (ct->subtype == NULL) { @@ -356,20 +356,20 @@ void mutt_parse_content_type (char *s, BODY * ct) * field, so we can attempt to convert the type to BODY here. */ if (ct->type == TYPETEXT) - ct->subtype = str_dup ("plain"); + ct->subtype = m_strdup("plain"); else if (ct->type == TYPEAUDIO) - ct->subtype = str_dup ("basic"); + ct->subtype = m_strdup("basic"); else if (ct->type == TYPEMESSAGE) - ct->subtype = str_dup ("rfc822"); + ct->subtype = m_strdup("rfc822"); else if (ct->type == TYPEOTHER) { char buffer[SHORT_STRING]; ct->type = TYPEAPPLICATION; snprintf (buffer, sizeof (buffer), "x-%s", s); - ct->subtype = str_dup (buffer); + ct->subtype = m_strdup(buffer); } else - ct->subtype = str_dup ("x-unknown"); + ct->subtype = m_strdup("x-unknown"); } /* Default character set for text types. */ @@ -403,7 +403,7 @@ static void parse_content_disposition (char *s, BODY * ct) (parms = parse_parameters (s)))) != 0) str_replace (&ct->filename, s); if ((s = mutt_get_parameter ("name", parms)) != 0) - ct->form_name = str_dup (s); + ct->form_name = m_strdup(s); mutt_free_parameter (&parms); } } @@ -473,9 +473,9 @@ BODY *mutt_read_mime_header (FILE * fp, int digest) } p->offset = ftello (fp); /* Mark the start of the real data */ if (p->type == TYPETEXT && !p->subtype) - p->subtype = str_dup ("plain"); + p->subtype = m_strdup("plain"); else if (p->type == TYPEMESSAGE && !p->subtype) - p->subtype = str_dup ("rfc822"); + p->subtype = m_strdup("rfc822"); p_delete(&line); @@ -589,9 +589,9 @@ BODY *mutt_parse_multipart (FILE * fp, const char *boundary, off_t end_off, return (NULL); } - blen = str_len (boundary); + blen = m_strlen(boundary); while (ftello (fp) < end_off && fgets (buffer, LONG_STRING, fp) != NULL) { - len = str_len (buffer); + len = m_strlen(buffer); crlf = (len > 1 && buffer[len - 2] == '\r') ? 1 : 0; @@ -1035,7 +1035,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, * bothered me for _years_ */ if (!e->from) { e->from = rfc822_new_address (); - e->from->personal = str_dup (p); + e->from->personal = m_strdup(p); } matched = 1; } @@ -1043,7 +1043,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, else if (!str_casecmp (line + 1, "ollowup-to")) { if (!e->followup_to) { str_skip_trailws (p); - e->followup_to = str_dup (str_skip_initws (p)); + e->followup_to = m_strdup(str_skip_initws (p)); } matched = 1; } @@ -1126,7 +1126,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, if (!str_casecmp (line + 1, "ewsgroups")) { p_delete(&e->newsgroups); str_skip_trailws (p); - e->newsgroups = str_dup (str_skip_initws (p)); + e->newsgroups = m_strdup(str_skip_initws (p)); matched = 1; } break; @@ -1136,7 +1136,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, /* field `Organization:' saves only for pager! */ if (!str_casecmp (line + 1, "rganization")) { if (!e->organization && str_casecmp (p, "unknown")) - e->organization = str_dup (p); + e->organization = m_strdup(p); } break; @@ -1167,7 +1167,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, case 's': if (!ascii_strcasecmp (line + 1, "ubject")) { if (!e->subject) - e->subject = str_dup (p); + e->subject = m_strdup(p); matched = 1; } else if (!ascii_strcasecmp (line + 1, "ender")) { @@ -1195,7 +1195,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, } else if ((!ascii_strcasecmp ("upersedes", line + 1) || !ascii_strcasecmp ("upercedes", line + 1)) && hdr) - e->supersedes = str_dup (p); + e->supersedes = m_strdup(p); break; case 't': @@ -1228,18 +1228,18 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, matched = 1; } else if (ascii_strcasecmp (line + 1, "-label") == 0) { - e->x_label = str_dup (p); + e->x_label = m_strdup(p); matched = 1; } #ifdef USE_NNTP else if (!str_casecmp (line + 1, "-comment-to")) { if (!e->x_comment_to) - e->x_comment_to = str_dup (p); + e->x_comment_to = m_strdup(p); matched = 1; } else if (!str_casecmp (line + 1, "ref")) { if (!e->xref) - e->xref = str_dup (p); + e->xref = m_strdup(p); matched = 1; } #endif @@ -1251,7 +1251,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, /* Keep track of the user-defined headers */ if (!matched && user_hdrs) { /* restore the original line */ - line[str_len (line)] = ':'; + line[m_strlen(line)] = ':'; if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore) && !mutt_matches_ignore (line, UnIgnore)) @@ -1263,7 +1263,7 @@ int mutt_parse_rfc822_line (ENVELOPE * e, HEADER * hdr, char *line, char *p, } else last = e->userhdrs = mutt_new_list (); - last->data = str_dup (line); + last->data = m_strdup(line); if (do_2047) rfc2047_decode (&last->data); } @@ -1311,7 +1311,7 @@ ENVELOPE *mutt_read_rfc822_header (FILE * f, HEADER * hdr, short user_hdrs, /* set the defaults from RFC1521 */ hdr->content->type = TYPETEXT; - hdr->content->subtype = str_dup ("plain"); + hdr->content->subtype = m_strdup("plain"); hdr->content->encoding = ENC7BIT; hdr->content->length = -1; diff --git a/pattern.c b/pattern.c index 585e130..f4c05481 100644 --- a/pattern.c +++ b/pattern.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -25,7 +26,6 @@ #include "copy.h" #include "mime.h" -#include "lib/str.h" #ifdef USE_IMAP #include "mx.h" @@ -225,7 +225,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) match = 1; break; } - lng -= str_len (buf); + lng -= m_strlen(buf); } p_delete(&buf); @@ -266,7 +266,7 @@ int eat_regexp (pattern_t * pat, BUFFER * s, BUFFER * err) #endif if (pat->stringmatch) { - pat->str = str_dup (buf.data); + pat->str = m_strdup(buf.data); p_delete(&buf.data); } else { pat->rx = p_new(regex_t, 1); @@ -714,7 +714,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err) memset (&ps, 0, sizeof (ps)); ps.dptr = s; - ps.dsize = str_len (s); + ps.dsize = m_strlen(s); while (*ps.dptr) { SKIPWS (ps.dptr); @@ -1209,7 +1209,7 @@ int mutt_pattern_func (int op, char *prompt) mutt_message _("Compiling search pattern..."); - simple = str_dup (buf); + simple = m_strdup(buf); mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch)); err.data = error; diff --git a/pgp.c b/pgp.c index 0a2ed87..a649499 100644 --- a/pgp.c +++ b/pgp.c @@ -22,6 +22,7 @@ #endif #include +#include #include #include "mutt.h" @@ -34,7 +35,6 @@ #include "copy.h" #include "attach.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -265,7 +265,7 @@ int pgp_application_pgp_handler (BODY * m, STATE * s) break; offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */ last_pos = offset; if (str_ncmp ("-----BEGIN PGP ", buf, 15) == 0) { @@ -303,7 +303,7 @@ int pgp_application_pgp_handler (BODY * m, STATE * s) fputs (buf, tmpfp); while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) { offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on str_len(buf) */ + bytes -= (offset - last_pos); /* don't rely on m_strlen(buf) */ last_pos = offset; fputs (buf, tmpfp); @@ -781,7 +781,7 @@ BODY *pgp_decrypt_part (BODY * a, STATE * s, FILE * fpout, BODY * p) * read_mime_header has a hard time parsing the message. */ while (fgets (buf, sizeof (buf) - 1, pgpout) != NULL) { - len = str_len (buf); + len = m_strlen(buf); if (len > 1 && buf[len - 2] == '\r') strcpy (buf + len - 2, "\n"); /* __STRCPY_CHECKED__ */ fputs (buf, fpout); @@ -1034,7 +1034,7 @@ BODY *pgp_sign_message (BODY * a) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("signed"); + t->subtype = m_strdup("signed"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -1049,8 +1049,8 @@ BODY *pgp_sign_message (BODY * a) t->parts->next = mutt_new_body (); t = t->parts->next; t->type = TYPEAPPLICATION; - t->subtype = str_dup ("pgp-signature"); - t->filename = str_dup (sigfile); + t->subtype = m_strdup("pgp-signature"); + t->filename = m_strdup(sigfile); t->use_disp = 0; t->disposition = DISPINLINE; t->encoding = ENC7BIT; @@ -1064,7 +1064,7 @@ static short is_numerical_keyid (const char *s) /* or should we require the "0x"? */ if (strncmp (s, "0x", 2) == 0) s += 2; - if (str_len (s) % 8) + if (m_strlen(s) % 8) return 0; while (*s) if (strchr ("0123456789ABCDEFabcdef", *s++) == NULL) @@ -1172,11 +1172,11 @@ char *pgp_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) keyID = pgp_keyid (key); bypass_selection: - keylist_size += str_len (keyID) + 4; + keylist_size += m_strlen(keyID) + 4; p_realloc(&keylist, keylist_size); sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "", /* __SPRINTF_CHECKED__ */ keyID); - keylist_used = str_len (keylist); + keylist_used = m_strlen(keylist); pgp_free_key (&key); rfc822_free_address (&addr); @@ -1280,7 +1280,7 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("encrypted"); + t->subtype = m_strdup("encrypted"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -1290,18 +1290,18 @@ BODY *pgp_encrypt_message (BODY * a, char *keylist, int sign) t->parts = mutt_new_body (); t->parts->type = TYPEAPPLICATION; - t->parts->subtype = str_dup ("pgp-encrypted"); + t->parts->subtype = m_strdup("pgp-encrypted"); t->parts->encoding = ENC7BIT; t->parts->next = mutt_new_body (); t->parts->next->type = TYPEAPPLICATION; - t->parts->next->subtype = str_dup ("octet-stream"); + t->parts->next->subtype = m_strdup("octet-stream"); t->parts->next->encoding = ENC7BIT; - t->parts->next->filename = str_dup (tempfile); + t->parts->next->filename = m_strdup(tempfile); t->parts->next->use_disp = 1; t->parts->next->disposition = DISPINLINE; t->parts->next->unlink = 1; /* delete after sending the message */ - t->parts->next->d_filename = str_dup ("msg.asc"); /* non pgp/mime can save */ + t->parts->next->d_filename = m_strdup("msg.asc"); /* non pgp/mime can save */ return (t); } @@ -1451,21 +1451,21 @@ BODY *pgp_traditional_encryptsign (BODY * a, int flags, char *keylist) b->encoding = ENC7BIT; b->type = TYPETEXT; - b->subtype = str_dup ("plain"); + b->subtype = m_strdup("plain"); mutt_set_parameter ("x-action", flags & ENCRYPT ? "pgp-encrypted" : "pgp-signed", &b->parameter); mutt_set_parameter ("charset", send_charset, &b->parameter); - b->filename = str_dup (pgpoutfile); + b->filename = m_strdup(pgpoutfile); #if 0 /* The following is intended to give a clue to some completely brain-dead * "mail environments" which are typically used by large corporations. */ - b->d_filename = str_dup ("msg.pgp"); + b->d_filename = m_strdup("msg.pgp"); b->use_disp = 1; #endif diff --git a/pgpinvoke.c b/pgpinvoke.c index 04096fd..9953406 100644 --- a/pgpinvoke.c +++ b/pgpinvoke.c @@ -26,6 +26,7 @@ #include #include +#include #include #include "mutt.h" @@ -34,7 +35,6 @@ #include "pgp.h" #include "rfc822.h" -#include "lib/str.h" #include "lib/debug.h" /* diff --git a/pgpkey.c b/pgpkey.c index 009955d..eeb0048 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -26,7 +27,6 @@ #include "pager.h" #include "sort.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -665,8 +665,8 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor, l = p_new(struct pgp_cache, 1); l->next = id_defaults; id_defaults = l; - l->what = str_dup (whatfor); - l->dflt = str_dup (resp); + l->what = m_strdup(whatfor); + l->dflt = m_strdup(resp); } } @@ -742,13 +742,13 @@ BODY *pgp_make_key_attachment (char *tempf) fclose (devnull); att = mutt_new_body (); - att->filename = str_dup (tempf); + att->filename = m_strdup(tempf); att->unlink = 1; att->use_disp = 0; att->type = TYPEAPPLICATION; - att->subtype = str_dup ("pgp-keys"); + att->subtype = m_strdup("pgp-keys"); snprintf (buff, sizeof (buff), _("PGP Key %s."), tmp); - att->description = str_dup (buff); + att->description = m_strdup(buff); mutt_update_encoding (att); stat (tempf, &sb); @@ -762,12 +762,12 @@ static LIST *pgp_add_string_to_hints (LIST * hints, const char *str) char *scratch; char *t; - if ((scratch = str_dup (str)) == NULL) + if ((scratch = m_strdup(str)) == NULL) return hints; for (t = strtok (scratch, " ,.:\"()<>\n"); t; t = strtok (NULL, " ,.:\"()<>\n")) { - if (str_len (t) > 3) + if (m_strlen(t) > 3) hints = mutt_add_list (hints, t); } diff --git a/pgplib.c b/pgplib.c index 36f24a4..d9e5ff9 100644 --- a/pgplib.c +++ b/pgplib.c @@ -147,7 +147,7 @@ pgp_uid_t *pgp_copy_uids (pgp_uid_t * up, pgp_key_t parent) *lp = p_new(pgp_uid_t, 1); (*lp)->trust = up->trust; (*lp)->flags = up->flags; - (*lp)->addr = str_dup (up->addr); + (*lp)->addr = m_strdup(up->addr); (*lp)->parent = parent; lp = &(*lp)->next; } diff --git a/pgpmicalg.c b/pgpmicalg.c index 0a45cc6..b5985b3 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -106,7 +106,7 @@ static void pgp_dearmor (FILE * in, FILE * out) return; } - if ((end = ftello (in) - str_len (line)) < start) { + if ((end = ftello (in) - m_strlen(line)) < start) { debug_print (1, ("end < start???\n")); return; } diff --git a/pgppubring.c b/pgppubring.c index 0ab6a53..e797e9a 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -27,8 +27,7 @@ #endif #include - -#include "lib/str.h" +#include #include #include @@ -247,7 +246,7 @@ static pgp_key_t pgp_parse_pgp2_key (unsigned char *buff, size_t l) "%08lX", id); } - p->keyid = str_dup ((char *) scratch); + p->keyid = m_strdup((char *) scratch); return p; @@ -349,7 +348,7 @@ static pgp_key_t pgp_parse_pgp3_key (unsigned char *buff, size_t l) id); } - p->keyid = str_dup ((char *) scratch); + p->keyid = m_strdup((char *) scratch); return p; } @@ -741,7 +740,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], char *error_buf; size_t error_buf_len; - error_buf_len = sizeof ("fopen: ") - 1 + str_len (ringfile) + 1; + error_buf_len = sizeof ("fopen: ") - 1 + m_strlen(ringfile) + 1; error_buf = p_new(char, error_buf_len); snprintf (error_buf, error_buf_len, "fopen: %s", ringfile); perror (error_buf); diff --git a/pop/mx_pop.c b/pop/mx_pop.c index 0b6d9e5..95f2fb6 100644 --- a/pop/mx_pop.c +++ b/pop/mx_pop.c @@ -10,6 +10,7 @@ #include #include +#include #include "mutt.h" #include "pop.h" @@ -17,7 +18,6 @@ #include "mx.h" #include "mx_pop.h" -#include "lib/str.h" #include "url.h" diff --git a/pop/pop.c b/pop/pop.c index c24ac1c..058fe1d 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -20,7 +21,6 @@ #include "mutt_crypt.h" #include "mutt_curses.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -142,7 +142,7 @@ static int fetch_uidl (char *line, void *data) ctx->msgcount++; ctx->hdrs[i] = mutt_new_header (); - ctx->hdrs[i]->data = str_dup (line); + ctx->hdrs[i]->data = m_strdup(line); } else if (ctx->hdrs[i]->index != index - 1) pop_data->clear_cache = 1; @@ -248,7 +248,7 @@ int pop_open_mailbox (CONTEXT * ctx) return -1; p_delete(&ctx->path); - ctx->path = str_dup (buf); + ctx->path = m_strdup(buf); pop_data = p_new(POP_DATA, 1); pop_data->conn = conn; @@ -405,7 +405,7 @@ int pop_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) * portion of the headers, those required for the main display. */ cache->index = h->index; - cache->path = str_dup (path); + cache->path = m_strdup(path); rewind (msg->fp); uidl = h->data; mutt_free_envelope (&h->env); diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 2c2cec0..09f0761 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -166,7 +166,7 @@ void pop_apop_timestamp (POP_DATA * pop_data, char *buf) if ((p1 = strchr (buf, '<')) && (p2 = strchr (p1, '>'))) { p2[1] = '\0'; - pop_data->timestamp = str_dup (p1); + pop_data->timestamp = m_strdup(p1); } } @@ -305,7 +305,7 @@ pop_query_status pop_authenticate (POP_DATA * pop_data) if (PopAuthenticators && *PopAuthenticators) { /* Try user-specified list of authentication methods */ - methods = str_dup (PopAuthenticators); + methods = m_strdup(PopAuthenticators); method = methods; while (method) { diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 565ae58..805ee1e 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -24,7 +25,6 @@ #endif #include "lib/debug.h" -#include "lib/str.h" #include #include @@ -42,7 +42,7 @@ int pop_parse_path (const char *path, ACCOUNT * acct) acct->port = POP_PORT; acct->type = M_ACCT_TYPE_POP; - c = str_dup (path); + c = m_strdup(path); url_parse_ciss (&url, c); if (url.scheme == U_POP || url.scheme == U_POPS) { @@ -89,7 +89,7 @@ static int fetch_capa (char *line, void *data) p_delete(&pop_data->auth_list); c = line + 4; SKIPWS (c); - pop_data->auth_list = str_dup (c); + pop_data->auth_list = m_strdup(c); } else if (!ascii_strncasecmp (line, "STLS", 4)) diff --git a/postpone.c b/postpone.c index d19bacc..eb62d22 100644 --- a/postpone.c +++ b/postpone.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -32,7 +33,6 @@ #endif #include "mutt_crypt.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -611,7 +611,7 @@ int mutt_prepare_template (FILE * fp, CONTEXT * ctx, HEADER * newhdr, file[0] = '\0'; if (b->filename) { strfcpy (file, b->filename, sizeof (file)); - b->d_filename = str_dup (b->filename); + b->d_filename = m_strdup(b->filename); } else { /* avoid Content-Disposition: header with temporary filename */ diff --git a/query.c b/query.c index f7a7894..1f164da 100644 --- a/query.c +++ b/query.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -20,7 +21,6 @@ #include "mapping.h" #include "sort.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -63,7 +63,7 @@ static ADDRESS *result_to_addr (QUERY * r) tmp = rfc822_cpy_adr (r->addr); if (!tmp->next && !tmp->personal) - tmp->personal = str_dup (r->name); + tmp->personal = m_strdup(r->name); mutt_addrlist_to_idna (tmp, NULL); return tmp; @@ -119,10 +119,10 @@ static QUERY *run_query (char *s, int quiet) l = mutt_strwidth (p); if (l > FirstColumn) FirstColumn = l; - cur->name = str_dup (p); + cur->name = m_strdup(p); p = strtok (NULL, "\t\n"); if (p) { - cur->other = str_dup (p); + cur->other = m_strdup(p); } } } @@ -186,7 +186,7 @@ static void query_entry (char *s, size_t slen, MUTTMENU * m, int num) mutt_format_string (buf2, sizeof (buf2), FirstColumn + 2, FirstColumn + 2, 0, ' ', table[num].data->name, - str_len (table[num].data->name), 0); + m_strlen(table[num].data->name), 0); snprintf (s, slen, " %c %3d %s %-*.*s %s", table[num].tagged ? '*' : ' ', @@ -443,7 +443,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf) mutt_addrlist_to_local (tmpa); tagged = 1; rfc822_write_address (buf, buflen, tmpa, 0); - curpos = str_len (buf); + curpos = m_strlen(buf); rfc822_free_address (&tmpa); } else if (curpos + 2 < buflen) { @@ -453,7 +453,7 @@ static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf) strcat (buf, ", "); /* __STRCAT_CHECKED__ */ rfc822_write_address ((char *) buf + curpos + 1, buflen - curpos - 1, tmpa, 0); - curpos = str_len (buf); + curpos = m_strlen(buf); rfc822_free_address (&tmpa); } } diff --git a/recvattach.c b/recvattach.c index a0afdea..dd7ef8e 100644 --- a/recvattach.c +++ b/recvattach.c @@ -13,6 +13,7 @@ #endif #include +#include #include #include "mutt.h" @@ -30,7 +31,6 @@ #include "copy.h" #include "mutt_crypt.h" -#include "lib/str.h" #include #include @@ -106,7 +106,7 @@ void mutt_update_tree (ATTACHPTR ** idx, short idxlen) str_replace (&idx[x]->tree, buf); } else - idx[x]->tree = str_dup (buf); + idx[x]->tree = m_strdup(buf); if (2 * (idx[x]->level + 2) < sizeof (buf) && idx[x]->level) { s = buf + 2 * (idx[x]->level - 1); diff --git a/recvcmd.c b/recvcmd.c index 5a5e1c4..5cfdf9f 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "copy.h" #include "mutt_idna.h" -#include "lib/str.h" /* some helper functions to verify that we are exclusively operating * on message/rfc822 attachments @@ -689,7 +689,7 @@ attach_reply_envelope_defaults (ENVELOPE * env, ATTACHPTR ** idx, /* in case followup set Newsgroups: with Followup-To: if it present */ if (!env->newsgroups && curenv && str_casecmp (curenv->followup_to, "poster")) - env->newsgroups = str_dup (curenv->followup_to); + env->newsgroups = m_strdup(curenv->followup_to); } else #endif diff --git a/regex.c b/regex.c index c3da5ce..0e11f18 100644 --- a/regex.c +++ b/regex.c @@ -98,7 +98,7 @@ #include "lisp.h" #include "buffer.h" #include "syntax.h" -#include "lib/str.h" +#include #else /* not emacs */ diff --git a/remailer.c b/remailer.c index 8b1a302..cbefd24 100644 --- a/remailer.c +++ b/remailer.c @@ -16,6 +16,7 @@ #endif #include +#include #include #include "mutt.h" @@ -26,7 +27,6 @@ #include "remailer.h" -#include "lib/str.h" #include "lib/rx.h" #include @@ -159,7 +159,7 @@ static REMAILER **mix_type2_list (size_t * l) /* first, generate the "random" remailer */ p = mix_new_remailer (); - p->shortname = str_dup (""); + p->shortname = m_strdup(""); mix_add_entry (&type2_list, p, &slots, &used); while (fgets (line, sizeof (line), fp)) { @@ -168,12 +168,12 @@ static REMAILER **mix_type2_list (size_t * l) if (!(t = strtok (line, " \t\n"))) goto problem; - p->shortname = str_dup (t); + p->shortname = m_strdup(t); if (!(t = strtok (NULL, " \t\n"))) goto problem; - p->addr = str_dup (t); + p->addr = m_strdup(t); if (!(t = strtok (NULL, " \t\n"))) goto problem; @@ -181,7 +181,7 @@ static REMAILER **mix_type2_list (size_t * l) if (!(t = strtok (NULL, " \t\n"))) goto problem; - p->ver = str_dup (t); + p->ver = m_strdup(t); if (!(t = strtok (NULL, " \t\n"))) goto problem; @@ -238,7 +238,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, if (i) { c = - coords[i - 1].c + str_len (type2_list[chain->ch[i - 1]]->shortname) + 2; + coords[i - 1].c + m_strlen(type2_list[chain->ch[i - 1]]->shortname) + 2; r = coords[i - 1].r; } else { @@ -249,7 +249,7 @@ static void mix_screen_coordinates (REMAILER ** type2_list, for (; i < chain->cl; i++) { oc = c; - c += str_len (type2_list[chain->ch[i]]->shortname) + 2; + c += m_strlen(type2_list[chain->ch[i]]->shortname) + 2; if (c >= COLS) { oc = c = MIX_HOFFSET; diff --git a/rfc1524.c b/rfc1524.c index d4f5ec5..5764beb 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -22,6 +22,7 @@ #endif #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "rfc1524.h" #include "attach.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -204,7 +204,7 @@ static int rfc1524_mailcap_parse (BODY * a, field = ch; ch = get_field (ch); if (entry) - entry->command = str_dup (field); + entry->command = m_strdup(field); /* parse the optional fields */ found = TRUE; @@ -268,7 +268,7 @@ static int rfc1524_mailcap_parse (BODY * a, if (get_field_text (field + 4, &test_command, type, filename, line) && test_command) { - len = str_len (test_command) + STRING; + len = m_strlen(test_command) + STRING; p_realloc(&test_command, len); rfc1524_expand_command (a, a->filename, type, test_command, len); if (mutt_system (test_command)) { @@ -476,8 +476,8 @@ int rfc1524_expand_filename (char *nametemplate, rmatch = 1; - for (r = 0, j = str_len (oldfile) - 1, k = - str_len (nametemplate) - 1; + for (r = 0, j = m_strlen(oldfile) - 1, k = + m_strlen(nametemplate) - 1; j >= (lmatch ? i : 0) && k >= i + 2; j--, k--) { if (nametemplate[k] != oldfile[j]) { rmatch = 0; diff --git a/rfc2047.c b/rfc2047.c index 9452b3b..84028ab 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -13,6 +13,7 @@ #endif #include +#include #include "mutt.h" #include "ascii.h" @@ -21,7 +22,6 @@ #include "rfc2047.h" #include "thread.h" -#include "lib/str.h" #include #include @@ -39,7 +39,7 @@ #endif #define ENCWORD_LEN_MAX 75 -#define ENCWORD_LEN_MIN 9 /* str_len ("=?.?.?.?=") */ +#define ENCWORD_LEN_MIN 9 /* m_strlen("=?.?.?.?=") */ #define HSPACE(x) ((x) == '\0' || (x) == ' ' || (x) == '\t') @@ -97,7 +97,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, q = strchr (p, ':'); - n = q ? q - p : str_len (p); + n = q ? q - p : m_strlen(p); if (!n || /* Assume that we never need more than 12 characters of @@ -148,7 +148,7 @@ static size_t b_encoder (char *s, const char *d, size_t dlen, char *s0 = s; memcpy (s, "=?", 2), s += 2; - memcpy (s, tocode, str_len (tocode)), s += str_len (tocode); + memcpy (s, tocode, m_strlen(tocode)), s += m_strlen(tocode); memcpy (s, "?B?", 3), s += 3; for (;;) { if (!dlen) @@ -186,7 +186,7 @@ static size_t q_encoder (char *s, const char *d, size_t dlen, char *s0 = s; memcpy (s, "=?", 2), s += 2; - memcpy (s, tocode, str_len (tocode)), s += str_len (tocode); + memcpy (s, tocode, m_strlen(tocode)), s += m_strlen(tocode); memcpy (s, "?Q?", 3), s += 3; while (dlen--) { unsigned char c = *d++; @@ -228,7 +228,7 @@ static size_t try_block (const char *d, size_t dlen, if (fromcode) { cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); - ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); + ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - m_strlen(tocode); if (my_iconv(cd, &ib, &ibl, &ob, &obl) == (size_t) (-1) || my_iconv(cd, 0, 0, &ob, &obl) == (size_t) (-1)) { assert (errno == E2BIG); @@ -239,8 +239,8 @@ static size_t try_block (const char *d, size_t dlen, iconv_close (cd); } else { - if (dlen > sizeof (buf1) - str_len (tocode)) - return sizeof (buf1) - str_len (tocode) + 1; + if (dlen > sizeof (buf1) - m_strlen(tocode)) + return sizeof (buf1) - m_strlen(tocode) + 1; memcpy (buf1, d, dlen); ob = buf1 + dlen; } @@ -255,7 +255,7 @@ static size_t try_block (const char *d, size_t dlen, ++count; } - len = ENCWORD_LEN_MIN - 2 + str_len (tocode); + len = ENCWORD_LEN_MIN - 2 + m_strlen(tocode); len_b = len + (((ob - buf1) + 2) / 3) * 4; len_q = len + (ob - buf1) + 2 * count; @@ -294,7 +294,7 @@ static size_t encode_block (char *s, char *d, size_t dlen, if (fromcode) { cd = mutt_iconv_open (tocode, fromcode, 0); assert (cd != (iconv_t) (-1)); - ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - str_len (tocode); + ib = d, ibl = dlen, ob = buf1, obl = sizeof (buf1) - m_strlen(tocode); n1 = my_iconv(cd, &ib, &ibl, &ob, &obl); n2 = my_iconv(cd, 0, 0, &ob, &obl); assert (n1 != (size_t) (-1) && n2 != (size_t) (-1)); @@ -479,15 +479,15 @@ static int rfc2047_encode (const char *d, size_t dlen, int col, /* Add to output buffer. */ #define LINEBREAK "\n\t" - if (bufpos + wlen + str_len (LINEBREAK) > buflen) { - buflen = bufpos + wlen + str_len (LINEBREAK); + if (bufpos + wlen + m_strlen(LINEBREAK) > buflen) { + buflen = bufpos + wlen + m_strlen(LINEBREAK); p_realloc(&buf, buflen); } r = encode_block (buf + bufpos, t, n, icode, tocode, encoder); assert (r == wlen); bufpos += wlen; - memcpy (buf + bufpos, LINEBREAK, str_len (LINEBREAK)); - bufpos += str_len (LINEBREAK); + memcpy (buf + bufpos, LINEBREAK, m_strlen(LINEBREAK)); + bufpos += m_strlen(LINEBREAK); #undef LINEBREAK col = 1; @@ -526,7 +526,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) if (!charsets || !*charsets) charsets = "UTF-8"; - rfc2047_encode (*pd, str_len (*pd), col, + rfc2047_encode (*pd, m_strlen(*pd), col, Charset, charsets, &e, &elen, encode_specials ? RFC822Specials : NULL); @@ -537,7 +537,7 @@ void _rfc2047_encode_string (char **pd, int encode_specials, int col) void rfc2047_encode_adrlist (ADDRESS * addr, const char *tag) { ADDRESS *ptr = addr; - int col = tag ? str_len (tag) + 2 : 32; + int col = tag ? m_strlen(tag) + 2 : 32; while (ptr) { if (ptr->personal) @@ -554,7 +554,7 @@ static int rfc2047_decode_word (char *d, const char *s, size_t len) int enc = 0, count = 0; char *charset = NULL; - pd = d0 = p_new(char, str_len(s)); + pd = d0 = p_new(char, m_strlen(s)); for (pp = s; (pp1 = strchr (pp, '?')); pp = pp1 + 1) { count++; @@ -708,14 +708,14 @@ void rfc2047_decode (char **pd) if (!s || !*s) return; - dlen = 4 * str_len (s); /* should be enough */ + dlen = 4 * m_strlen(s); /* should be enough */ d = d0 = p_new(char, dlen + 1); while (*s && dlen > 0) { if (!(p = find_encoded_word (s, &q))) { /* no encoded words */ if (!option (OPTSTRICTMIME)) { - n = str_len (s); + n = m_strlen(s); if (found_encoded && (m = lwslen (s, n)) != 0) { if (m != n) *d = ' ', d++, dlen--; @@ -727,7 +727,7 @@ void rfc2047_decode (char **pd) t = p_dupstr(s, n); if (mutt_convert_nonmime_string (&t) == 0) { - tlen = str_len (t); + tlen = m_strlen(t); strncpy (d, t, tlen); d += tlen; } @@ -777,7 +777,7 @@ void rfc2047_decode (char **pd) rfc2047_decode_word (d, p, dlen); found_encoded = 1; s = q; - n = str_len (d); + n = m_strlen(d); dlen -= n; d += n; } diff --git a/rfc2231.c b/rfc2231.c index 778995b..87856ac 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -22,12 +22,12 @@ #endif #include +#include #include "mutt.h" #include "ascii.h" #include "mime.h" #include "charset.h" -#include "lib/str.h" #include "rfc2047.h" #include "rfc2231.h" @@ -270,7 +270,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, if (encoded && par->encoded) rfc2231_decode_one (par->value, valp); - vl = str_len (par->value); + vl = m_strlen(par->value); p_realloc(&value, l + vl + 1); strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */ @@ -286,7 +286,7 @@ static void rfc2231_join_continuations (PARAMETER ** head, if (encoded) mutt_convert_string (&value, charset, Charset, M_ICONV_HOOK_FROM); *head = mutt_new_parameter (); - (*head)->attribute = str_dup (attribute); + (*head)->attribute = m_strdup(attribute); (*head)->value = value; head = &(*head)->next; } @@ -315,10 +315,10 @@ int rfc2231_encode_string (char **pd) if (!Charset || !SendCharset || !(charset = mutt_choose_charset (Charset, SendCharset, - *pd, str_len (*pd), &d, &dlen))) { - charset = str_dup (Charset ? Charset : "unknown-8bit"); + *pd, m_strlen(*pd), &d, &dlen))) { + charset = m_strdup(Charset ? Charset : "unknown-8bit"); d = *pd; - dlen = str_len (d); + dlen = m_strlen(d); } if (!mutt_is_us_ascii (charset)) @@ -331,9 +331,9 @@ int rfc2231_encode_string (char **pd) ++ext; if (encode) { - e = p_new(char, dlen + 2 * ext + str_len(charset) + 3); + e = p_new(char, dlen + 2 * ext + m_strlen(charset) + 3); sprintf (e, "%s''", charset); /* __SPRINTF_CHECKED__ */ - t = e + str_len (e); + t = e + m_strlen(e); for (s = d, slen = dlen; slen; s++, slen--) if (*s < 0x20 || *s >= 0x7f || strchr (MimeSpecials, *s) || strchr ("*'%", *s)) { diff --git a/rfc3676.c b/rfc3676.c index bd4bd03..5304d59 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -21,6 +21,7 @@ #include #include +#include #include #include "mutt.h" @@ -30,7 +31,6 @@ #include "state.h" #include "lib.h" -#include "lib/str.h" #include "lib/debug.h" #define FLOWED_MAX 77 @@ -46,7 +46,7 @@ static int get_quote_level (char *line) static void print_flowed_line (char *line, STATE * s, int ql) { int width; char *pos, *oldpos; - int len = str_len (line); + int len = m_strlen(line); int i; if (MaxLineLength > 0) { @@ -68,7 +68,7 @@ static void print_flowed_line (char *line, STATE * s, int ql) { width = COLS; } - if (str_len (line) == 0) { + if (m_strlen(line) == 0) { if (!(s->flags & M_REPLYING) || option (OPTQUOTEEMPTY)) { if (s->prefix) state_puts(s->prefix,s); @@ -148,7 +148,7 @@ int rfc3676_handler (BODY * a, STATE * s) { /* respect DelSP of RfC3676 only with f=f parts */ if ((t = (char*) mutt_get_parameter ("delsp", a->parameter))) { - delsp = str_len (t) == 3 && ascii_strncasecmp (t, "yes", 3) == 0; + delsp = m_strlen(t) == 3 && ascii_strncasecmp (t, "yes", 3) == 0; t = NULL; } @@ -156,7 +156,7 @@ int rfc3676_handler (BODY * a, STATE * s) { while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) { - buf_len = str_len (buf); + buf_len = m_strlen(buf); bytes -= buf_len; newql = get_quote_level (buf); @@ -254,7 +254,7 @@ void rfc3676_space_stuff (HEADER* hdr) { fputc (' ', out); #if DEBUG lc++; - len = str_len (buf); + len = m_strlen(buf); if (len > 0) { c = buf[len-1]; buf[len-1] = '\0'; diff --git a/rfc822.c b/rfc822.c index d7946cd..25aa1c4 100644 --- a/rfc822.c +++ b/rfc822.c @@ -16,13 +16,13 @@ #include #include +#include #include #include "mutt.h" #include "ascii.h" #include "mutt_idna.h" -#include "lib/str.h" #define terminate_string(a, b, c) do { if ((b) < (c)) a[(b)] = 0; else \ a[(c)] = 0; } while (0) @@ -207,11 +207,11 @@ static const char *parse_address (const char *s, } terminate_string (token, *tokenlen, tokenmax); - addr->mailbox = str_dup (token); + addr->mailbox = m_strdup(token); if (*commentlen && !addr->personal) { terminate_string (comment, *commentlen, commentmax); - addr->personal = str_dup (comment); + addr->personal = m_strdup(comment); } return s; @@ -256,7 +256,7 @@ static const char *parse_route_addr (const char *s, } if (!addr->mailbox) - addr->mailbox = str_dup ("@"); + addr->mailbox = m_strdup("@"); s++; return s; @@ -324,7 +324,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } commentlen = 0; @@ -347,7 +347,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) else if (*s == ':') { cur = rfc822_new_address (); terminate_buffer (phrase, phraselen); - cur->mailbox = str_dup (phrase); + cur->mailbox = m_strdup(phrase); cur->group = 1; if (last) @@ -370,7 +370,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } /* add group terminator */ @@ -394,7 +394,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) p_delete(&cur->personal); /* if we get something like "Michael R. Elkins" remove the quotes */ rfc822_dequote_comment (phrase); - cur->personal = str_dup (phrase); + cur->personal = m_strdup(phrase); } if ((ps = parse_route_addr (s + 1, comment, &commentlen, @@ -436,7 +436,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS * top, const char *s) } else if (commentlen && last && !last->personal) { terminate_buffer (comment, commentlen); - last->personal = str_dup (comment); + last->personal = m_strdup(comment); } return top; @@ -448,7 +448,7 @@ void rfc822_qualify (ADDRESS * addr, const char *host) for (; addr; addr = addr->next) if (!addr->group && addr->mailbox && strchr (addr->mailbox, '@') == NULL) { - p = p_new(char, str_len(addr->mailbox) + str_len(host) + 2); + p = p_new(char, m_strlen(addr->mailbox) + m_strlen(host) + 2); sprintf (p, "%s@%s", addr->mailbox, host); /* __SPRINTF_CHECKED__ */ p_delete(&addr->mailbox); addr->mailbox = p; @@ -518,7 +518,7 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, if (!buflen) goto done; strfcpy (pbuf, addr->personal, buflen); - len = str_len (pbuf); + len = m_strlen(pbuf); pbuf += len; buflen -= len; } @@ -541,11 +541,11 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS * addr, goto done; if (ascii_strcmp (addr->mailbox, "@") && !display) { strfcpy (pbuf, addr->mailbox, buflen); - len = str_len (pbuf); + len = m_strlen(pbuf); } else if (ascii_strcmp (addr->mailbox, "@") && display) { strfcpy (pbuf, mutt_addr_for_display (addr), buflen); - len = str_len (pbuf); + len = m_strlen(pbuf); } else { *pbuf = '\0'; @@ -589,7 +589,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, int display) { char *pbuf = buf; - size_t len = str_len (buf); + size_t len = m_strlen(buf); buflen--; /* save room for the terminal nul */ @@ -616,7 +616,7 @@ void rfc822_write_address (char *buf, size_t buflen, ADDRESS * addr, /* this should be safe since we always have at least 1 char passed into the above call, which means `pbuf' should always be nul terminated */ - len = str_len (pbuf); + len = m_strlen(pbuf); pbuf += len; buflen -= len; @@ -642,8 +642,8 @@ ADDRESS *rfc822_cpy_adr_real (ADDRESS * addr) { ADDRESS *p = rfc822_new_address (); - p->personal = str_dup (addr->personal); - p->mailbox = str_dup (addr->mailbox); + p->personal = m_strdup(addr->personal); + p->mailbox = m_strdup(addr->mailbox); p->group = addr->group; return p; } diff --git a/send.c b/send.c index ea02d98..d39deae 100644 --- a/send.c +++ b/send.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -29,7 +30,6 @@ #include "url.h" #include "attach.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -219,7 +219,7 @@ static int edit_envelope (ENVELOPE * en, int flags) if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0) return (-1); p_delete(&en->newsgroups); - en->newsgroups = str_dup (buf); + en->newsgroups = m_strdup(buf); if (en->followup_to) strfcpy (buf, en->followup_to, sizeof (buf)); @@ -229,7 +229,7 @@ static int edit_envelope (ENVELOPE * en, int flags) && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0) return (-1); p_delete(&en->followup_to); - en->followup_to = str_dup (buf); + en->followup_to = m_strdup(buf); if (en->x_comment_to) strfcpy (buf, en->x_comment_to, sizeof (buf)); @@ -239,7 +239,7 @@ static int edit_envelope (ENVELOPE * en, int flags) && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0) return (-1); p_delete(&en->x_comment_to); - en->x_comment_to = str_dup (buf); + en->x_comment_to = m_strdup(buf); } else #endif @@ -305,7 +305,7 @@ static int edit_envelope (ENVELOPE * en, int flags) char *nntp_get_header (const char *s) { SKIPWS (s); - return str_dup (s); + return m_strdup(s); } #endif @@ -368,7 +368,7 @@ static void process_user_header (ENVELOPE * env) } else last = env->userhdrs = mutt_new_list (); - last->data = str_dup (uh->data); + last->data = m_strdup(uh->data); } } } @@ -603,7 +603,7 @@ LIST *mutt_make_references (ENVELOPE * e) if (e->message_id) { t = mutt_new_list (); - t->data = str_dup (e->message_id); + t->data = m_strdup(e->message_id); t->next = l; l = t; } @@ -651,15 +651,15 @@ void mutt_make_misc_reply_headers (ENVELOPE * env, CONTEXT * ctx, */ if (curenv->real_subj) { p_delete(&env->subject); - env->subject = p_new(char, str_len(curenv->real_subj) + 5); + env->subject = p_new(char, m_strlen(curenv->real_subj) + 5); sprintf (env->subject, "Re: %s", curenv->real_subj); /* __SPRINTF_CHECKED__ */ } else if (!env->subject) - env->subject = str_dup ("Re: your mail"); + env->subject = m_strdup("Re: your mail"); #ifdef USE_NNTP if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from) - env->x_comment_to = str_dup (mutt_get_name (curenv->from)); + env->x_comment_to = m_strdup(mutt_get_name (curenv->from)); #endif } @@ -687,7 +687,7 @@ void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv, if (curenv->message_id) { *q = mutt_new_list (); - (*q)->data = str_dup (curenv->message_id); + (*q)->data = m_strdup(curenv->message_id); } if (pp) @@ -751,7 +751,7 @@ envelope_defaults (ENVELOPE * env, CONTEXT * ctx, HEADER * cur, int flags) /* in case followup set Newsgroups: with Followup-To: if it present */ if (!env->newsgroups && curenv && str_casecmp (curenv->followup_to, "poster")) - env->newsgroups = str_dup (curenv->followup_to); + env->newsgroups = m_strdup(curenv->followup_to); } else #endif @@ -894,7 +894,7 @@ void mutt_set_followup_to (ENVELOPE * e) #ifdef USE_NNTP if (option (OPTNEWSSEND)) { if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ','))) - e->followup_to = str_dup (e->newsgroups); + e->followup_to = m_strdup(e->newsgroups); return; } #endif @@ -967,7 +967,7 @@ static ADDRESS *set_reverse_name (ENVELOPE * env) if (!option (OPTREVREAL)) p_delete(&tmp->personal); if (!tmp->personal) - tmp->personal = str_dup (Realname); + tmp->personal = m_strdup(Realname); } return (tmp); } @@ -986,12 +986,12 @@ ADDRESS *mutt_default_from (void) adr = rfc822_cpy_adr_real (From); else if (option (OPTUSEDOMAIN)) { adr = rfc822_new_address (); - adr->mailbox = p_new(char, str_len(Username) + str_len(fqdn) + 2); + adr->mailbox = p_new(char, m_strlen(Username) + m_strlen(fqdn) + 2); sprintf (adr->mailbox, "%s@%s", NONULL (Username), NONULL (fqdn)); /* __SPRINTF_CHECKED__ */ } else { adr = rfc822_new_address (); - adr->mailbox = str_dup (NONULL (Username)); + adr->mailbox = m_strdup(NONULL (Username)); } return (adr); @@ -1139,7 +1139,7 @@ int ci_send_message (int flags, /* send mode */ if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED)) - signas = str_dup (PgpSignAs); + signas = m_strdup(PgpSignAs); /* Delay expansion of aliases until absolutely necessary--shouldn't * be necessary unless we are prompting the user or about to execute a @@ -1194,8 +1194,8 @@ int ci_send_message (int flags, /* send mode */ pbody->next = msg->content; /* don't kill command-line attachments */ msg->content = pbody; - if (!(ctype = str_dup (ContentType))) - ctype = str_dup ("text/plain"); + if (!(ctype = m_strdup(ContentType))) + ctype = m_strdup("text/plain"); mutt_parse_content_type (ctype, msg->content); p_delete(&ctype); @@ -1212,11 +1212,11 @@ int ci_send_message (int flags, /* send mode */ if (!tempfile) { mutt_mktemp (buffer); tempfp = safe_fopen (buffer, "w+"); - msg->content->filename = str_dup (buffer); + msg->content->filename = m_strdup(buffer); } else { tempfp = safe_fopen (tempfile, "a+"); - msg->content->filename = str_dup (tempfile); + msg->content->filename = m_strdup(tempfile); } if (!tempfp) { @@ -1270,7 +1270,7 @@ int ci_send_message (int flags, /* send mode */ #ifdef USE_NNTP if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP && !msg->env->newsgroups) - msg->env->newsgroups = str_dup (((NNTP_DATA *) ctx->data)->group); + msg->env->newsgroups = m_strdup(((NNTP_DATA *) ctx->data)->group); #endif if (!(flags & SENDMAILX) && @@ -1415,7 +1415,7 @@ int ci_send_message (int flags, /* send mode */ that $realname can be set in a send-hook */ if (msg->env->from && !msg->env->from->personal && !(flags & (SENDRESEND | SENDPOSTPONED))) - msg->env->from->personal = str_dup (Realname); + msg->env->from->personal = m_strdup(Realname); if (!((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY))) safe_fclose (&tempfp); diff --git a/sendlib.c b/sendlib.c index 48f95b1..60673be 100644 --- a/sendlib.c +++ b/sendlib.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -31,7 +32,6 @@ #include "mutt_crypt.h" #include "mutt_idna.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -295,7 +295,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) fprintf (f, "Content-Type: %s/%s", TYPE (a), a->subtype); if (a->parameter) { - len = 25 + str_len (a->subtype); /* approximate len. of content-type */ + len = 25 + m_strlen(a->subtype); /* approximate len. of content-type */ for (p = a->parameter; p; p = p->next) { char *tmp; @@ -306,7 +306,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) fputc (';', f); buffer[0] = 0; - tmp = str_dup (p->value); + tmp = m_strdup(p->value); encode = rfc2231_encode_string (&tmp); rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials); @@ -321,7 +321,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) p_delete(&tmp); - tmplen = str_len (buffer) + str_len (p->attribute) + 1; + tmplen = m_strlen(buffer) + m_strlen(p->attribute) + 1; if (len + tmplen + 2 > 76) { fputs ("\n\t", f); @@ -358,7 +358,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) t = fn; buffer[0] = 0; - tmp = str_dup (t); + tmp = m_strdup(t); encode = rfc2231_encode_string (&tmp); rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials); p_delete(&tmp); @@ -891,7 +891,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path) type = TYPEOTHER; cur_sze = 0; - szf = str_len (path); + szf = m_strlen(path); for (count = 0; count < 4; count++) { /* @@ -934,7 +934,7 @@ int mutt_lookup_mime_type (BODY * att, const char *path) /* cycle through the file extensions */ while ((p = strtok (p, " \t\n"))) { - sze = str_len (p); + sze = m_strlen(p); if ((sze > cur_sze) && (szf >= sze) && (str_casecmp (path + szf - sze, p) == 0 || ascii_strcasecmp (path + szf - sze, p) == 0) && (szf == sze @@ -1035,7 +1035,7 @@ cleanup: a->d_filename = a->filename; if (a->filename && a->unlink) unlink (a->filename); - a->filename = str_dup (temp); + a->filename = m_strdup(temp); a->unlink = 1; if (stat (a->filename, &sb) == -1) { mutt_perror ("stat"); @@ -1076,7 +1076,7 @@ static void transform_to_7bit (BODY * a, FILE * fpin) mutt_decode_attachment (a, &s); fclose (s.fpout); a->d_filename = a->filename; - a->filename = str_dup (buff); + a->filename = m_strdup(buff); a->unlink = 1; if (stat (a->filename, &sb) == -1) { mutt_perror ("stat"); @@ -1213,8 +1213,8 @@ BODY *mutt_make_message_attach (CONTEXT * ctx, HEADER * hdr, int attach_msg) body = mutt_new_body (); body->type = TYPEMESSAGE; - body->subtype = str_dup ("rfc822"); - body->filename = str_dup (buffer); + body->subtype = m_strdup("rfc822"); + body->filename = m_strdup(buffer); body->unlink = 1; body->use_disp = 0; body->disposition = DISPINLINE; @@ -1280,7 +1280,7 @@ BODY *mutt_make_file_attach (const char *path) CONTENT *info; att = mutt_new_body (); - att->filename = str_dup (path); + att->filename = m_strdup(path); /* Attempt to determine the appropriate content-type based on the filename * suffix. @@ -1292,8 +1292,8 @@ BODY *mutt_make_file_attach (const char *path) mutt_lookup_mime_type (buf, sizeof (buf), xbuf, sizeof (xbuf), path)) != TYPEOTHER || *xbuf != '\0') { att->type = n; - att->subtype = str_dup (buf); - att->xtype = str_dup (xbuf); + att->subtype = m_strdup(buf); + att->xtype = m_strdup(xbuf); } #else @@ -1315,11 +1315,11 @@ BODY *mutt_make_file_attach (const char *path) * chars if this is really a binary file... */ att->type = TYPETEXT; - att->subtype = str_dup ("plain"); + att->subtype = m_strdup("plain"); } else { att->type = TYPEAPPLICATION; - att->subtype = str_dup ("octet-stream"); + att->subtype = m_strdup("octet-stream"); } } @@ -1347,7 +1347,7 @@ BODY *mutt_make_multipart (BODY * b) new = mutt_new_body (); new->type = TYPEMULTIPART; - new->subtype = str_dup ("mixed"); + new->subtype = m_strdup("mixed"); new->encoding = get_toplevel_encoding (b); mutt_generate_boundary (&new->parameter); new->use_disp = 0; @@ -1401,7 +1401,7 @@ void mutt_write_address_list (ADDRESS * adr, FILE * fp, int linelen, adr->next = NULL; buf[0] = 0; rfc822_write_address (buf, sizeof (buf), adr, display); - len = str_len (buf); + len = m_strlen(buf); if (count && linelen + len > 74) { fputs ("\n\t", fp); linelen = len + 8; /* tab is usually about 8 spaces... */ @@ -1643,13 +1643,13 @@ static void encode_headers (LIST * h) i = p - h->data; ++p; SKIPWS (p); - tmp = str_dup (p); + tmp = m_strdup(p); if (!tmp) continue; rfc2047_encode_string (&tmp); - p_realloc(&h->data, str_len(h->data) + 2 + str_len(tmp) + 1); + p_realloc(&h->data, m_strlen(h->data) + 2 + m_strlen(tmp) + 1); sprintf (h->data + i, ": %s", NONULL (tmp)); /* __SPRINTF_CHECKED__ */ @@ -1723,11 +1723,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) break; case 'O': snprintf (tmp, sizeof (tmp), "%lo", (unsigned long) now); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 'p': snprintf (tmp, sizeof (tmp), "%u", (unsigned int) getpid ()); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 'P': snprintf (tmp, sizeof (tmp), "%c", MsgIdPfx); @@ -1736,11 +1736,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) break; case 'r': snprintf (tmp, sizeof (tmp), "%u", (unsigned int) rand ()); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 'R': snprintf (tmp, sizeof (tmp), "%x", (unsigned int) rand ()); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 's': snprintf (tmp, sizeof (tmp), "%02d", tm->tm_sec); @@ -1748,11 +1748,11 @@ static void mutt_gen_localpart (char *buf, unsigned int len, char *fmt) break; case 'T': snprintf (tmp, sizeof (tmp), "%u", (unsigned int) now); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 'X': snprintf (tmp, sizeof (tmp), "%x", (unsigned int) now); - str_ncat (buf, len, tmp, str_len (tmp)); + str_ncat (buf, len, tmp, m_strlen(tmp)); break; case 'Y': snprintf (tmp, sizeof (tmp), "%04d", tm->tm_year + 1900); /* this will break in the year 10000 ;-) */ @@ -1785,12 +1785,12 @@ char *mutt_gen_msgid (void) if (!(fqdn = mutt_fqdn (0))) fqdn = NONULL (Hostname); - localpart_length = sizeof (buf) - str_len (fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */ + localpart_length = sizeof (buf) - m_strlen(fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */ mutt_gen_localpart (localpart, localpart_length, MsgIdFormat); snprintf (buf, sizeof (buf), "<%s@%s>", localpart, fqdn); - return (str_dup (buf)); + return (m_strdup(buf)); } static RETSIGTYPE alarm_handler (int sig) @@ -1823,7 +1823,7 @@ send_msg(const char *path, const char **args, const char *msg, char **tempfile) char tmp[_POSIX_PATH_MAX]; mutt_mktemp (tmp); - *tempfile = str_dup (tmp); + *tempfile = m_strdup(tmp); } if ((pid = fork ()) == 0) { @@ -1990,11 +1990,11 @@ static int mutt_invoke_sendmail (ADDRESS * from, /* the sender */ return i; } - s = str_dup (cmd); + s = m_strdup(cmd); } else #endif - s = str_dup (Sendmail); + s = m_strdup(Sendmail); ps = s; i = 0; @@ -2005,7 +2005,7 @@ static int mutt_invoke_sendmail (ADDRESS * from, /* the sender */ if (i) args[argslen++] = ps; else { - path = str_dup (ps); + path = m_strdup(ps); ps = strrchr (ps, '/'); if (ps) ps++; @@ -2108,9 +2108,9 @@ int mutt_invoke_mta (ADDRESS * from, /* the sender */ string. */ char *mutt_append_string (char *a, const char *b) { - size_t la = str_len (a); + size_t la = m_strlen(a); - p_realloc(&a, la + str_len(b) + 1); + p_realloc(&a, la + m_strlen(b) + 1); strcpy (a + la, b); /* __STRCPY_CHECKED__ */ return (a); } @@ -2138,7 +2138,7 @@ char *mutt_quote_string (const char *s) char *r, *pr; size_t rlen; - rlen = str_len (s) + 3; + rlen = m_strlen(s) + 3; pr = r = p_new(char, rlen); *pr++ = '"'; while (*s) { @@ -2175,7 +2175,7 @@ void mutt_prepare_envelope (ENVELOPE * env, int final) rfc822_cat (buffer, sizeof (buffer), "undisclosed-recipients", RFC822Specials); - env->to->mailbox = str_dup (buffer); + env->to->mailbox = m_strdup(buffer); } mutt_set_followup_to (env); diff --git a/sidebar.c b/sidebar.c index 6948607..da858b1 100644 --- a/sidebar.c +++ b/sidebar.c @@ -13,6 +13,7 @@ */ #include +#include #include #include "mutt.h" @@ -22,7 +23,6 @@ #include "buffy.h" #include "keymap.h" -#include "lib/str.h" #include #include @@ -60,11 +60,11 @@ static char *shortened_hierarchy (char *box, int maxlen) { int dots = 0; char *last_dot = NULL; - int i, j, len = str_len (box); + int i, j, len = m_strlen(box); char *new_box; if (!SidebarBoundary || !*SidebarBoundary) - return (str_dup (box)); + return (m_strdup(box)); for (i = 0; i < len; ++i) { if (strchr (SidebarBoundary, box[i])) { @@ -81,7 +81,7 @@ static char *shortened_hierarchy (char *box, int maxlen) if (strchr (SidebarBoundary, box[i])) { new_box[j++] = box[i]; new_box[j] = 0; - if (&box[i + 1] != last_dot || j + str_len (last_dot) > maxlen) { + if (&box[i + 1] != last_dot || j + m_strlen(last_dot) > maxlen) { new_box[j++] = box[i + 1]; new_box[j] = 0; } else { @@ -92,7 +92,7 @@ static char *shortened_hierarchy (char *box, int maxlen) } return new_box; } - return str_dup (box); + return m_strdup(box); } static const char* sidebar_number_format (char* dest, size_t destlen, char op, @@ -191,9 +191,9 @@ int make_sidebar_entry (char* box, int idx, size_t len) int shortened = 0, lencnt = 0; char no[SHORT_STRING], entry[SHORT_STRING]; #if USE_IMAP - int l = str_len (ImapHomeNamespace); + int l = m_strlen(ImapHomeNamespace); #endif - int l_m = str_len (Maildir); + int l_m = m_strlen(Maildir); if (SidebarWidth > COLS) SidebarWidth = COLS; @@ -207,17 +207,17 @@ int make_sidebar_entry (char* box, int idx, size_t len) mutt_FormatString (no, len, NONULL (SidebarNumberFormat), sidebar_number_format, idx, M_FORMAT_OPTIONAL); - lencnt = str_len (no); + lencnt = m_strlen(no); memset (&entry, ' ', sizeof (entry)); #if USE_IMAP if (l > 0 && str_ncmp (box, ImapHomeNamespace, l) == 0 && - str_len (box) > l) + m_strlen(box) > l) box += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */ else #endif if (l_m > 0 && str_ncmp (box, Maildir, l_m) == 0 && - str_len (box) > l_m) { + m_strlen(box) > l_m) { box += l_m; if (Maildir[strlen(Maildir)-1]!='/') { box += 1; @@ -225,13 +225,13 @@ int make_sidebar_entry (char* box, int idx, size_t len) } else box = basename (box); - if (option (OPTSHORTENHIERARCHY) && str_len (box) > len-lencnt-1) { + if (option (OPTSHORTENHIERARCHY) && m_strlen(box) > len-lencnt-1) { box = shortened_hierarchy (box, len-lencnt-1); shortened = 1; } snprintf (entry, len-lencnt, "%s", box); - entry[str_len (entry)] = ' '; + entry[m_strlen(entry)] = ' '; strncpy (entry + (len - lencnt), no, lencnt); addnstr (entry, len); @@ -281,7 +281,7 @@ void sidebar_draw_frames (void) { if (!option(OPTMBOXPANE) || SidebarWidth==0) return; - delim_len=str_len(NONULL(SidebarDelim)); + delim_len=m_strlen(NONULL(SidebarDelim)); /* draw vertical delimiter */ SETCOLOR (MT_COLOR_SIDEBAR); @@ -328,7 +328,7 @@ int sidebar_draw (int menu) { last_line = LINES - 2 + (option (OPTSTATUSONTOP) && !option (OPTHELP) ? 1 : 0), i = 0,line; BUFFY *tmp; - size_t delim_len = str_len (SidebarDelim); + size_t delim_len = m_strlen(SidebarDelim); char blank[SHORT_STRING]; known_lines=last_line-first_line; @@ -352,7 +352,7 @@ int sidebar_draw (int menu) { } if (SidebarWidth > 0 && option (OPTMBOXPANE) - && str_len (SidebarDelim) >= SidebarWidth) { + && m_strlen(SidebarDelim) >= SidebarWidth) { mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar.")); sleep (2); unset_option (OPTMBOXPANE); diff --git a/smime.c b/smime.c index 88989f5..554f02e 100644 --- a/smime.c +++ b/smime.c @@ -14,6 +14,7 @@ #endif #include +#include #include #include "mutt.h" @@ -25,7 +26,6 @@ #include "mime.h" #include "copy.h" -#include "lib/str.h" #include "lib/debug.h" #include @@ -489,8 +489,8 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, if (!mailbox && !query) return (NULL); - addr_len = mailbox ? str_len (mailbox) : 0; - query_len = query ? str_len (query) : 0; + addr_len = mailbox ? m_strlen(mailbox) : 0; + query_len = query ? m_strlen(query) : 0; *key = '\0'; @@ -622,8 +622,8 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, } - /* Note: str_dup ("") returns NULL. */ - return str_dup (key); + /* Note: m_strdup("") returns NULL. */ + return m_strdup(key); } @@ -649,7 +649,7 @@ void _smime_getkeys (char *mailbox) if (k) { /* the key used last time. */ if (*SmimeKeyToUse && - !str_casecmp (k, SmimeKeyToUse + str_len (SmimeKeys) + 1)) { + !str_casecmp (k, SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) { p_delete(&k); return; } @@ -671,7 +671,7 @@ void _smime_getkeys (char *mailbox) if (*SmimeKeyToUse) { if (!str_casecmp (SmimeDefaultKey, - SmimeKeyToUse + str_len (SmimeKeys) + 1)) + SmimeKeyToUse + m_strlen(SmimeKeys) + 1)) return; smime_void_passphrase (); @@ -773,10 +773,10 @@ char *smime_findKeys (ADDRESS * to, ADDRESS * cc, ADDRESS * bcc) return NULL; } - keylist_size += str_len (keyID) + 2; + keylist_size += m_strlen(keyID) + 2; p_realloc(&keylist, keylist_size); sprintf (keylist + keylist_used, "%s\n", keyID); /* __SPRINTF_CHECKED__ */ - keylist_used = str_len (keylist); + keylist_used = m_strlen(keylist); rfc822_free_address (&addr); @@ -833,8 +833,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, while ((fgets (email, sizeof (email), fpout))) { - *(email + str_len (email) - 1) = '\0'; - if (str_ncasecmp (email, mailbox, str_len (mailbox)) == 0) + *(email + m_strlen(email) - 1) = '\0'; + if (str_ncasecmp (email, mailbox, m_strlen(mailbox)) == 0) ret = 1; ret = ret < 0 ? 0 : ret; @@ -860,8 +860,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox, rewind (fpout); while ((fgets (email, sizeof (email), fpout))) { - *(email + str_len (email) - 1) = '\0'; - (*buffer)[count] = p_dupstr(email, str_len(email)); + *(email + m_strlen(email) - 1) = '\0'; + (*buffer)[count] = p_dupstr(email, m_strlen(email)); count++; } } @@ -977,7 +977,7 @@ static char *smime_extract_certificate (char *infile) fclose (fpout); fclose (fperr); - return str_dup (certfile); + return m_strdup(certfile); } static char *smime_extract_signer_certificate (char *infile) @@ -1039,7 +1039,7 @@ static char *smime_extract_signer_certificate (char *infile) fclose (fpout); fclose (fperr); - return str_dup (certfile); + return m_strdup(certfile); } @@ -1241,7 +1241,7 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist) *certfile = '\0'; while (1) { - int off = str_len (certfile); + int off = m_strlen(certfile); while (*++cert_end && *cert_end != '\n'); if (!*cert_end) @@ -1304,14 +1304,14 @@ BODY *smime_build_smime_entity (BODY * a, char *certlist) t = mutt_new_body (); t->type = TYPEAPPLICATION; - t->subtype = str_dup ("x-pkcs7-mime"); + t->subtype = m_strdup("x-pkcs7-mime"); mutt_set_parameter ("name", "smime.p7m", &t->parameter); mutt_set_parameter ("smime-type", "enveloped-data", &t->parameter); t->encoding = ENCBASE64; /* The output of OpenSSL SHOULD be binary */ t->use_disp = 1; t->disposition = DISPATTACH; - t->d_filename = str_dup ("smime.p7m"); - t->filename = str_dup (tempfile); + t->d_filename = m_strdup("smime.p7m"); + t->filename = m_strdup(tempfile); t->unlink = 1; /*delete after sending the message */ t->parts = 0; t->next = 0; @@ -1420,7 +1420,7 @@ BODY *smime_sign_message (BODY * a) t = mutt_new_body (); t->type = TYPEMULTIPART; - t->subtype = str_dup ("signed"); + t->subtype = m_strdup("signed"); t->encoding = ENC7BIT; t->use_disp = 0; t->disposition = DISPINLINE; @@ -1437,9 +1437,9 @@ BODY *smime_sign_message (BODY * a) t->parts->next = mutt_new_body (); t = t->parts->next; t->type = TYPEAPPLICATION; - t->subtype = str_dup ("x-pkcs7-signature"); - t->filename = str_dup (signedfile); - t->d_filename = str_dup ("smime.p7s"); + t->subtype = m_strdup("x-pkcs7-signature"); + t->filename = m_strdup(signedfile); + t->d_filename = m_strdup("smime.p7s"); t->use_disp = 1; t->disposition = DISPATTACH; t->encoding = ENCBASE64; @@ -1727,7 +1727,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) } } while (fgets (buf, sizeof (buf) - 1, smimeout) != NULL) { - len = str_len (buf); + len = m_strlen(buf); if (len > 1 && buf[len - 2] == '\r') { buf[len - 2] = '\n'; buf[len - 1] = '\0'; diff --git a/sort.c b/sort.c index 8a5957f..52f4dff 100644 --- a/sort.c +++ b/sort.c @@ -12,13 +12,13 @@ #endif #include +#include #include "mutt.h" #include "sort.h" #include "thread.h" #include "mutt_idna.h" -#include "lib/str.h" #include #include diff --git a/state.c b/state.c index ca73d4a..3c87f3c 100644 --- a/state.c +++ b/state.c @@ -70,7 +70,7 @@ void state_prefix_putc (char c, STATE * s) if (s->flags & M_PENDINGPREFIX) { int i; - i = str_len (Quotebuf); + i = m_strlen(Quotebuf); Quotebuf[i++] = c; Quotebuf[i] = '\0'; if (i == sizeof (Quotebuf) - 1 || c == '\n') { @@ -102,11 +102,11 @@ void state_prefix_putc (char c, STATE * s) snprintf (buf, sizeof (buf), "%s%s", NONULL (s->prefix), Quotebuf); #ifdef DEBUG - if (str_len (buf) >= 2) { - save = buf[str_len (buf) - 1]; - buf[str_len (buf) - 1] = '\0'; + if (m_strlen(buf) >= 2) { + save = buf[m_strlen(buf) - 1]; + buf[m_strlen(buf) - 1] = '\0'; debug_print (2, ("buf = '%s'\n", buf)); - buf[str_len (buf)] = save; + buf[m_strlen(buf)] = save; } #endif diff --git a/status.c b/status.c index 2a925b6..95ad3ff 100644 --- a/status.c +++ b/status.c @@ -12,6 +12,7 @@ #endif #include +#include #include #include "mutt.h" @@ -22,7 +23,6 @@ #include "mx.h" #include "buffy.h" -#include "lib/str.h" #include #include @@ -245,7 +245,7 @@ static const char *status_format_str (char *buf, size_t buflen, char op, if (!StChars) buf[0] = 0; - else if (i >= str_len (StChars)) + else if (i >= m_strlen(StChars)) buf[0] = StChars[0]; else buf[0] = StChars[i]; diff --git a/thread.c b/thread.c index c3b78de..ac0d67a 100644 --- a/thread.c +++ b/thread.c @@ -1284,7 +1284,7 @@ static int link_threads (HEADER * parent, HEADER * child, CONTEXT * ctx) mutt_break_thread (child); child->env->in_reply_to = mutt_new_list (); - child->env->in_reply_to->data = str_dup (parent->env->message_id); + child->env->in_reply_to->data = m_strdup(parent->env->message_id); mutt_set_flag (ctx, child, M_TAG, 0); diff --git a/url.c b/url.c index 9062dce..5fb6d46 100644 --- a/url.c +++ b/url.c @@ -174,7 +174,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags) if (ciss->host) { str_cat (dest, len, "//"); - len -= (l = str_len (dest)); + len -= (l = m_strlen(dest)); dest += l; if (ciss->user) { @@ -183,7 +183,7 @@ int url_ciss_tostring (ciss_url_t * ciss, char *dest, size_t len, int flags) else snprintf (dest, len, "%s@", ciss->user); - len -= (l = str_len (dest)); + len -= (l = m_strlen(dest)); dest += l; } @@ -214,7 +214,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src) if (!(t = strchr (src, ':'))) return -1; - if ((tmp = str_dup (t + 1)) == NULL) + if ((tmp = m_strdup(t + 1)) == NULL) return -1; if ((headers = strchr (tmp, '?'))) @@ -240,7 +240,7 @@ int url_parse_mailto (ENVELOPE * e, char **body, const char *src) } else { #define SAFEPFX (option (OPTSTRICTMAILTO) ? "" : "X-Mailto-") - taglen = str_len (tag) + str_len (SAFEPFX); + taglen = m_strlen(tag) + m_strlen(SAFEPFX); /* mutt_parse_rfc822_line makes some assumptions */ snprintf (scratch, sizeof (scratch), "%s%s: %s", SAFEPFX, tag, value); #undef SAVEPFX diff --git a/xterm.c b/xterm.c index 5ce9a81..b3f506c 100644 --- a/xterm.c +++ b/xterm.c @@ -4,8 +4,8 @@ * please see the file GPL in the top level source directory. */ #include +#include #include "xterm.h" -#include "lib/str.h" void mutt_xterm_set_title (const char *title) { fputs ("\033]2;", stdout);