Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backports #129 to lablgtk2 #130

Merged
merged 1 commit into from
Jul 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ml_glib.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ CAMLprim value Val_GList (GList *list, value (*func)(gpointer))
Field(new_cell,0) = result;
Field(new_cell,1) = Val_unit;
if (last_cell == Val_unit) cell = new_cell;
else modify(&Field(last_cell,1), new_cell);
else caml_modify(&Field(last_cell,1), new_cell);
last_cell = new_cell;
list = list->next;
}
Expand Down Expand Up @@ -427,7 +427,7 @@ CAMLprim value Val_GSList (GSList *list, value (*func)(gpointer))
Field(new_cell,0) = result;
Field(new_cell,1) = Val_unit;
if (last_cell == Val_unit) cell = new_cell;
else modify(&Field(last_cell,1), new_cell);
else caml_modify(&Field(last_cell,1), new_cell);
last_cell = new_cell;
list = list->next;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ml_gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ CAMLprim value ml_gtk_init (value argv)
}

argv = (argc ? alloc (argc, 0) : Atom(0));
for (i = 0; i < argc; i++) modify(&Field(argv,i), Field(copy,i));
for (i = 0; i < argc; i++) caml_modify(&Field(argv,i), Field(copy,i));
CAMLreturn (argv);
}
ML_0 (gtk_set_locale, Val_string)
Expand Down
4 changes: 2 additions & 2 deletions src/ml_gtktree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,8 +1487,8 @@ CAMLprim value ml_register_custom_model_callback_object(value custom_model,
GObject *obj = GObject_val(custom_model);
g_return_val_if_fail (IS_CUSTOM_MODEL (obj),Val_unit);
if(Is_block(callback_object) &&
(char*)callback_object < (char*)young_end &&
(char*)callback_object > (char*)young_start)
(char*)callback_object < (char*)caml_young_end &&
(char*)callback_object > (char*)caml_young_start)
{
caml_register_global_root (&callback_object);
caml_minor_collection();
Expand Down
10 changes: 5 additions & 5 deletions src/wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <caml/custom.h>
#include <caml/minor_gc.h>
#define Is_young_block(v) \
(Is_block(v) && (value*)(v) < young_end && (value*)(v) > young_start)
(Is_block(v) && (value*)(v) < caml_young_end && (value*)(v) > caml_young_start)

#ifndef Bytes_val
#define Bytes_val String_val
Expand Down Expand Up @@ -286,7 +286,7 @@ CAMLprim value cname##_bc (value *argv, int argn) \
else if (l <= Max_young_wosize) { int i; ret = alloc_tuple(l); \
for(i=0;i<l;i++) Field(ret,i) = conv(src[i]); } \
else { int i; ret = alloc_shr(l,0); \
for(i=0;i<l;i++) initialize (&Field(ret,i), conv(src[i])); }
for(i=0;i<l;i++) caml_initialize (&Field(ret,i), conv(src[i])); }

#define Make_Val_final_pointer(type, init, final, adv) \
static void ml_final_##type (value val) \
Expand All @@ -297,7 +297,7 @@ static struct custom_operations ml_custom_##type = \
CAMLprim value Val_##type (type *p) \
{ value ret; if (!p) ml_raise_null_pointer(); \
ret = ml_alloc_custom (&ml_custom_##type, sizeof(value), adv, 1000); \
initialize (&Field(ret,1), (value) p); init(p); return ret; }
caml_initialize (&Field(ret,1), (value) p); init(p); return ret; }

#define Make_Val_final_pointer_ext(type, ext, init, final, adv) \
static void ml_final_##type##ext (value val) \
Expand All @@ -308,7 +308,7 @@ static struct custom_operations ml_custom_##type##ext = \
CAMLprim value Val_##type##ext (type *p) \
{ value ret; if (!p) ml_raise_null_pointer(); \
ret = ml_alloc_custom (&ml_custom_##type##ext, sizeof(value), adv, 1000); \
initialize (&Field(ret,1), (value) p); init(p); return ret; }
caml_initialize (&Field(ret,1), (value) p); init(p); return ret; }

#define Make_Val_final_pointer_compare(type, init, comp, final, adv) \
static void ml_final_##type (value val) \
Expand All @@ -321,7 +321,7 @@ static struct custom_operations ml_custom_##type = \
CAMLprim value Val_##type (type *p) \
{ value ret; if (!p) ml_raise_null_pointer(); \
ret = ml_alloc_custom (&ml_custom_##type, sizeof(value), adv, 1000); \
initialize (&Field(ret,1), (value) p); init(p); return ret; }
caml_initialize (&Field(ret,1), (value) p); init(p); return ret; }

#define Pointer_val(val) ((void*)Field(val,1))
#define Store_pointer(val,p) (Field(val,1)=Val_bp(p))
Expand Down