projects
/
platform
/
upstream
/
libgc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7e81c1d
)
Eliminate 'suspicious pointer subtraction' cppcheck warning (gc_cpp)
author
Ivan Maidanski
<ivmai@mail.ru>
Wed, 26 Oct 2016 08:13:29 +0000
(11:13 +0300)
committer
Ivan Maidanski
<ivmai@mail.ru>
Wed, 26 Oct 2016 08:13:48 +0000
(11:13 +0300)
* include/gc_cpp.h (gc_cleanup::gc_cleanup): Define this_ptr void
pointer; use this_ptr instead of this keyword to outline that the
pointer subtraction is intentional (i.e., "this->" was not intended).
include/gc_cpp.h
patch
|
blob
|
history
diff --git
a/include/gc_cpp.h
b/include/gc_cpp.h
index
b0ab260
..
9110633
100644
(file)
--- a/
include/gc_cpp.h
+++ b/
include/gc_cpp.h
@@
-428,11
+428,12
@@
inline gc_cleanup::gc_cleanup()
{
GC_finalization_proc oldProc;
void* oldData;
- void* base = GC_base((void*) this);
+ void* this_ptr = (void*)this;
+ void* base = GC_base(this_ptr);
if (base != 0) {
// Don't call the debug version, since this is a real base address.
GC_register_finalizer_ignore_self(base, (GC_finalization_proc) cleanup,
- (void*)
((char*) this - (char*)
base),
+ (void*)
((char*)this_ptr - (char*)
base),
&oldProc, &oldData);
if (oldProc != 0) {
GC_register_finalizer_ignore_self(base, oldProc, oldData, 0, 0);