summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1e2eede)
directly without making copies first.
* last - Pointer to tail of linked list
* name - Name of parameter
* value - Value of parameter
* last - Pointer to tail of linked list
* name - Name of parameter
* value - Value of parameter
+ * nocopy - If set, will use the pointer values directly for "name"
+ * and "value" instead of making their own copy. These
+ * pointers will be free()'d later by the MIME routines, so
+ * they should not be used after calling this function!
- * Returned allocated parameter element
+ * Returns allocated parameter element
-PM add_param(PM *first, PM *last, const char *name, const char *value);
+PM add_param(PM *first, PM *last, char *name, char *value, int nocopy);
/*
* Retrieve a parameter value from a parameter linked list. Convert to the
/*
* Retrieve a parameter value from a parameter linked list. Convert to the
CI ci = &ct->c_ctinfo;
add_param(&ci->ci_first_pm, &ci->ci_last_pm, "charset",
CI ci = &ct->c_ctinfo;
add_param(&ci->ci_first_pm, &ci->ci_last_pm, "charset",
- contains8bit ? write_charset_8bit() : "us-ascii");
+ contains8bit ? write_charset_8bit() : "us-ascii", 0);
t->tx_charset = CHARSET_SPECIFIED;
}
}
t->tx_charset = CHARSET_SPECIFIED;
}
}
static int level = 0; /* store nesting level */
snprintf (buffer, sizeof(buffer), "%s%d", prefix, level++);
static int level = 0; /* store nesting level */
snprintf (buffer, sizeof(buffer), "%s%d", prefix, level++);
- add_param(&ci->ci_first_pm, &ci->ci_last_pm, "boundary", buffer);
+ add_param(&ci->ci_first_pm, &ci->ci_last_pm, "boundary", buffer, 0);
if (pm == NULL)
add_param(&ct->c_ctinfo.ci_first_pm, &ct->c_ctinfo.ci_last_pm,
if (pm == NULL)
add_param(&ct->c_ctinfo.ci_first_pm, &ct->c_ctinfo.ci_last_pm,
+ "name", simplename, 0);
ct->c_descr = getcpy(simplename);
ct->c_descr = add("\n", ct->c_descr);
ct->c_descr = getcpy(simplename);
ct->c_descr = add("\n", ct->c_descr);
ct->c_dispo_type = getcpy("attachment");
}
ct->c_dispo_type = getcpy("attachment");
}
- add_param(&ct->c_dispo_first, &ct->c_dispo_last, "filename", simplename);
+ add_param(&ct->c_dispo_first, &ct->c_dispo_last, "filename", simplename, 0);
for (s_pm = src->ci_first_pm; s_pm; s_pm = s_pm->pm_next) {
d_pm = add_param(&dest->ci_first_pm, &dest->ci_last_pm, s_pm->pm_name,
for (s_pm = src->ci_first_pm; s_pm; s_pm = s_pm->pm_next) {
d_pm = add_param(&dest->ci_first_pm, &dest->ci_last_pm, s_pm->pm_name,
if (s_pm->pm_charset)
d_pm->pm_charset = getcpy(s_pm->pm_charset);
if (s_pm->pm_lang)
if (s_pm->pm_charset)
d_pm->pm_charset = getcpy(s_pm->pm_charset);
if (s_pm->pm_lang)
}
add_param(&ct->c_ctinfo.ci_first_pm, &ct->c_ctinfo.ci_last_pm,
}
add_param(&ct->c_ctinfo.ci_first_pm, &ct->c_ctinfo.ci_last_pm,
+ "boundary", boundary, 0);
p = (struct part *) mh_xmalloc (sizeof *p);
p->mp_next = (struct part *) mh_xmalloc (sizeof *p->mp_next);
p = (struct part *) mh_xmalloc (sizeof *p);
p->mp_next = (struct part *) mh_xmalloc (sizeof *p->mp_next);
if (ct->c_dispo_type &&
!get_param(ct->c_dispo_first, "filename", '_', 1)) {
add_param(&ct->c_dispo_first, &ct->c_dispo_last, "filename",
if (ct->c_dispo_type &&
!get_param(ct->c_dispo_first, "filename", '_', 1)) {
add_param(&ct->c_dispo_first, &ct->c_dispo_last, "filename",
- r1bindex(ci->ci_magic, '/'));
+ r1bindex(ci->ci_magic, '/'), 0);
pp->lang = lang;
}
} else {
pp->lang = lang;
}
} else {
- pm = add_param(param_head, param_tail, nameptr, valptr);
- free(nameptr);
- free(valptr);
+ pm = add_param(param_head, param_tail, nameptr, valptr, 1);
pm->pm_charset = charset;
pm->pm_lang = lang;
}
pm->pm_charset = charset;
pm->pm_lang = lang;
}
- pm = add_param(param_head, param_tail, pp->name, p);
+ pm = add_param(param_head, param_tail, pp->name, p, 1);
pm->pm_charset = pp->charset;
pm->pm_lang = pp->lang;
pm->pm_charset = pp->charset;
pm->pm_lang = pp->lang;
- free(pp->name);
- free(p);
pp2 = pp->next;
free(pp);
pp = pp2;
pp2 = pp->next;
free(pp);
pp = pp2;
-add_param(PM *first, PM *last, const char *name, const char *value)
+add_param(PM *first, PM *last, char *name, char *value, int nocopy)
{
PM pm = mh_xmalloc(sizeof(*pm));
memset(pm, 0, sizeof(*pm));
{
PM pm = mh_xmalloc(sizeof(*pm));
memset(pm, 0, sizeof(*pm));
- pm->pm_name = getcpy(name);
- pm->pm_value = getcpy(value);
+ pm->pm_name = nocopy ? name : getcpy(name);
+ pm->pm_value = nocopy ? value : getcpy(value);
if (*first) {
(*last)->pm_next = pm;
if (*first) {
(*last)->pm_next = pm;