summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
341ef60)
(This is an old patch I had stashed.)
Some surrounding `if...adios()' are removed too, but most of the
strdup() calls weren't being checked for success, thus their
replacement.
contentline *new_node;
NEW0(new_node);
contentline *new_node;
NEW0(new_node);
- new_node->name = strdup (name);
+ new_node->name = mh_xstrdup (name);
new_node->next = node->next;
node->next = new_node;
new_node->next = node->next;
node->next = new_node;
static int
route (char *buffer)
{
static int
route (char *buffer)
{
+ path = mh_xstrdup ("@");
for (;;) {
switch (my_lex (buffer)) {
for (;;) {
switch (my_lex (buffer)) {
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum)) {
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum)) {
- fwdmsg = strdup(m_name(msgnum));
+ fwdmsg = mh_xstrdup(m_name(msgnum));
qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
}
qsort (Maildir, num_maildir_entries, sizeof(*Maildir), maildir_srt);
}
- if ((cp = strdup(newmail)) == NULL)
- adios (NULL, "error allocating memory to copy newmail");
-
+ cp = mh_xstrdup(newmail);
if (!folder)
folder = getfolder (0);
maildir = m_maildir (folder);
if (!folder)
folder = getfolder (0);
maildir = m_maildir (folder);
-
- if ((maildir_copy = strdup(maildir)) == NULL)
- adios (maildir, "error allocating memory to copy maildir");
+ maildir_copy = mh_xstrdup(maildir);
if (!folder_exists(maildir)) {
/* If the folder doesn't exist, and we're given the -silent flag,
if (!folder_exists(maildir)) {
/* If the folder doesn't exist, and we're given the -silent flag,
(node = find_contentline (clines, "BEGIN", "VEVENT"))) {
contentline *new_node = add_contentline (node, "ATTENDEE");
(node = find_contentline (clines, "BEGIN", "VEVENT"))) {
contentline *new_node = add_contentline (node, "ATTENDEE");
- add_param_name (new_node, strdup ("PARTSTAT"));
- add_param_value (new_node, strdup (partstat));
- add_param_name (new_node, strdup ("CN"));
- add_param_value (new_node, strdup (getfullname ()));
+ add_param_name (new_node, mh_xstrdup ("PARTSTAT"));
+ add_param_value (new_node, mh_xstrdup (partstat));
+ add_param_name (new_node, mh_xstrdup ("CN"));
+ add_param_value (new_node, mh_xstrdup (getfullname ()));
new_node->value = concat ("MAILTO:", getlocalmbox (), NULL);
}
}
new_node->value = concat ("MAILTO:", getlocalmbox (), NULL);
}
}
if ((node = find_contentline (clines, "STATUS", 0)) &&
! strcasecmp (node->value, "CONFIRMED")) {
free (node->value);
if ((node = find_contentline (clines, "STATUS", 0)) &&
! strcasecmp (node->value, "CONFIRMED")) {
free (node->value);
- node->value = strdup ("CANCELLED");
+ node->value = mh_xstrdup ("CANCELLED");
}
if ((node = find_contentline (clines, "SEQUENCE", 0))) {
}
if ((node = find_contentline (clines, "SEQUENCE", 0))) {
(void) snprintf (buf, sizeof buf, "%d", sequence + 1);
free (node->value);
(void) snprintf (buf, sizeof buf, "%d", sequence + 1);
free (node->value);
- node->value = strdup (buf);
+ node->value = mh_xstrdup (buf);
if ((node = find_contentline (clines, "METHOD", 0))) {
free (node->value);
if ((node = find_contentline (clines, "METHOD", 0))) {
free (node->value);
- node->value = strdup (action == ACT_CANCEL ? "CANCEL" : "REPLY");
+ node->value = mh_xstrdup (action == ACT_CANCEL ? "CANCEL" : "REPLY");
}
if ((node = find_contentline (clines, "PRODID", 0))) {
free (node->value);
}
if ((node = find_contentline (clines, "PRODID", 0))) {
free (node->value);
- node->value = strdup ("nmh mhical v0.1");
+ node->value = mh_xstrdup ("nmh mhical v0.1");
}
if ((node = find_contentline (clines, "VERSION", 0))) {
if (! node->value) {
admonish (NULL, "Version property is missing value, assume 2.0");
}
if ((node = find_contentline (clines, "VERSION", 0))) {
if (! node->value) {
admonish (NULL, "Version property is missing value, assume 2.0");
- node->value = strdup ("2.0");
+ node->value = mh_xstrdup ("2.0");
}
if (strcmp (node->value, "2.0")) {
admonish (NULL, "supports the Version 2.0 specified by RFC 5545 "
"but iCalendar object has Version %s", node->value);
}
if (strcmp (node->value, "2.0")) {
admonish (NULL, "supports the Version 2.0 specified by RFC 5545 "
"but iCalendar object has Version %s", node->value);
- node->value = strdup ("2.0");
+ node->value = mh_xstrdup ("2.0");
if (strftime (buf, sizeof buf, "%Y%m%dT%H%M%SZ", &now_tm)) {
free (node->value);
if (strftime (buf, sizeof buf, "%Y%m%dT%H%M%SZ", &now_tm)) {
free (node->value);
- node->value = strdup (buf);
+ node->value = mh_xstrdup (buf);
} else {
admonish (NULL, "strftime unable to format current time");
}
} else {
admonish (NULL, "strftime unable to format current time");
}
char *line = NULL;
size_t len;
char *line = NULL;
size_t len;
- line = strdup (node->name);
+ line = mh_xstrdup (node->name);
line = format_params (line, node->params);
len = strlen (line);
line = format_params (line, node->params);
len = strlen (line);
if ((c = fmt_findcomp ("method"))) {
if ((node = find_contentline (clines, "METHOD", 0)) && node->value) {
if ((c = fmt_findcomp ("method"))) {
if ((node = find_contentline (clines, "METHOD", 0)) && node->value) {
- c->c_text = strdup (node->value);
+ c->c_text = mh_xstrdup (node->value);
}
}
if ((c = fmt_findcomp ("organizer"))) {
if ((node = find_contentline (clines, "ORGANIZER", 0)) &&
node->value) {
}
}
if ((c = fmt_findcomp ("organizer"))) {
if ((node = find_contentline (clines, "ORGANIZER", 0)) &&
node->value) {
- c->c_text = strdup (identity (node));
+ c->c_text = mh_xstrdup (identity (node));
}
}
if ((c = fmt_findcomp ("summary"))) {
if ((node = find_contentline (clines, "SUMMARY", 0)) && node->value) {
}
}
if ((c = fmt_findcomp ("summary"))) {
if ((node = find_contentline (clines, "SUMMARY", 0)) && node->value) {
- c->c_text = strdup (node->value);
+ c->c_text = mh_xstrdup (node->value);
if (node->name && node->value && ! in_valarm &&
! strcasecmp ("DESCRIPTION", node->name) &&
strcasecmp (node->value, "\\n\\n")) {
if (node->name && node->value && ! in_valarm &&
! strcasecmp ("DESCRIPTION", node->name) &&
strcasecmp (node->value, "\\n\\n")) {
- c->c_text = strdup (node->value);
+ c->c_text = mh_xstrdup (node->value);
} else if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
} else if (in_valarm) {
if (! strcasecmp ("END", node->name) &&
! strcasecmp ("VALARM", node->value)) {
if ((c = fmt_findcomp ("location"))) {
if ((node = find_contentline (clines, "LOCATION", 0)) &&
node->value) {
if ((c = fmt_findcomp ("location"))) {
if ((node = find_contentline (clines, "LOCATION", 0)) &&
node->value) {
- c->c_text = strdup (node->value);
+ c->c_text = mh_xstrdup (node->value);
} else if (! strcasecmp ("DTSTART", node->name)) {
/* Got it: DTSTART outside of a VTIMEZONE section. */
char *datetime = format_datetime (timezones, node);
} else if (! strcasecmp ("DTSTART", node->name)) {
/* Got it: DTSTART outside of a VTIMEZONE section. */
char *datetime = format_datetime (timezones, node);
- c->c_text = datetime ? datetime : strdup(node->value);
+ c->c_text = datetime ? datetime : mh_xstrdup(node->value);
struct mailname *mp;
NEW(adr_nodep);
struct mailname *mp;
NEW(adr_nodep);
- adr_nodep->adr = strdup (cp);
+ adr_nodep->adr = mh_xstrdup (cp);
adr_nodep->escape_local_part = 0;
adr_nodep->fixed = 0;
adr_nodep->next = NULL;
adr_nodep->escape_local_part = 0;
adr_nodep->fixed = 0;
adr_nodep->next = NULL;
* Walk the list and try to fix broken addresses.
*/
for (np = adrs; np; np = np->next) {
* Walk the list and try to fix broken addresses.
*/
for (np = adrs; np; np = np->next) {
- char *display_name = strdup (np->adr);
+ char *display_name = mh_xstrdup (np->adr);
size_t len = strlen (display_name);
if (np->escape_local_part) {
char *local_part_end = strrchr (display_name, '<');
size_t len = strlen (display_name);
if (np->escape_local_part) {
char *local_part_end = strrchr (display_name, '<');
- char *angle_addr = strdup (local_part_end);
+ char *angle_addr = mh_xstrdup (local_part_end);
struct mailname *mp;
char *new_adr, *adr;
struct mailname *mp;
char *new_adr, *adr;
free (angle_addr);
free (new_adr);
free (np->adr);
free (angle_addr);
free (new_adr);
free (np->adr);
- np->adr = strdup (adr);
+ np->adr = mh_xstrdup (adr);
/* Need to flush getname() */
while ((cp = getname (""))) continue;
/* Need to flush getname() */
while ((cp = getname (""))) continue;
free (fixed_str);
fixed_str = new_str;
} else {
free (fixed_str);
fixed_str = new_str;
} else {
- fixed_str = strdup (np->adr);
+ fixed_str = mh_xstrdup (np->adr);
return fixed_str;
}
free (fixed_str);
return fixed_str;
}
free (fixed_str);
- return str ? strdup (str) : NULL;
+ return str ? mh_xstrdup (str) : NULL;