@@ -209,7 +209,7 @@ inline size_t isNewline(std::string_view data)
209209 // normal newline
210210 if (data[0 ] == ' \n ' ) return 1 ;
211211 // artificial new line from ^^ in ALIASES
212- if (data[ 0 ] == ' \\ ' && qstrncmp (data. data ()+ 1 , " ilinebr " , 7 )== 0 ) return data[ 8 ]== ' ' ? 9 : 8 ;
212+ if (literal_at (data, " \\ ilinebr " ) ) return 8 ;
213213 return 0 ;
214214}
215215
@@ -551,10 +551,7 @@ size_t Markdown::Private::isSpecialCommand(std::string_view data,size_t offset)
551551 // skip over name (and optionally type)
552552 while (offset_<data_.size () && (c=data_[offset_])!=' \n ' && (allowSpaces || c!=' ' ) && c!=' (' )
553553 {
554- if (offset_+9 <data_.size () && data_[offset_]==' \\ ' )
555- {
556- if (qstrncmp (&data_[offset_+1 ]," ilinebr " ,8 )==0 ) break ;
557- }
554+ if (literal_at (data_.substr (offset_)," \\ ilinebr " )) break ;
558555 offset_++;
559556 }
560557 if (c==' (' ) // find the end of the function
@@ -959,13 +956,13 @@ int Markdown::Private::processNmdash(std::string_view data,size_t offset)
959956 {
960957 count++;
961958 }
962- if (count>=2 && offset>=2 && qstrncmp (data.data ()-2 ," <!" , 2 )== 0 )
959+ if (count>=2 && offset>=2 && literal_at (data.data ()-2 ," <!" ) )
963960 { AUTO_TRACE_EXIT (" result={}" ,1 -count); return 1 -count; } // start HTML comment
964961 if (count==2 && size > 2 && data[2 ]==' >' )
965962 { return 0 ; } // end HTML comment
966963 if (count==3 && size > 3 && data[3 ]==' >' )
967964 { return 0 ; } // end HTML comment
968- if (count==2 && (offset<8 || qstrncmp (data.data ()-8 ," operator" , 8 )!= 0 )) // -- => ndash
965+ if (count==2 && (offset<8 || ! literal_at (data.data ()-8 ," operator" ) )) // -- => ndash
969966 {
970967 out+=" –" ;
971968 AUTO_TRACE_EXIT (" result=2" );
@@ -2890,15 +2887,15 @@ bool skipOverFileAndLineCommands(std::string_view data,size_t indent,size_t &off
28902887 size_t i = offset;
28912888 size_t size = data.size ();
28922889 while (i<data.size () && data[i]==' ' ) i++;
2893- if (i<size+ 8 && data[i]== ' \\ ' && qstrncmp (& data[i+ 1 ], " ifile \" " , 7 )== 0 )
2890+ if (literal_at ( data. substr (i), " \\ ifile \" " ) )
28942891 {
28952892 size_t locStart = i;
28962893 if (i>offset) locStart--; // include the space before \ifile
28972894 i+=8 ;
28982895 bool found=false ;
28992896 while (i+9 <size && data[i]!=' \n ' )
29002897 {
2901- if (data[i]== ' \\ ' && qstrncmp (& data[i+ 1 ], " ilinebr " , 8 )== 0 )
2898+ if (literal_at ( data. substr (i), " \\ ilinebr " ) )
29022899 {
29032900 found=true ;
29042901 break ;
@@ -3459,7 +3456,7 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34593456 {
34603457 i++;
34613458 }
3462- if (i+ 5 <size && data[i]== ' < ' && qstrncmp (& data[i] ," <!--!" , 5 )== 0 ) // skip over <!--! marker
3459+ if (literal_at ( data. substr (i) ," <!--!" ) ) // skip over <!--! marker
34633460 {
34643461 i+=5 ;
34653462 while (i<size && (data[i]==' ' || data[i]==' \n ' )) // skip over spaces after the <!--! marker
@@ -3469,10 +3466,10 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34693466 }
34703467 if (i+1 <size &&
34713468 (data[i]==' \\ ' || data[i]==' @' ) &&
3472- (qstrncmp (& data[ i+1 ] ," page " , 5 )== 0 || qstrncmp (& data[ i+1 ] ," mainpage" , 8 )== 0 )
3469+ (literal_at ( data. substr ( i+1 ) ," page " ) || literal_at ( data. substr ( i+1 ) ," mainpage" ) )
34733470 )
34743471 {
3475- if (qstrncmp (& data[ i+1 ] ," page " , 5 )== 0 )
3472+ if (literal_at ( data. substr ( i+1 ) ," page " ) )
34763473 {
34773474 AUTO_TRACE_EXIT (" result=ExplicitPageResult::explicitPage" );
34783475 return ExplicitPageResult::explicitPage;
@@ -3485,7 +3482,7 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34853482 }
34863483 else if (i+1 <size &&
34873484 (data[i]==' \\ ' || data[i]==' @' ) &&
3488- (qstrncmp (& data[ i+1 ] ," dir\n " , 4 )== 0 || qstrncmp (& data[ i+1 ] ," dir " , 4 )== 0 )
3485+ (literal_at ( data. substr ( i+1 ) ," dir\n " ) || literal_at ( data. substr ( i+1 ) ," dir " ) )
34893486 )
34903487 {
34913488 AUTO_TRACE_EXIT (" result=ExplicitPageResult::explicitDirPage" );
@@ -3588,7 +3585,7 @@ QCString Markdown::process(const QCString &input, int &startNewlines, bool fromP
35883585 {
35893586 while (*p==' ' ) p++; // skip over spaces
35903587 while (*p==' \n ' ) {startNewlines++;p++;}; // skip over newlines
3591- if (qstrncmp (p," <br>" , 4 )== 0 ) p+=4 ; // skip over <br>
3588+ if (literal_at (p," <br>" ) ) p+=4 ; // skip over <br>
35923589 }
35933590 if (p>result.data ())
35943591 {
0 commit comments