• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョン70caec1def5d059224ae202674e69346c78e16cf (tree)
日時2013-01-11 16:38:19
作者Takashi Suzuki <suzuki.takashi@metr...>
コミッターTakashi Suzuki

ログメッセージ

処理内容が似ている関数(parse_*_parenthesis)を1つにまとめた。

変更サマリ

差分

--- a/pg_hint_plan.c
+++ b/pg_hint_plan.c
@@ -875,29 +875,17 @@ parse_keyword(const char *str, StringInfo buf)
875875 }
876876
877877 static const char *
878-skip_opened_parenthesis(const char *str)
878+skip_parenthesis(const char *str, char parenthesis)
879879 {
880880 skip_space(str);
881881
882- if (*str != '(')
882+ if (*str != parenthesis)
883883 {
884- hint_ereport(str, ("Opening parenthesis is necessary."));
885- return NULL;
886- }
887-
888- str++;
889-
890- return str;
891-}
892-
893-static const char *
894-skip_closed_parenthesis(const char *str)
895-{
896- skip_space(str);
897-
898- if (*str != ')')
899- {
900- hint_ereport(str, ("Closing parenthesis is necessary."));
884+ if (parenthesis == '(')
885+ hint_ereport(str, ("Opening parenthesis is necessary."));
886+ else if (parenthesis == ')')
887+ hint_ereport(str, ("Closing parenthesis is necessary."));
888+
901889 return NULL;
902890 }
903891
@@ -990,7 +978,7 @@ parse_parentheses(const char *str, List **name_list, HintType type)
990978 char *name;
991979 bool truncate = true;
992980
993- if ((str = skip_opened_parenthesis(str)) == NULL)
981+ if ((str = skip_parenthesis(str, '(')) == NULL)
994982 return NULL;
995983
996984 skip_space(str);
@@ -1013,7 +1001,7 @@ parse_parentheses(const char *str, List **name_list, HintType type)
10131001 }
10141002 }
10151003
1016- if ((str = skip_closed_parenthesis(str)) == NULL)
1004+ if ((str = skip_parenthesis(str, ')')) == NULL)
10171005 return NULL;
10181006 return str;
10191007 }
旧リポジトリブラウザで表示