From 0d3cb6726ddc1bab9fdd11a0aaa259fb436da4b2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 28 Jan 2015 23:43:01 +0000 Subject: py: Change vstr so that it doesn't null terminate buffer by default. This cleans up vstr so that it's a pure "variable buffer", and the user can decide whether they need to add a terminating null byte. In most places where vstr is used, the vstr did not need to be null terminated and so this patch saves code size, a tiny bit of RAM, and makes vstr usage more efficient. When null termination is needed it must be done explicitly using vstr_null_terminate. --- teensy/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'teensy') diff --git a/teensy/main.c b/teensy/main.c index 082f6f1ca..34a804c60 100644 --- a/teensy/main.c +++ b/teensy/main.c @@ -319,6 +319,7 @@ soft_reset: } else { vstr_add_str(vstr, mp_obj_str_get_str(pyb_config_main)); } + vstr_null_terminate(vstr); if (!pyexec_file(vstr_str(vstr))) { flash_error(3); } -- cgit v1.2.3