summaryrefslogtreecommitdiff
path: root/ext/fiddle
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fiddle')
-rw-r--r--ext/fiddle/closure.c11
-rw-r--r--ext/fiddle/function.c7
-rw-r--r--ext/fiddle/handle.c2
-rw-r--r--ext/fiddle/pointer.c2
4 files changed, 10 insertions, 12 deletions
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index 2263b41..f19091b 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -41,14 +41,13 @@ closure_memsize(const void * ptr)
fiddle_closure * cls = (fiddle_closure *)ptr;
size_t size = 0;
- if (ptr) {
- size += sizeof(*cls);
+ size += sizeof(*cls);
#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API
- size += ffi_raw_size(&cls->cif);
+ size += ffi_raw_size(&cls->cif);
#endif
- size += sizeof(*cls->argv);
- size += sizeof(ffi_closure);
- }
+ size += sizeof(*cls->argv);
+ size += sizeof(ffi_closure);
+
return size;
}
diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c
index 164e5f3..f657d29 100644
--- a/ext/fiddle/function.c
+++ b/ext/fiddle/function.c
@@ -38,12 +38,11 @@ function_memsize(const void *p)
/* const */ffi_cif *ptr = (ffi_cif *)p;
size_t size = 0;
- if (ptr) {
- size += sizeof(*ptr);
+ size += sizeof(*ptr);
#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API
- size += ffi_raw_size(ptr);
+ size += ffi_raw_size(ptr);
#endif
- }
+
return size;
}
diff --git a/ext/fiddle/handle.c b/ext/fiddle/handle.c
index 2f93f23..4104421 100644
--- a/ext/fiddle/handle.c
+++ b/ext/fiddle/handle.c
@@ -46,7 +46,7 @@ fiddle_handle_free(void *ptr)
static size_t
fiddle_handle_memsize(const void *ptr)
{
- return ptr ? sizeof(struct dl_handle) : 0;
+ return sizeof(struct dl_handle);
}
static const rb_data_type_t fiddle_handle_data_type = {
diff --git a/ext/fiddle/pointer.c b/ext/fiddle/pointer.c
index a09daf7..932bc57 100644
--- a/ext/fiddle/pointer.c
+++ b/ext/fiddle/pointer.c
@@ -72,7 +72,7 @@ static size_t
fiddle_ptr_memsize(const void *ptr)
{
const struct ptr_data *data = ptr;
- return data ? sizeof(*data) + data->size : 0;
+ return sizeof(*data) + data->size;
}
static const rb_data_type_t fiddle_ptr_data_type = {