summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2fc70e8)
add()'s arguments are back to front so add(foo, bar) produces bar+foo in
the normal case. Thus add(foo, NULL) is read as the jarring NULL+foo.
Removing the NULL with mh_xstrdup() avoids this. FENDNULL is used when
it isn't obvious foo can't be NULL as add() treats it as "" in that
case.
static void
register_for_removal(const char *pathname) {
if (exit_filelist == NULL) exit_filelist = svector_create(20);
static void
register_for_removal(const char *pathname) {
if (exit_filelist == NULL) exit_filelist = svector_create(20);
- (void) svector_push_back(exit_filelist, add(pathname, NULL));
+ (void) svector_push_back(exit_filelist, mh_xstrdup(pathname));
struct mailname *mp = getm (name, NULL, 0, NULL, 0);
if (mp && mp->m_ingrp) {
struct mailname *mp = getm (name, NULL, 0, NULL, 0);
if (mp && mp->m_ingrp) {
- char *gname = add (mp->m_gname, NULL);
+ char *gname = mh_xstrdup(FENDNULL(mp->m_gname));
/* FIXME: gname must be true; add() never returns NULL.
* Is some other test required? */
/* FIXME: gname must be true; add() never returns NULL.
* Is some other test required? */
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = NULL; /* since unencoded */
ct->c_encoding = CE_7BIT; /* Seems like a reasonable default */
ct->c_ceclosefnx = close_encoding;
ct->c_cesizefnx = NULL; /* since unencoded */
ct->c_encoding = CE_7BIT; /* Seems like a reasonable default */
- ct->c_file = add(filename, NULL);
+ ct->c_file = mh_xstrdup(FENDNULL(filename));
text = c1->c_text ? c1->c_text : c1->c_name;
/* Create a copy with trailing whitespace trimmed, for use with
* blank lines. */
text = c1->c_text ? c1->c_text : c1->c_name;
/* Create a copy with trailing whitespace trimmed, for use with
* blank lines. */
- trimmed_prefix = rtrim(add(text, NULL));
+ trimmed_prefix = rtrim(mh_xstrdup(FENDNULL(text)));
/* allocate the content structure */
NEW0(ct);
ct->c_fp = in;
/* allocate the content structure */
NEW0(ct);
ct->c_fp = in;
- ct->c_file = add (file, NULL);
+ ct->c_file = mh_xstrdup(FENDNULL(file));
ct->c_begin = ftell (ct->c_fp) + 1;
/*
ct->c_begin = ftell (ct->c_fp) + 1;
/*
char c, *cp, *dp;
char *vrsn;
char c, *cp, *dp;
char *vrsn;
- vrsn = add (hp->value, NULL);
+ vrsn = mh_xstrdup(FENDNULL(hp->value));
/* Now, cleanup this field */
cp = vrsn;
/* Now, cleanup this field */
cp = vrsn;
}
/* get copy of this field */
}
/* get copy of this field */
- ct->c_celine = cp = add (hp->value, NULL);
+ ct->c_celine = cp = mh_xstrdup(FENDNULL(hp->value));
while (isspace ((unsigned char) *cp))
cp++;
while (isspace ((unsigned char) *cp))
cp++;
- ep = cp = add (hp->value, NULL); /* get a copy */
+ ep = cp = mh_xstrdup(FENDNULL(hp->value)); /* get a copy */
while (isspace ((unsigned char) *cp))
cp++;
while (isspace ((unsigned char) *cp))
cp++;
ci = &ct->c_ctinfo;
/* store copy of Content-Type line */
ci = &ct->c_ctinfo;
/* store copy of Content-Type line */
- cp = ct->c_ctline = add (cp, NULL);
+ cp = ct->c_ctline = mh_xstrdup(FENDNULL(cp));
while (isspace ((unsigned char) *cp)) /* trim leading spaces */
cp++;
while (isspace ((unsigned char) *cp)) /* trim leading spaces */
cp++;
- dispoheader = cp = add(cp, NULL);
+ dispoheader = cp = mh_xstrdup(FENDNULL(cp));
while (isspace ((unsigned char) *cp)) /* trim leading spaces */
cp++;
while (isspace ((unsigned char) *cp)) /* trim leading spaces */
cp++;
/* scan for parameters "id", "number", and "total" */
for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
if (!strcasecmp (pm->pm_name, "id")) {
/* scan for parameters "id", "number", and "total" */
for (pm = ci->ci_first_pm; pm; pm = pm->pm_next) {
if (!strcasecmp (pm->pm_name, "id")) {
- p->pm_partid = add (pm->pm_value, NULL);
+ p->pm_partid = mh_xstrdup(FENDNULL(pm->pm_value));
continue;
}
if (!strcasecmp (pm->pm_name, "number")) {
continue;
}
if (!strcasecmp (pm->pm_name, "number")) {
if ((*p->c_ceopenfnx) (p, &file) == NOTOK)
return NOTOK;
if ((*p->c_ceopenfnx) (p, &file) == NOTOK)
return NOTOK;
- p->c_storage = add (file, NULL);
+ p->c_storage = mh_xstrdup(FENDNULL(file));
if (p->c_showproc && !strcmp (p->c_showproc, "true"))
return OK;
if (p->c_showproc && !strcmp (p->c_showproc, "true"))
return OK;
if (p) {
appending = 1;
if (! ct->c_storage) {
if (p) {
appending = 1;
if (! ct->c_storage) {
- ct->c_storage = add (p->c_storage, NULL);
+ ct->c_storage = mh_xstrdup(FENDNULL(p->c_storage));
/* record the folder name */
if (p->c_folder) {
/* record the folder name */
if (p->c_folder) {