このページを編集する際は、[[編集に関する方針]]に従ってください。
*概要 [#xf8d4547]
-対象:8.1.4
-言語:C
-宣言・定義:[[postgresql-8.1.4/src/backend/utils/error/elog.c]]

-(概要を書いてください。)

*引数 [#y0c80717]

-const char *fmt --
-ErrorData *edata --

*実装 [#zb9f496e]

 static char *
 expand_fmt_string(const char *fmt, ErrorData *edata)
-[[ErrorData/postgresql-8.1.4]] -- 以下のメンバを持つ構造体
--elevelを、intとして定義
--output_to_serverを、bool(charの別名)として定義
--output_to_clientを、bool(charの別名)として定義
--show_funcnameを、bool(charの別名)として定義
--filenameを、const charへのポインタとして定義
--linenoを、intとして定義
--funcnameを、const charへのポインタとして定義
--sqlerrcodeを、intとして定義
--messageを、charへのポインタとして定義
--detailを、charへのポインタとして定義
--hintを、charへのポインタとして定義
--contextを、charへのポインタとして定義
--cursorposを、intとして定義
--internalposを、intとして定義
--internalqueryを、charへのポインタとして定義
--saved_errnoを、intとして定義

 {
	StringInfoData buf;
-[[StringInfoData/postgresql-8.1.4]] -- 下記メンバを持つ構造体
--char型へのポインタdata
--int型の変数len
--int型の変数maxlen
--int型の変数cursor

	const char *cp;

	initStringInfo(&buf);
-[[initStringInfo()/postgresql-8.1.4]]

	for (cp = fmt; *cp; cp++)
	{
		if (cp[0] == '%' && cp[1] != '\0')
		{
			cp++;
			if (*cp == 'm')
			{
				/*
				 * Replace %m by system error string.  If there are any %'s in
				 * the string, we'd better double them so that vsnprintf won't
				 * misinterpret.
				 */
				const char *cp2;

				cp2 = useful_strerror(edata->saved_errno);
-[[useful_strerror()/postgresql-8.1.4]]

				for (; *cp2; cp2++)
				{
					if (*cp2 == '%')
						appendStringInfoCharMacro(&buf, '%');
-[[appendStringInfoCharMacro()/postgresql-8.1.4]]

					appendStringInfoCharMacro(&buf, *cp2);
-[[appendStringInfoCharMacro()/postgresql-8.1.4]] -- 上記に同じ

				}
			}
			else
			{
				/* copy % and next char --- this avoids trouble with %%m */
				appendStringInfoCharMacro(&buf, '%');
				appendStringInfoCharMacro(&buf, *cp);
-[[appendStringInfoCharMacro()/postgresql-8.1.4]] -- 上記に同じ

			}
		}
		else
			appendStringInfoCharMacro(&buf, *cp);
-[[appendStringInfoCharMacro()/postgresql-8.1.4]] -- 上記に同じ

	}

	return buf.data;
 }


*呼出元 [#kdf29475]

-[[EVALUATE_MESSAGE()/postgresql-8.1.4]]

*備考 [#t7901245]

 /*
 * expand_fmt_string --- process special format codes in a format string
 *
 * We must replace %m with the appropriate strerror string, since vsnprintf
 * won't know what to do with it.
 *
 * The result is a palloc'd string.
 */

*履歴 [#i81be96b]
-作者:[[testnoda/ページ作者]]
-日付:????/?/?
|更新日|更新者|更新内容|
|2007/4/24|[[testnoda/ページ作者]]|解読を一旦中止([[関数ポインタ①/解読日記]]を参照)|
||||

*コメント [#s262cadc]
#comment

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS