Skip to content

Commit 5fd8fd2

Browse files
committed
Revert MP_BOOL, etc. and use <stdbool.h> instead
1 parent 7a16fad commit 5fd8fd2

61 files changed

Lines changed: 517 additions & 529 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

py/asmthumb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ asm_thumb_t *asm_thumb_new(uint max_num_labels) {
4545
return as;
4646
}
4747

48-
void asm_thumb_free(asm_thumb_t *as, MP_BOOL free_code) {
48+
void asm_thumb_free(asm_thumb_t *as, bool free_code) {
4949
if (free_code) {
5050
m_del(byte, as->code_base, as->code_size);
5151
}
@@ -56,9 +56,9 @@ void asm_thumb_free(asm_thumb_t *as, MP_BOOL free_code) {
5656
{
5757
Label *lab = &g_array_index(as->label, Label, i);
5858
if (lab->unresolved != NULL)
59-
g_array_free(lab->unresolved, MP_TRUE);
59+
g_array_free(lab->unresolved, true);
6060
}
61-
g_array_free(as->label, MP_TRUE);
61+
g_array_free(as->label, true);
6262
}
6363
*/
6464
m_del_obj(asm_thumb_t, as);
@@ -87,7 +87,7 @@ void asm_thumb_end_pass(asm_thumb_t *as) {
8787
int i;
8888
for (i = 0; i < as->label->len; ++i)
8989
if (g_array_index(as->label, Label, i).unresolved != NULL)
90-
return MP_FALSE;
90+
return false;
9191
}
9292
*/
9393
}

py/asmthumb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
typedef struct _asm_thumb_t asm_thumb_t;
4545

4646
asm_thumb_t *asm_thumb_new(uint max_num_labels);
47-
void asm_thumb_free(asm_thumb_t *as, MP_BOOL free_code);
47+
void asm_thumb_free(asm_thumb_t *as, bool free_code);
4848
void asm_thumb_start_pass(asm_thumb_t *as, int pass);
4949
void asm_thumb_end_pass(asm_thumb_t *as);
5050
uint asm_thumb_get_code_size(asm_thumb_t *as);

py/asmx64.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct _asm_x64_t {
9494
};
9595

9696
// for allocating memory, see src/v8/src/platform-linux.cc
97-
void *alloc_mem(uint req_size, uint *alloc_size, MP_BOOL is_exec) {
97+
void *alloc_mem(uint req_size, uint *alloc_size, bool is_exec) {
9898
req_size = (req_size + 0xfff) & (~0xfff);
9999
int prot = PROT_READ | PROT_WRITE | (is_exec ? PROT_EXEC : 0);
100100
void *ptr = mmap(NULL, req_size, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -119,7 +119,7 @@ asm_x64_t* asm_x64_new(uint max_num_labels) {
119119
return as;
120120
}
121121

122-
void asm_x64_free(asm_x64_t* as, MP_BOOL free_code) {
122+
void asm_x64_free(asm_x64_t* as, bool free_code) {
123123
if (free_code) {
124124
// need to un-mmap
125125
//m_free(as->code_base);
@@ -131,9 +131,9 @@ void asm_x64_free(asm_x64_t* as, MP_BOOL free_code) {
131131
{
132132
Label* lab = &g_array_index(as->label, Label, i);
133133
if (lab->unresolved != NULL)
134-
g_array_free(lab->unresolved, MP_TRUE);
134+
g_array_free(lab->unresolved, true);
135135
}
136-
g_array_free(as->label, MP_TRUE);
136+
g_array_free(as->label, true);
137137
}
138138
*/
139139
m_del_obj(asm_x64_t, as);
@@ -154,7 +154,7 @@ void asm_x64_end_pass(asm_x64_t *as) {
154154
as->code_size = as->code_offset;
155155
//as->code_base = m_new(byte, as->code_size); need to allocale executable memory
156156
uint actual_alloc;
157-
as->code_base = alloc_mem(as->code_size, &actual_alloc, MP_TRUE);
157+
as->code_base = alloc_mem(as->code_size, &actual_alloc, true);
158158
printf("code_size: %u\n", as->code_size);
159159
}
160160

@@ -165,7 +165,7 @@ void asm_x64_end_pass(asm_x64_t *as) {
165165
int i;
166166
for (i = 0; i < as->label->len; ++i)
167167
if (g_array_index(as->label, Label, i).unresolved != NULL)
168-
return MP_FALSE;
168+
return false;
169169
}
170170
*/
171171
}

py/asmx64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
typedef struct _asm_x64_t asm_x64_t;
2828

2929
asm_x64_t* asm_x64_new(uint max_num_labels);
30-
void asm_x64_free(asm_x64_t* as, MP_BOOL free_code);
30+
void asm_x64_free(asm_x64_t* as, bool free_code);
3131
void asm_x64_start_pass(asm_x64_t *as, int pass);
3232
void asm_x64_end_pass(asm_x64_t *as);
3333
uint asm_x64_get_code_size(asm_x64_t* as);

py/bc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
mp_obj_t mp_execute_byte_code(const byte *code, const mp_obj_t *args, uint n_args, uint n_state);
2-
MP_BOOL mp_execute_byte_code_2(const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out);
2+
bool mp_execute_byte_code_2(const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out);

py/builtinimport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mp_obj_t mp_builtin___import__(int n, mp_obj_t *args) {
5858
return mp_const_none;
5959
}
6060

61-
mp_obj_t module_fun = mp_compile(pn, MP_FALSE);
61+
mp_obj_t module_fun = mp_compile(pn, false);
6262

6363
if (module_fun == mp_const_none) {
6464
// TODO handle compile error correctly

0 commit comments

Comments
 (0)