diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-29 01:48:13 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-12-29 01:48:13 +0100 |
| commit | 4dcdb73c4b76a3413730649ddf4039ec964466b9 (patch) | |
| tree | 8b96f5e5f81a88177ff6b8b9439023a21fe80a4f /map.c | |
| parent | 8eeb6f5836ee772e3cdc8967d20444d84261373e (diff) | |
| download | vis-4dcdb73c4b76a3413730649ddf4039ec964466b9.tar.gz vis-4dcdb73c4b76a3413730649ddf4039ec964466b9.tar.xz | |
map: implement map_prefix_delete
Diffstat (limited to 'map.c')
| -rw-r--r-- | map.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -288,6 +288,19 @@ const Map *map_prefix(const Map *map, const char *prefix) return top; } +bool map_prefix_delete(Map *map, const char *prefix) +{ + bool ret = false; + do { + const char *conflict = NULL; + const Map *conflicts = map_prefix(map, prefix); + if (!map_first(conflicts, &conflict)) + break; + ret = map_delete(map, conflict); + } while (ret); + return ret; +} + static void clear(Map n) { if (!n.v) { |
