projects
/
ldk-java
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update Result mapping to use new `_is_ok` function in the C bindings
[ldk-java]
/
java_strings.py
diff --git
a/java_strings.py
b/java_strings.py
index a83671db48a27c1d23cd9e3875d5736765afca88..327a1f3e60903550f59a7166bafcd58a2a47d169 100644
(file)
--- a/
java_strings.py
+++ b/
java_strings.py
@@
-103,9
+103,10
@@
public class version {
self.util_fn_pfx = """package org.ldk.structs;
import org.ldk.impl.bindings;
self.util_fn_pfx = """package org.ldk.structs;
import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
import java.util.Arrays;
import javax.annotation.Nullable;
import java.util.Arrays;
import javax.annotation.Nullable;
-import org.ldk.enums.*;
public class UtilMethods {
"""
public class UtilMethods {
"""
@@
-163,6
+164,7
@@
void __attribute__((constructor)) spawn_stderr_redirection() {
self.c_file_pfx = self.c_file_pfx + """#define MALLOC(a, _) malloc(a)
#define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
#define CHECK_ACCESS(p)
self.c_file_pfx = self.c_file_pfx + """#define MALLOC(a, _) malloc(a)
#define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
#define CHECK_ACCESS(p)
+#define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
"""
if not DEBUG:
self.c_file_pfx += """#define DO_ASSERT(a) (void)(a)
"""
if not DEBUG:
self.c_file_pfx += """#define DO_ASSERT(a) (void)(a)
@@
-319,7
+321,7
@@
void __wrap_free(void* ptr) {
__real_free(ptr);
}
__real_free(ptr);
}
-static void CHECK_ACCESS(void* ptr) {
+static void CHECK_ACCESS(
const
void* ptr) {
DO_ASSERT(!pthread_mutex_lock(&allocation_mtx));
allocation* it = allocation_ll;
while (it->ptr != ptr) {
DO_ASSERT(!pthread_mutex_lock(&allocation_mtx));
allocation* it = allocation_ll;
while (it->ptr != ptr) {
@@
-336,6
+338,13
@@
static void CHECK_ACCESS(void* ptr) {
}
DO_ASSERT(!pthread_mutex_unlock(&allocation_mtx));
}
}
DO_ASSERT(!pthread_mutex_unlock(&allocation_mtx));
}
+#define CHECK_INNER_FIELD_ACCESS_OR_NULL(v) \\
+ if (v.is_owned && v.inner != NULL) { \\
+ const void *p = __unmangle_inner_ptr(v.inner); \\
+ if (p != NULL) { \\
+ CHECK_ACCESS(p); \\
+ } \\
+ }
void* __real_realloc(void* ptr, size_t newlen);
void* __wrap_realloc(void* ptr, size_t len) {
void* __real_realloc(void* ptr, size_t newlen);
void* __wrap_realloc(void* ptr, size_t len) {