summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-03-10 19:21:15 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-03-10 21:42:31 +0100
commit8e9a7cac42d554402a6ead3a83ae8b7defc9247b (patch)
tree9905516c3e7ca3cc6de020e8cc36d84adb650a29
parent8546831b3b36e29c1ee42b790cbecd3fd8d8bbaf (diff)
No more need for jfw_freeJavaInfo
Change-Id: I2426a76936b4099a243ce8c102da867e7868aac3
-rw-r--r--cui/source/options/optjava.cxx10
-rw-r--r--desktop/source/migration/services/jvmfwk.cxx2
-rw-r--r--include/jvmfwk/framework.hxx19
-rw-r--r--jvmfwk/inc/vendorplugin.hxx7
-rw-r--r--jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx2
-rw-r--r--jvmfwk/source/framework.cxx22
-rw-r--r--stoc/source/javavm/javavm.cxx6
7 files changed, 26 insertions, 42 deletions
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 57e4dedd20da..fadea8823022 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -214,7 +214,7 @@ void SvxJavaOptionsPage::dispose()
for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
{
JavaInfo* pInfo = *pIter;
- jfw_freeJavaInfo( pInfo );
+ delete pInfo;
}
m_aAddedInfos.clear();
@@ -442,7 +442,7 @@ void SvxJavaOptionsPage::ClearJavaInfo()
for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
{
JavaInfo* pInfo = *parInfo++;
- jfw_freeJavaInfo( pInfo );
+ delete pInfo;
}
rtl_freeMemory( m_parJavaInfo );
@@ -508,7 +508,7 @@ void SvxJavaOptionsPage::LoadJREs()
}
}
- jfw_freeJavaInfo( pSelectedJava );
+ delete pSelectedJava;
#else
(void) this;
#endif
@@ -602,7 +602,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
nPos = m_pJavaList->GetEntryCount() - 1;
}
else
- jfw_freeJavaInfo( pInfo );
+ delete pInfo;
SvTreeListEntry* pEntry = m_pJavaList->GetEntry( nPos );
m_pJavaList->Select( pEntry );
@@ -722,7 +722,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
bModified = true;
}
}
- jfw_freeJavaInfo( pSelectedJava );
+ delete pSelectedJava;
break;
}
}
diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx
index 1529b3d5e9fa..8be315f15de7 100644
--- a/desktop/source/migration/services/jvmfwk.cxx
+++ b/desktop/source/migration/services/jvmfwk.cxx
@@ -73,7 +73,7 @@ CJavaInfo::CJavaInfo(): pData(nullptr)
CJavaInfo::~CJavaInfo()
{
- jfw_freeJavaInfo(pData);
+ delete pData;
}
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 184b2c19b439..e88ae4be0b15 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -208,9 +208,7 @@ typedef enum _javaFrameworkError
<p>
Instances of this struct are created by the plug-in libraries which are used by
- this framework (jvmfwk/vendorplugin.h).
- For convenience this API provides the function <code>jfw_freeJavaInfo</code>
- which frees the objects properly. </p>
+ this framework (jvmfwk/vendorplugin.h).</p>
*/
struct JavaInfo
{
@@ -257,13 +255,6 @@ struct JavaInfo
rtl::ByteSequence arVendorData;
};
-/** frees the memory of a <code>JavaInfo</code> object.
- @param pInfo
- The object which is to be freed. It can be NULL;
- */
-JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
-
-
/** compares two <code>JavaInfo</code> objects for equality.
<p>Two <code>JavaInfo</code> objects are said to be equal if the contained
@@ -362,7 +353,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_isVMRunning(sal_Bool *bRunning);
@param ppInfo
[out] a <code>JavaInfo</code> pointer, representing the selected JRE.
- The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
+ The caller has to delete it. The
<code>JavaInfo</code> is for informational purposes only. It is not
necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
<code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
@@ -393,7 +384,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo);
[out] on returns it contains a pointer to an array of <code>JavaInfo</code>
pointers.
The caller must free the array with <code>rtl_freeMemory</code> and each
- element of the array must be freed with <code>jfw_freeJavaInfo</code>.
+ element of the array must be deleted.
@param pSize
[out] on return contains the size of array returned in <code>parInfo</code>.
@@ -750,8 +741,8 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool
should be called. That is, <code>jfw_startVM</code> which uses the
settings cannot be called before all settings have be made.</p>
<p>
- The only functions which are not effected by <code>jfw_lock</code> are
- <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
+ The only functions which is not effected by <code>jfw_lock</code> is
+ <code>jfw_areEqualJavaInfo</code>.
*/
JVMFWK_DLLPUBLIC void jfw_lock();
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index a108cb3c5b4a..0bd5988301d6 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -73,8 +73,8 @@ typedef enum
version should be the first in the array. </p>
<p>
The function allocates memory for an array and all the JavaInfo objects returned
- in <code>parJavaInfo</code>. The caller must free each JavaInfo object by calling
- <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx"). The array is to be
+ in <code>parJavaInfo</code>. The caller must delete each JavaInfo object.
+ The array is to be
freed by rtl_freeMemory.
In case an error occurred <code>parJavaInfo</code> need not be freed.
</p>
@@ -217,8 +217,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
is also the first element in the vector.</p>
<p>
The function allocates memory for all the JavaInfo objects returned
- in <code>vecJavaInfosFromPath</code>. The caller must free each JavaInfo object by calling
- <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx").
+ in <code>vecJavaInfosFromPath</code>. The caller must delete each JavaInfo object.
</p>
@param vecVendorInfos
[in] vector specifying the vendor and version requirements that the JRE must fulfill.
diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
index 748b7d7d45d4..ea2f846e9f25 100644
--- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
+++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
@@ -97,7 +97,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData);
fprintf(stdout, "%s\n", sPaths.getStr());
- jfw_freeJavaInfo(pInfo);
+ delete pInfo;
}
catch (const std::exception&)
{
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 6f9c45584d94..88658a18175f 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -427,7 +427,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
{
bInfoFound = true;
}
- jfw_freeJavaInfo(pHomeInfo);
+ delete pHomeInfo;
}
// if no Java installation providing all features was detected by using JAVA_HOME,
@@ -460,7 +460,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
aCurrentInfo = pJInfo;
}
- jfw_freeJavaInfo(pJInfo);
+ delete pJInfo;
}
++it;
}
@@ -529,7 +529,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
//The array returned by jfw_plugin_getAllJavaInfos must be freed as well as
//its contents
for (int j = 0; j < cInfos; j++)
- jfw_freeJavaInfo(arInfos[j]);
+ delete arInfos[j];
rtl_freeMemory(arInfos);
if (bInfoFound)
@@ -642,12 +642,6 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
return false;
}
-
-void jfw_freeJavaInfo(JavaInfo *pInfo)
-{
- delete pInfo;
-}
-
javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo)
{
javaFrameworkError errcode = JFW_E_NONE;
@@ -805,7 +799,7 @@ javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo)
jfw::setJavaSelected();
}
- jfw_freeJavaInfo(currentInfo);
+ delete currentInfo;
}
catch (const jfw::FrameworkException& e)
{
@@ -1051,7 +1045,7 @@ CJavaInfo CJavaInfo::createWrapper(::JavaInfo* info)
}
void CJavaInfo::attach(::JavaInfo * info)
{
- jfw_freeJavaInfo(pInfo);
+ delete pInfo;
pInfo = info;
}
::JavaInfo * CJavaInfo::detach()
@@ -1063,7 +1057,7 @@ void CJavaInfo::attach(::JavaInfo * info)
CJavaInfo::~CJavaInfo()
{
- jfw_freeJavaInfo(pInfo);
+ delete pInfo;
}
@@ -1085,7 +1079,7 @@ CJavaInfo & CJavaInfo::operator = (const CJavaInfo& info)
if (&info == this)
return *this;
- jfw_freeJavaInfo(pInfo);
+ delete pInfo;
pInfo = copyJavaInfo(info.pInfo);
return *this;
}
@@ -1094,7 +1088,7 @@ CJavaInfo & CJavaInfo::operator = (const ::JavaInfo* info)
if (info == pInfo)
return *this;
- jfw_freeJavaInfo(pInfo);
+ delete pInfo;
pInfo = copyJavaInfo(info);
return *this;
}
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 78ac585a8b7b..ab72925cbefb 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -662,10 +662,10 @@ namespace {
struct JavaInfoGuard: private boost::noncopyable {
JavaInfoGuard(): info(nullptr) {}
- ~JavaInfoGuard() { jfw_freeJavaInfo(info); }
+ ~JavaInfoGuard() { delete info; }
void clear() {
- jfw_freeJavaInfo(info);
+ delete info;
info = nullptr;
}
@@ -836,7 +836,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
}
}
- jfw_freeJavaInfo(pJavaInfo);
+ delete pJavaInfo;
//Error: %PRODUCTNAME requires a Java
//runtime environment (JRE) to perform this task. The selected JRE