このページを編集する際は、編集に関する方針に従ってください。
#define EVALUATE_MESSAGE(targetfield, appendval) \ { \ char *fmtbuf; \ StringInfoData buf; \
/* Internationalize the error format string */ \ fmt = _(fmt); \ /* Expand %m in format string */ \ fmtbuf = expand_fmt_string(fmt, edata); \
initStringInfo(&buf); \
if ((appendval) && edata->targetfield) \
appendStringInfo(&buf, "%s\n", edata->targetfield); \
/* Generate actual output --- have to use appendStringInfoVA */ \ for (;;) \ { \ va_list args; \
bool success; \ va_start(args, fmt); \
success = appendStringInfoVA(&buf, fmtbuf, args); \
va_end(args); \
if (success) \ break; \ enlargeStringInfo(&buf, buf.maxlen); \
} \ /* Done with expanded fmt */ \ pfree(fmtbuf); \
/* Save the completed message into the stack item */ \ if (edata->targetfield) \
pfree(edata->targetfield); \
edata->targetfield = pstrdup(buf.data); \
pfree(buf.data); \
}
/* * This macro handles expansion of a format string and associated parameters; * it's common code for errmsg(), errdetail(), etc. Must be called inside * a routine that is declared like "const char *fmt, ..." and has an edata * pointer set up. The message is assigned to edata->targetfield, or * appended to it if appendval is true. * * Note: we pstrdup the buffer rather than just transferring its storage * to the edata field because the buffer might be considerably larger than * really necessary. */
更新日 | 更新者 | 更新内容 |