Skip to content
Closed
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
5 changes: 1 addition & 4 deletions otherlibs/unix/caml/unixsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ struct filedescr {
SOCKET socket;
} fd; /* Real windows handle */
enum { KIND_HANDLE, KIND_SOCKET } kind;
#ifdef __cplusplus
std::
#endif
atomic_int crt_fd; /* C runtime descriptor */
_Atomic int crt_fd; /* C runtime descriptor */
unsigned int flags_fd; /* See FLAGS_FD_* */
};

Expand Down
8 changes: 4 additions & 4 deletions runtime/addrmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ value caml_addrmap_lookup(struct addrmap* t, value key)
for (uintnat pos = pos_initial(t, key); ; pos = pos_next(t, pos)) {
CAMLassert(t->entries[pos].key != ADDRMAP_INVALID_KEY);
if (t->entries[pos].key == key)
return t->entries[pos].val;
return t->entries[pos].value;
}
}

Expand All @@ -68,7 +68,7 @@ static void addrmap_alloc(struct addrmap* t, uintnat sz)
t->size = sz;
for (uintnat i = 0; i < sz; i++) {
t->entries[i].key = ADDRMAP_INVALID_KEY;
t->entries[i].val = ADDRMAP_NOT_PRESENT;
t->entries[i].value = ADDRMAP_NOT_PRESENT;
}
}

Expand Down Expand Up @@ -98,7 +98,7 @@ value* caml_addrmap_insert_pos(struct addrmap* t, value key) {
t->entries[pos].key = key;
}
if (t->entries[pos].key == key) {
return &t->entries[pos].val;
return &t->entries[pos].value;
}
}
/* failed to insert, rehash and try again */
Expand All @@ -110,7 +110,7 @@ value* caml_addrmap_insert_pos(struct addrmap* t, value key) {
if (old_table[i].key != ADDRMAP_INVALID_KEY) {
value* p = caml_addrmap_insert_pos(t, old_table[i].key);
CAMLassert(*p == ADDRMAP_NOT_PRESENT);
*p = old_table[i].val;
*p = old_table[i].value;
}
}
caml_stat_free(old_table);
Expand Down
16 changes: 10 additions & 6 deletions runtime/caml/addrmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
#ifndef CAML_ADDRMAP_H
#define CAML_ADDRMAP_H

#ifdef CAML_INTERNALS

#include "mlvalues.h"

#ifdef __cplusplus
extern "C" {
#endif

/* An addrmap is a value -> value hashmap, where
the values are blocks */

struct addrmap_entry { value key; value val; };
struct addrmap_entry { value key, value; };
struct addrmap {
struct addrmap_entry* entries;
uintnat size;
Expand Down Expand Up @@ -82,21 +84,23 @@ Caml_inline value caml_addrmap_iter_value(struct addrmap* t,
addrmap_iterator i)
{
CAMLassert(caml_addrmap_iter_ok(t, i));
return t->entries[i].val;
return t->entries[i].value;
}

Caml_inline value* caml_addrmap_iter_val_pos(struct addrmap* t,
addrmap_iterator i)
{
CAMLassert(caml_addrmap_iter_ok(t, i));
return &t->entries[i].val;
return &t->entries[i].value;
}

Caml_inline addrmap_iterator caml_addrmap_iterator(struct addrmap* t)
{
return caml_addrmap_next(t, (uintnat)(-1));
}

#endif /* CAML_INTERNALS */
#ifdef __cplusplus
}
#endif

#endif /* CAML_ADDRMAP_H */
Loading