summaryrefslogtreecommitdiffstatshomepage
path: root/py/misc.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-05 23:57:48 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-05 23:57:48 +0000
commite09ffa1400cf4a9283041833fc56b848a87a4c6c (patch)
treeeff1aa442b8705039aea33cc75075c9171f11593 /py/misc.h
parentcdcb4906d41f42789f6610047e8ae6aa79a61e47 (diff)
downloadmicropython-e09ffa1400cf4a9283041833fc56b848a87a4c6c.tar.gz
micropython-e09ffa1400cf4a9283041833fc56b848a87a4c6c.zip
Search paths properly on import and execute __init__.py if it exists.
Diffstat (limited to 'py/misc.h')
-rw-r--r--py/misc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/misc.h b/py/misc.h
index 0fad9459f1..679a14b5b9 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -12,8 +12,12 @@ typedef unsigned int uint;
/** generic ops *************************************************/
+#ifndef MIN
#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#endif
+#ifndef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#endif
/** memomry allocation ******************************************/
@@ -93,6 +97,7 @@ void vstr_printf(vstr_t *vstr, const char *fmt, ...);
/** non-dynamic size-bounded variable buffer/string *************/
#define CHECKBUF(buf, max_size) char buf[max_size + 1]; uint buf##_len = max_size; char *buf##_p = buf;
+#define CHECKBUF_RESET(buf, max_size) buf##_len = max_size; buf##_p = buf;
#define CHECKBUF_APPEND(buf, src, src_len) \
{ int l = MIN(src_len, buf##_len); \
memcpy(buf##_p, src, l); \