Refactoring to reduce nesting

pull/6753/head
Gokhan Gulbiz 2023-03-16 11:02:52 +03:00
parent ae276e70ab
commit de527dbb71
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
1 changed files with 13 additions and 11 deletions

View File

@ -621,18 +621,20 @@ ExtractTopComment(const char *inputString)
int commentEndCharsIndex = 0;
/* If query starts with a comment */
if (inputString[commentEndCharsIndex] == '/' &&
inputString[commentEndCharsIndex + 1] == '*')
/* If query doesn't start with a comment, return NULL */
if (inputString[commentEndCharsIndex] != '/' ||
inputString[commentEndCharsIndex + 1] != '*')
{
/* Skip the comment start characters */
commentEndCharsIndex += commentStartCharsLength;
while (commentEndCharsIndex < inputStringLen &&
!(inputString[commentEndCharsIndex] == '*' &&
inputString [commentEndCharsIndex + 1] == '/'))
{
commentEndCharsIndex++;
}
return NULL;
}
/* Skip the comment start characters */
commentEndCharsIndex += commentStartCharsLength;
while (commentEndCharsIndex < inputStringLen &&
!(inputString[commentEndCharsIndex] == '*' &&
inputString [commentEndCharsIndex + 1] == '/'))
{
commentEndCharsIndex++;
}
if (commentEndCharsIndex > commentStartCharsLength)