Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::string_view for NodeTreeBase::create_node_anc() #906

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/dbtree/nodetreebase.cpp
Expand Up @@ -895,11 +895,11 @@ NODE* NodeTreeBase::create_node_link( const char* text, const int n, const char*
//
// アンカーノード作成
//
NODE* NodeTreeBase::create_node_anc( const char* text, const int n, const char* link, const int n_link,
NODE* NodeTreeBase::create_node_anc( std::string_view text, const char* link, const int n_link,
const int color_text, const bool bold,
const ANCINFO* ancinfo, const int lng_ancinfo, const char fontid )
{
NODE* tmpnode = create_node_link( text, n, link, n_link, color_text, bold, fontid );
NODE* tmpnode = create_node_link( text.data(), text.size(), link, n_link, color_text, bold, fontid );
if( tmpnode ){

tmpnode->linkinfo->ancinfo = m_heap.heap_alloc<ANCINFO>( lng_ancinfo + 1 );
Expand Down Expand Up @@ -2296,7 +2296,8 @@ void NodeTreeBase::parse_html( const char* str, const int lng, const int color_t
pos += n_in;
}

create_node_anc( tmpstr, lng_str, tmplink, lng_link, COLOR_CHAR_LINK, bold, ancinfo, lng_anc, fontid );
std::string_view tmp_view( tmpstr, lng_str );
create_node_anc( tmp_view, tmplink, lng_link, COLOR_CHAR_LINK, bold, ancinfo, lng_anc, fontid );

// forのところで++されるので--しておく
--pos;
Expand Down
2 changes: 1 addition & 1 deletion src/dbtree/nodetreebase.h
Expand Up @@ -305,7 +305,7 @@ namespace DBTREE
NODE* create_node_multispace( std::string_view text, const char fontid = FONT_MAIN );
NODE* create_node_htab();
NODE* create_node_link( const char* text, const int n, const char* link, const int n_link, const int color_text, const bool bold, const char fontid = FONT_MAIN );
NODE* create_node_anc( const char* text, const int n, const char* link, const int n_link,
NODE* create_node_anc( std::string_view text, const char* link, const int n_link,
const int color_text, const bool bold,
const ANCINFO* ancinfo, const int lng_ancinfo, const char fontid = FONT_MAIN );
NODE* create_node_sssp( const char* link, const int n_link );
Expand Down