reuse existing tokennames instead of including duplicate
nm -S --size-sort --print-size instdir/program/libmergedlo.so| grep ' [Dd] ' | c++filt | tail -n 10
before:
... 0000000000002790 d STR_ARR_SVT_LANGUAGE_TABLE
... 00000000000027a8 d RID_STRLIST_FUNCTION_NAMES
... 00000000000027f0 d aFmFormShellSlots_Impl
... 0000000000002920 d pRGBTable
... 0000000000003b80 d vcl::pdf::BuildinFontFace::m_aBuildinFonts
... 0000000000004140 d C.16.0
... 0000000000004d80 d (anonymous namespace)::aMethods
... 00000000000066a8 d aRTFTokenTab
... 000000000000cf60 d xmloff::token::getNames(int)::{lambda()#1}::operator()() const::sppcTokenNames
... 00000000000172c0 d oox::TokenMap::getUtf8TokenName(int)::{lambda()#1}::operator()() const::sppcTokenNames
after:
... 0000000000002058 d abasctl_ShellSlots_Impl
... 0000000000002448 d oox::aPrstLightRigValuesArray
... 0000000000002790 d STR_ARR_SVT_LANGUAGE_TABLE
... 00000000000027a8 d RID_STRLIST_FUNCTION_NAMES
... 00000000000027f0 d aFmFormShellSlots_Impl
... 0000000000002920 d pRGBTable
... 0000000000003b80 d vcl::pdf::BuildinFontFace::m_aBuildinFonts
... 0000000000004140 d C.16.0
... 0000000000004d80 d (anonymous namespace)::aMethods
... 00000000000066a8 d aRTFTokenTab
Change-Id: Iaecc42395910794cb52a77f3d9feff04a6fc8bcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187601
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
@@ -176,9 +176,6 @@ excludelist:
|
|||||||
# Auto-generated C array of transitional and strict namespace names
|
# Auto-generated C array of transitional and strict namespace names
|
||||||
- namespacenames.inc
|
- namespacenames.inc
|
||||||
- namespaces-strictnames.inc
|
- namespaces-strictnames.inc
|
||||||
oox/source/token/tokenmap.cxx:
|
|
||||||
# Auto-generated C array of token names
|
|
||||||
- tokennames.inc
|
|
||||||
oox/source/vml/vmlinputstream.cxx:
|
oox/source/vml/vmlinputstream.cxx:
|
||||||
# Needed for direct member access
|
# Needed for direct member access
|
||||||
- com/sun/star/io/XTextInputStream2.hpp
|
- com/sun/star/io/XTextInputStream2.hpp
|
||||||
|
|||||||
@@ -58,21 +58,19 @@ css::uno::Sequence<sal_Int8> const& TokenMap::getUtf8TokenName(sal_Int32 nToken)
|
|||||||
{
|
{
|
||||||
static const auto saTokenNames = []()
|
static const auto saTokenNames = []()
|
||||||
{
|
{
|
||||||
static constexpr std::string_view sppcTokenNames[] = {
|
static_assert(std::size(wordlist) == XML_TOKEN_COUNT);
|
||||||
// include auto-generated C array with token names as C strings
|
|
||||||
#include <tokennames.inc>
|
std::vector<css::uno::Sequence<sal_Int8>> aTokenNames(std::size(wordlist));
|
||||||
};
|
for (const auto& resword : wordlist)
|
||||||
static_assert(std::size(sppcTokenNames) == XML_TOKEN_COUNT);
|
{
|
||||||
|
const char *s = reinterpret_cast<const char*>(&stringpool_contents) + resword.name;
|
||||||
|
std::string_view aUtf8Token(s, strlen(s));
|
||||||
|
|
||||||
|
aTokenNames[resword.nToken] =
|
||||||
|
css::uno::Sequence<sal_Int8>(
|
||||||
|
reinterpret_cast<const sal_Int8*>(aUtf8Token.data()), aUtf8Token.size());
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<css::uno::Sequence<sal_Int8>> aTokenNames;
|
|
||||||
aTokenNames.reserve(std::size(sppcTokenNames));
|
|
||||||
std::transform(
|
|
||||||
std::begin(sppcTokenNames), std::end(sppcTokenNames), std::back_inserter(aTokenNames),
|
|
||||||
[](auto aUtf8Token)
|
|
||||||
{
|
|
||||||
return css::uno::Sequence<sal_Int8>(
|
|
||||||
reinterpret_cast<const sal_Int8*>(aUtf8Token.data()), aUtf8Token.size());
|
|
||||||
});
|
|
||||||
return aTokenNames;
|
return aTokenNames;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ $(eval $(call gb_CustomTarget_generate_tokens,xmloff/generated,xmloff,xmloff/sou
|
|||||||
|
|
||||||
$(call gb_CustomTarget_get_target,xmloff/generated) : \
|
$(call gb_CustomTarget_get_target,xmloff/generated) : \
|
||||||
$(xmloff_INC)/tokenhash.inc \
|
$(xmloff_INC)/tokenhash.inc \
|
||||||
$(xmloff_INC)/tokennames.inc \
|
|
||||||
$(xmloff_GENHEADERPATH)/tokens.hxx \
|
$(xmloff_GENHEADERPATH)/tokens.hxx \
|
||||||
|
|
||||||
# vim: set noet sw=4 ts=4:
|
# vim: set noet sw=4 ts=4:
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ excludelist:
|
|||||||
xmloff/source/xforms/XFormsModelExport.hxx:
|
xmloff/source/xforms/XFormsModelExport.hxx:
|
||||||
# Needed for css shortcut
|
# Needed for css shortcut
|
||||||
- sal/types.h
|
- sal/types.h
|
||||||
xmloff/source/core/fasttokenhandler.cxx:
|
|
||||||
# Needed for special array initialization
|
|
||||||
- tokennames.inc
|
|
||||||
xmloff/source/chart/SchXMLCalculationSettingsContext.cxx:
|
xmloff/source/chart/SchXMLCalculationSettingsContext.cxx:
|
||||||
# Complete type is needed
|
# Complete type is needed
|
||||||
- com/sun/star/frame/XModel.hpp
|
- com/sun/star/frame/XModel.hpp
|
||||||
|
|||||||
@@ -46,22 +46,20 @@ static const std::pair<css::uno::Sequence<sal_Int8>, OUString>& getNames(sal_Int
|
|||||||
{
|
{
|
||||||
static const auto saTokenNames = []()
|
static const auto saTokenNames = []()
|
||||||
{
|
{
|
||||||
static constexpr std::string_view sppcTokenNames[] = {
|
static_assert(std::size(wordlist) == XML_TOKEN_COUNT);
|
||||||
#include <tokennames.inc>
|
|
||||||
};
|
|
||||||
static_assert(std::size(sppcTokenNames) == XML_TOKEN_COUNT);
|
|
||||||
|
|
||||||
std::vector<std::pair<css::uno::Sequence<sal_Int8>, OUString>> names;
|
std::vector<std::pair<css::uno::Sequence<sal_Int8>, OUString>> names(std::size(wordlist));
|
||||||
names.reserve(std::size(sppcTokenNames));
|
|
||||||
std::transform(std::begin(sppcTokenNames), std::end(sppcTokenNames),
|
for (const auto& resword : wordlist)
|
||||||
std::back_inserter(names),
|
{
|
||||||
[](auto token)
|
const char *s = reinterpret_cast<const char*>(&stringpool_contents) + resword.name;
|
||||||
{
|
std::string_view token(s, strlen(s));
|
||||||
return std::make_pair(
|
|
||||||
css::uno::Sequence<sal_Int8>(
|
names[resword.nToken].first =
|
||||||
reinterpret_cast<const sal_Int8*>(token.data()), token.size()),
|
css::uno::Sequence<sal_Int8>(
|
||||||
OStringToOUString(token, RTL_TEXTENCODING_UTF8));
|
reinterpret_cast<const sal_Int8*>(token.data()), token.size());
|
||||||
});
|
names[resword.nToken].second = OStringToOUString(token, RTL_TEXTENCODING_UTF8);
|
||||||
|
};
|
||||||
return names;
|
return names;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user