diff options
author | Mathias Hasselmann <mathias@openismus.com> | 2013-03-08 11:14:09 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-03-08 13:52:36 +0000 |
commit | e3645fad6b2ea48851bcf6fdfb895ced74a6d8cb (patch) | |
tree | 3031060f2a877495b405410e418b23d8b2f0b249 /connectivity | |
parent | make link RefButton and widget for shrunk dialog title explicit (diff) | |
download | core-e3645fad6b2ea48851bcf6fdfb895ced74a6d8cb.tar.gz core-e3645fad6b2ea48851bcf6fdfb895ced74a6d8cb.zip |
evoab2: Avoid G_N_ELEMENTS when loading symbols
With G_N_ELEMENTS() the array name has to be twice, which can cause
hard to spot typos in code derived from copy-and-paste, as we have
here in the module loader. C++ can avoid the duplication by using
the proper templates.
Change-Id: I485e28a92e74b7e24f4a59cced6e5635f3a53a38
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/evoab2/EApi.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx index 608b1f9f5452..8e0d0dbd9433 100644 --- a/connectivity/source/drivers/evoab2/EApi.cxx +++ b/connectivity/source/drivers/evoab2/EApi.cxx @@ -95,10 +95,10 @@ static ApiMap aNewApiMap[] = }; #undef SYM_MAP -static bool -tryLink( oslModule &aModule, const char *pName, ApiMap *pMap, guint nEntries ) +template<size_t N> static bool +tryLink( oslModule &aModule, const char *pName, const ApiMap (&pMap)[N]) { - for (guint i = 0; i < nEntries; ++i) + for (guint i = 0; i < N; ++i) { SymbolFunc aMethod = (SymbolFunc)osl_getFunctionSymbol (aModule, OUString::createFromAscii ( pMap[ i ].sym_name ).pData); @@ -124,14 +124,14 @@ bool EApiInit() SAL_LOADMODULE_DEFAULT ); if( aModule) { - if (tryLink( aModule, eBookLibNames[ j ], aCommonApiMap, G_N_ELEMENTS(aCommonApiMap))) + if (tryLink( aModule, eBookLibNames[ j ], aCommonApiMap)) { if (eds_check_version(3, 6, 0) == NULL) { - if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap, G_N_ELEMENTS(aNewApiMap))) + if (tryLink( aModule, eBookLibNames[ j ], aNewApiMap)) return true; } - else if (tryLink( aModule, eBookLibNames[ j ], aOldApiMap, G_N_ELEMENTS(aOldApiMap))) + else if (tryLink( aModule, eBookLibNames[ j ], aOldApiMap)) { return true; } |