summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-03-20 17:41:37 +0000
committerDamien George <damien.p.george@gmail.com>2015-03-20 17:41:37 +0000
commitd1cee02783666338b526ac686c19440c5f44b258 (patch)
tree19478e31b55312d3167cf8b4281aa6ed01164104 /py/obj.h
parentd48035b06b952b9ac4d95897d08de50d5977bf9f (diff)
downloadmicropython-d1cee02783666338b526ac686c19440c5f44b258.tar.gz
micropython-d1cee02783666338b526ac686c19440c5f44b258.zip
py: Clarify API for map/set lookup when removing&adding at once.
Addresses issue #1160.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/py/obj.h b/py/obj.h
index 3e2cd2a16f..b7f38d1c56 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -159,11 +159,12 @@ typedef struct _mp_map_t {
mp_map_elem_t *table;
} mp_map_t;
-// These can be or'd together
+// mp_set_lookup requires these constants to have the values they do
typedef enum _mp_map_lookup_kind_t {
- MP_MAP_LOOKUP, // 0
- MP_MAP_LOOKUP_ADD_IF_NOT_FOUND, // 1
- MP_MAP_LOOKUP_REMOVE_IF_FOUND, // 2
+ MP_MAP_LOOKUP = 0,
+ MP_MAP_LOOKUP_ADD_IF_NOT_FOUND = 1,
+ MP_MAP_LOOKUP_REMOVE_IF_FOUND = 2,
+ MP_MAP_LOOKUP_ADD_IF_NOT_FOUND_OR_REMOVE_IF_FOUND = 3, // only valid for mp_set_lookup
} mp_map_lookup_kind_t;
extern const mp_map_t mp_const_empty_map;