[EDIT: Posting this again because the archive makes it look like it got
garbled.]
From the 'easy hacks' page it seemed that getting rid of warnings and flags
by tools like cppcheck was a goal.
Attached is a small patch that does nothing except eliminate one cppcheck
warning. It is contributed under the LGPL3+.
As I said, it does nothing different and, depending on the compiler, it
could even be less efficient. It does however make cppcheck happy.
Is this kind of thing useful?
diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c
index d6dc580..6958f88 100644
--- a/soltools/javadep/javadep.c
+++ b/soltools/javadep/javadep.c
@@ -603,9 +603,11 @@ xcalloc(size_t nmemb, size_t size)
void *
xrealloc(void *ptr, size_t size)
{
- ptr = realloc(ptr, size);
+ void *newptr = realloc(ptr, size);
- if ( !ptr )
+ if (!newptr)
+ ptr = newptr;
+ else
err_quit("out of memory");
return ptr;
Context
- [Libreoffice] [PATCH] Refactor to make cppcheck happy · Justin Malcolm
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.