Skip to content

Conversation

@andrjohns
Copy link
Contributor

Closes #453

@saghul
Copy link
Contributor

saghul commented Jul 1, 2024

Does this silence the warning?

diff --git a/cutils.h b/cutils.h
index 26436d4..6d0c994 100644
--- a/cutils.h
+++ b/cutils.h
@@ -484,6 +484,8 @@ uint64_t js__hrtime_ns(void);
 
 static inline size_t js__malloc_usable_size(const void *ptr)
 {
+    if (!ptr)
+        return 0;
 #if defined(__APPLE__)
     return malloc_size(ptr);
 #elif defined(_WIN32)

@andrjohns
Copy link
Contributor Author

Unfortunately not. If you want to experiment with other approaches you can also see the warning in action here: https://godbolt.org/z/jq15nWz5d

@saghul saghul merged commit b9de2b0 into quickjs-ng:master Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MacOS-specific -Werror=maybe-unitialised due to malloc_size signature

2 participants