diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-21 09:10:29 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-21 09:10:30 +0100 |
commit | 8e0c4694f89dd66314faf5cfd411f58f2f8e1bca (patch) | |
tree | 673a930c1c70741718f618c723cfdce3fe3ca02c | |
parent | 77c677a41d4bc9a2cd71ea1cc17e6c836387a6c5 (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.cxx | 7 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 4 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 11 |
3 files changed, 10 insertions, 12 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6b8f36984dc1..f2f90346a737 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -430,7 +430,7 @@ static void lo_destroy (LibreOfficeKit* pThis); static int lo_initialize (LibreOfficeKit* pThis, const char* pInstallPath, const char* pUserProfilePath); static LibreOfficeKitDocument* lo_documentLoad (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); @@ -1574,9 +1574,10 @@ static char* lo_getError (LibreOfficeKit *pThis) strcpy(pMemory, aString.getStr()); return pMemory; } -static void lo_freeError(const char *pfree) + +static void lo_freeError(char* pFree) { - free(const_cast<char *>(pfree)); + free(pFree); } static char* lo_getFilterTypes(LibreOfficeKit* pThis) diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 80f8451633ac..663f62034945 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -55,6 +55,8 @@ struct _LibreOfficeKitClass LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis, const char* pURL, const char* pOptions); + void (*freeError) (char* pFree); + #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY void (*registerCallback) (LibreOfficeKit* pThis, LibreOfficeKitCallback pCallback, @@ -63,7 +65,6 @@ struct _LibreOfficeKitClass /// @see lok::Office::getFilterTypes(). char* (*getFilterTypes) (LibreOfficeKit* pThis); #endif - void (*freeError) (const char *pfree); }; @@ -84,7 +85,6 @@ struct _LibreOfficeKitDocumentClass const char* pUrl, const char* pFormat, const char* pFilterOptions); - void (*freeError) (const char *pfree); #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY /// @see lok::Document::getDocumentType(). diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 5623fad8c0e2..ee2b27e92aff 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -56,10 +56,6 @@ public: /// Gives access to the underlying C pointer. inline LibreOfficeKitDocument *get() { return mpDoc; } - inline void freeError(const char *pfree) - { - mpDoc->pClass->freeError(pfree); - } #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY /** @@ -438,12 +434,13 @@ 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); } - #if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY /** * Returns details of filter types. |