Commit 8c25201d authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

socket: Make sure that symbol definitions are const.

parent ac0134d4
......@@ -333,7 +333,7 @@ extern mp_obj_type_t sockaddr_in_type;
#define C(name) { #name, name }
struct sym_entry {
static const struct sym_entry {
const char *sym;
int val;
} constants[] = {
......@@ -369,7 +369,7 @@ void microsocket_init() {
rt_store_attr(m, MP_QSTR_gethostbyname, (mp_obj_t)&mod_socket_gethostbyname_obj);
#endif
rt_store_attr(m, MP_QSTR_getaddrinfo, (mp_obj_t)&mod_socket_getaddrinfo_obj);
for (struct sym_entry *p = constants; p->sym != NULL; p++) {
for (const struct sym_entry *p = constants; p->sym != NULL; p++) {
rt_store_attr(m, QSTR_FROM_STR_STATIC(p->sym), MP_OBJ_NEW_SMALL_INT((machine_int_t)p->val));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment