- if (!(ct = (CT) calloc(1, sizeof(*ct))))
- adios(EX_OSERR, NULL, "out of memory");
+ ct = mh_xcalloc(1, sizeof(*ct));
switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
case FLD:
case FLDPLUS:
switch (state = m_getfld(state, name, buf, sizeof(buf), in)) {
case FLD:
case FLDPLUS:
/* if necessary, get rest of field */
while (state == FLDPLUS) {
/* if necessary, get rest of field */
while (state == FLDPLUS) {
advise(NULL, "message %s has multiple %s: fields", ct->c_file, VRSN_FIELD);
goto next_header;
}
advise(NULL, "message %s has multiple %s: fields", ct->c_file, VRSN_FIELD);
goto next_header;
}
** Insert at first semicolon, if any.
** If none, append to end.
*/
** Insert at first semicolon, if any.
** If none, append to end.
*/
if ((cp = strchr(prefix, ';'))) {
suffix = concat(cp, NULL);
*cp = '\0';
newbuf = concat(prefix, insertion, suffix,
"\n", NULL);
if ((cp = strchr(prefix, ';'))) {
suffix = concat(cp, NULL);
*cp = '\0';
newbuf = concat(prefix, insertion, suffix,
"\n", NULL);
} else {
/* Append to end. */
newbuf = concat(buf, insertion, "\n", NULL);
}
} else {
/* Append to end. */
newbuf = concat(buf, insertion, "\n", NULL);
}
memcpy(extracted_name_value, name_suffix_begin,
cp - name_suffix_begin);
extracted_name_value[cp - name_suffix_begin] = '\0';
memcpy(extracted_name_value, name_suffix_begin,
cp - name_suffix_begin);
extracted_name_value[cp - name_suffix_begin] = '\0';
}
if (!(dp = strchr(ct->c_id = ++cp, '>'))) {
advise(NULL, "invalid ID in message %s", ct->c_file);
}
if (!(dp = strchr(ct->c_id = ++cp, '>'))) {
advise(NULL, "invalid ID in message %s", ct->c_file);
if (istype) {
if ((dp = ci->ci_comment)) {
ci->ci_comment = concat(dp, " ", buffer, NULL);
if (istype) {
if ((dp = ci->ci_comment)) {
ci->ci_comment = concat(dp, " ", buffer, NULL);
- if ((t = (struct text *) calloc(1, sizeof(*t))) == NULL)
- adios(EX_OSERR, NULL, "out of memory");
+ t = mh_xcalloc(1, sizeof(*t));
/* match character set or set to CHARSET_UNKNOWN */
for (kv = Charset; kv->kv_key; kv++) {
if (!mh_strcasecmp(*ep, kv->kv_key)) {
/* match character set or set to CHARSET_UNKNOWN */
for (kv = Charset; kv->kv_key; kv++) {
if (!mh_strcasecmp(*ep, kv->kv_key)) {
- if ((m = (struct multipart *) calloc(1, sizeof(*m))) == NULL)
- adios(EX_OSERR, NULL, "out of memory");
+ m = mh_xcalloc(1, sizeof(*m));
- if ((part = (struct part *) calloc(1, sizeof(*part)))
- == NULL)
- adios(EX_OSERR, NULL, "out of memory");
+ part = mh_xcalloc(1, sizeof(*part));
- if (!(base = (struct part **) calloc((size_t) (i + 1), sizeof(*base))))
- adios(EX_OSERR, NULL, "out of memory");
+ base = mh_xcalloc(i + 1, sizeof(*base));
- if ((p = (struct partial *) calloc(1, sizeof(*p))) == NULL)
- adios(EX_OSERR, NULL, "out of memory");
+ p = mh_xcalloc(1, sizeof(*p));
*/
for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
if (!mh_strcasecmp(*ap, "id")) {
*/
for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
if (!mh_strcasecmp(*ap, "id")) {
- if ((ce = (CE) calloc(1, sizeof(*ce))) == NULL)
- adios(EX_OSERR, NULL, "out of memory");
+ ce = mh_xcalloc(1, sizeof(*ce));
** Temporary file already exists, so we rename to
** version with extension.
*/
** Temporary file already exists, so we rename to
** version with extension.
*/
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
** Temporary file already exists, so we rename to
** version with extension.
*/
** Temporary file already exists, so we rename to
** version with extension.
*/
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
** Temporary file already exists, so we rename to
** version with extension.
*/
** Temporary file already exists, so we rename to
** version with extension.
*/
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
ce->ce_file = add(cp, ce->ce_file);
if (rename(file_org, ce->ce_file)) {
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}