summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-21 09:10:29 +0100
committerVasily Melenchuk <Vasily.Melenchuk@cib.de>2017-09-19 14:19:16 +0300
commit86e2fdc963276af9e99cc65e889a3e6b72bf779d (patch)
tree2d709ef74bf779ca72e1e2c97a66ebf355f938b9
parent912fd5046410f1f32f7273155d9ce17450a2df6d (diff)
Clean up lok::Office::freeError()
- let it take a non-const pointer, just like free() or g_free() does - remove lok::Document::freeError(), which was declared, but not implemented - move the declaration at the end of the stable API, but before the unstable section Change-Id: I5a8ced61fc87641dc2fa0ea3615a350361fae3a1
-rw-r--r--desktop/source/lib/init.cxx4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h6
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx12
3 files changed, 10 insertions, 12 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ff156399926f..fc957bf2effb 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -300,7 +300,7 @@ static int lo_initialize (LibreOfficeKit* pThis, const ch
static LibreOfficeKitDocument* lo_documentLoad (LibreOfficeKit* pThis, const char* pURL);
static bool lo_runMacro (LibreOfficeKit* pThis, const char* pURL);
static char * lo_getError (LibreOfficeKit* pThis);
-static void lo_freeError (const char *pfree);
+static void lo_freeError (char* pFree);
static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThis,
const char* pURL,
const char* pOptions);
@@ -974,7 +974,7 @@ static char* lo_getError (LibreOfficeKit *pThis)
return pMemory;
}
-static void lo_freeError(const char *pfree)
+static void lo_freeError(char *pfree)
{
free((void *) pfree);
}
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index ad453ef37ab3..c8611f7a6bbd 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -50,14 +50,15 @@ struct _LibreOfficeKitClass
LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
const char* pURL,
const char* pOptions);
-#ifdef LOK_USE_UNSTABLE_API
+ void (*freeError) (char* pFree);
+
+#if defined LOK_USE_UNSTABLE_API
void (*registerCallback) (LibreOfficeKit* pThis,
LibreOfficeKitCallback pCallback,
void* pData);
bool (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
#endif
- void (*freeError) (const char *pfree);
};
@@ -78,7 +79,6 @@ struct _LibreOfficeKitDocumentClass
const char* pUrl,
const char* pFormat,
const char* pFilterOptions);
- void (*freeError) (const char *pfree);
#ifdef LOK_USE_UNSTABLE_API
/// @see lok::Document::getDocumentType().
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 060158d08800..9621e5090c67 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -247,10 +247,6 @@ public:
mpDoc->pClass->resetSelection(mpDoc);
}
#endif // LOK_USE_UNSTABLE_API
- inline void freeError(const char *pfree)
- {
- mpDoc->pClass->freeError(pfree);
- }
};
/// The lok::Office class represents one started LibreOfficeKit instance.
@@ -296,12 +292,14 @@ public:
{
return mpThis->pClass->getError(mpThis);
}
- inline void freeError(const char *pfree)
+
+ /// Frees the memory pointed to by pFree.
+ inline void freeError(char* pFree)
{
- mpThis->pClass->freeError(pfree);
+ mpThis->pClass->freeError(pFree);
}
-#ifdef LOK_USE_UNSTABLE_API
+#if defined LOK_USE_UNSTABLE_API
/**
* Run a macro.
*