Skip to content

Commit 137ce34

Browse files
committed
Remove recursive call.
1 parent 46a9e42 commit 137ce34

File tree

1 file changed

+13
-10
lines changed
  • src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates

1 file changed

+13
-10
lines changed

src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Predicates/PredicateQuery.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,19 @@ private bool IsQuoted(string value)
180180
return false;
181181
}
182182

183-
private int IndexOfUnquoted(string value, char c, int startIndex = 0)
183+
private int IndexOfUnquoted(string value, char c)
184184
{
185-
if (startIndex >= value.Length)
185+
var startIndex = 0;
186+
187+
while (true)
186188
{
187-
return -1;
188-
}
189+
var index = value.IndexOf(c, startIndex);
189190

190-
var index = value.IndexOf(c, startIndex);
191+
if (index < 0)
192+
{
193+
return -1;
194+
}
191195

192-
if (index >= 0)
193-
{
194196
var (startQuote, endQuote) = GetQuoteChars(Dialect);
195197
var startQuoteIndex = value.IndexOf(startQuote, startIndex);
196198

@@ -200,12 +202,13 @@ private int IndexOfUnquoted(string value, char c, int startIndex = 0)
200202

201203
if (endQuoteIndex >= index)
202204
{
203-
return IndexOfUnquoted(value, c, endQuoteIndex + 1);
205+
startIndex = endQuoteIndex + 1;
206+
continue;
204207
}
205208
}
206-
}
207209

208-
return index;
210+
return index;
211+
}
209212
}
210213

211214
private static (char startQuote, char endQuote) GetQuoteChars(ISqlDialect dialect)

0 commit comments

Comments
 (0)