Skip to content

Commit 081ae64

Browse files
authored
Mark as inline functions implemented in src/serialize.h (#44739)
* Mark as `inline` functions implemented in `src/serialize.h` Also, remove duplicate definitions from `src/staticdata.c` and include `serialize.h` in there.
1 parent 05340a8 commit 081ae64

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

src/serialize.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,54 +67,54 @@ extern "C" {
6767
#define LAST_TAG 57
6868

6969
#define write_uint8(s, n) ios_putc((n), (s))
70-
#define read_uint8(s) ((uint8_t)ios_getc(s))
71-
#define write_int8(s, n) write_uint8(s, n)
72-
#define read_int8(s) read_uint8(s)
70+
#define read_uint8(s) ((uint8_t)ios_getc((s)))
71+
#define write_int8(s, n) write_uint8((s), (n))
72+
#define read_int8(s) read_uint8((s))
7373

7474
/* read and write in host byte order */
7575

76-
static void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT
76+
static inline void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT
7777
{
7878
ios_write(s, (char*)&i, 4);
7979
}
8080

81-
static int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT
81+
static inline int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT
8282
{
8383
int32_t x = 0;
8484
ios_read(s, (char*)&x, 4);
8585
return x;
8686
}
8787

88-
static uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT
88+
static inline uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT
8989
{
9090
uint64_t x = 0;
9191
ios_read(s, (char*)&x, 8);
9292
return x;
9393
}
9494

95-
static void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT
95+
static inline void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT
9696
{
9797
ios_write(s, (char*)&i, 8);
9898
}
9999

100-
static void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT
100+
static inline void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT
101101
{
102102
ios_write(s, (char*)&i, 2);
103103
}
104104

105-
static uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT
105+
static inline uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT
106106
{
107107
int16_t x = 0;
108108
ios_read(s, (char*)&x, 2);
109109
return x;
110110
}
111111

112-
static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
112+
static inline void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
113113
{
114114
ios_write(s, (char*)&i, 4);
115115
}
116116

117-
static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
117+
static inline uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
118118
{
119119
uint32_t x = 0;
120120
ios_read(s, (char*)&x, 4);

src/staticdata.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ done by `get_item_for_reloc`.
6464
#include "julia_internal.h"
6565
#include "builtin_proto.h"
6666
#include "processor.h"
67+
#include "serialize.h"
6768

6869
#ifndef _OS_WINDOWS_
6970
#include <dlfcn.h>
@@ -364,25 +365,6 @@ typedef enum {
364365
// if a larger size is required, will need to add support for writing larger relocations in many cases below
365366
#define RELOC_TAG_OFFSET 29
366367

367-
368-
/* read and write in host byte order */
369-
370-
#define write_uint8(s, n) ios_putc((n), (s))
371-
#define read_uint8(s) ((uint8_t)ios_getc((s)))
372-
373-
static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT
374-
{
375-
ios_write(s, (char*)&i, 4);
376-
}
377-
378-
static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT
379-
{
380-
uint32_t x = 0;
381-
ios_read(s, (char*)&x, 4);
382-
return x;
383-
}
384-
385-
386368
// --- Static Compile ---
387369

388370
static void *jl_sysimg_handle = NULL;

0 commit comments

Comments
 (0)