MCPcopy Create free account
hub / github.com/ElementsProject/lightning / map_copy

Function map_copy

common/gossmap.c:85–102  ·  view source on GitHub ↗

Accessors for the gossmap */

Source from the content-addressed store, hash-verified

83
84/* Accessors for the gossmap */
85static void map_copy(const struct gossmap *map, size_t offset,
86 void *dst, size_t len)
87{
88 if (offset >= map->map_size) {
89 size_t localoff = offset - map->map_size;
90 assert(localoff + len <= tal_bytelen(map->local));
91 memcpy(dst, map->local + localoff, len);
92 } else {
93 assert(offset + len <= map->map_size);
94 if (map->mmap)
95 memcpy(dst, map->mmap + offset, len);
96 else {
97 /* Yeah, we'll crash on I/O errors. */
98 if (pread(map->fd, dst, len, offset) != len)
99 abort();
100 }
101 }
102}
103
104static u8 map_u8(const struct gossmap *map, size_t offset)
105{

Callers 10

map_u8Function · 0.85
map_be16Function · 0.85
map_be32Function · 0.85
map_be64Function · 0.85
map_nodeidFunction · 0.85
map_catchupFunction · 0.85

Calls 2

tal_bytelenFunction · 0.85
abortFunction · 0.85

Tested by

no test coverage detected