summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-15 11:34:50 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-15 11:34:50 +0000
commita71c83a1d1aeca1d81d7c673929f8e836dec131e (patch)
tree5c49441e19c3feffbc792eec7ecfbc3ca3036830 /unix
parent8ac72b9d000ecc48a2d558bdb7c73c7f98d4be62 (diff)
downloadmicropython-a71c83a1d1aeca1d81d7c673929f8e836dec131e.tar.gz
micropython-a71c83a1d1aeca1d81d7c673929f8e836dec131e.zip
Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
Diffstat (limited to 'unix')
-rw-r--r--unix/file.c2
-rw-r--r--unix/main.c4
-rw-r--r--unix/qstrdefsport.h4
-rw-r--r--unix/socket.c2
4 files changed, 8 insertions, 4 deletions
diff --git a/unix/file.c b/unix/file.c
index 21dd764748..4e8fba54c8 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -116,7 +116,7 @@ static const mp_method_t rawfile_type_methods[] = {
static const mp_obj_type_t rawfile_type = {
{ &mp_const_type },
- "io.FileIO",
+ .name = MP_QSTR_io_dot_FileIO,
.print = fdfile_print,
.make_new = fdfile_make_new,
.getiter = mp_identity,
diff --git a/unix/main.c b/unix/main.c
index 716c7b1142..6aafe94ddd 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -195,7 +195,7 @@ static const mp_method_t test_methods[] = {
static const mp_obj_type_t test_type = {
{ &mp_const_type },
- "Test",
+ .name = MP_QSTR_Test,
.print = test_print,
.methods = test_methods,
};
@@ -308,7 +308,7 @@ int main(int argc, char **argv) {
// test_obj = TestClass()
// test_obj.attr = 42
mp_obj_t test_class_type, test_class_instance;
- test_class_type = mp_obj_new_type("TestClass", mp_const_empty_tuple, mp_obj_new_dict(0));
+ test_class_type = mp_obj_new_type(QSTR_FROM_STR_STATIC("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
rt_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = rt_call_function_0(test_class_type));
rt_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
diff --git a/unix/qstrdefsport.h b/unix/qstrdefsport.h
index 9f28c607e2..42c88b4693 100644
--- a/unix/qstrdefsport.h
+++ b/unix/qstrdefsport.h
@@ -1,5 +1,7 @@
// qstrs specific to this port
+Q(Test)
+
Q(argv)
Q(open)
Q(stdin)
@@ -13,3 +15,5 @@ Q(inet_aton)
Q(gethostbyname)
Q(getaddrinfo)
Q(microsocket)
+
+Q(io.FileIO)
diff --git a/unix/socket.c b/unix/socket.c
index 4b160e0bc8..25c4bfcb46 100644
--- a/unix/socket.c
+++ b/unix/socket.c
@@ -238,7 +238,7 @@ static const mp_method_t microsocket_type_methods[] = {
static const mp_obj_type_t microsocket_type = {
{ &mp_const_type },
- "socket",
+ .name = MP_QSTR_socket,
.print = socket_print,
.make_new = socket_make_new,
.getiter = NULL,