One level deeper: into the container `id`, or (no id) into a block that * keeps the path. */
| 1886 | /* One level deeper: into the container `id`, or (no id) into a block that |
| 1887 | * keeps the path. */ |
| 1888 | static void d2_push(d2_scope_t *sc, dg_str_t id) { |
| 1889 | if (sc->depth < D2_DEPTH_MAX) { |
| 1890 | sc->lens[sc->depth] = strlen(sc->path); |
| 1891 | if (id.n) { |
| 1892 | char next[D2_PATH_MAX]; |
| 1893 | snprintf(next, sizeof(next), "%.*s", (int)id.n, id.p); |
| 1894 | memcpy(sc->path, next, sizeof(next)); |
| 1895 | } |
| 1896 | } |
| 1897 | sc->depth++; |
| 1898 | } |
| 1899 | |
| 1900 | static void d2_pop(d2_scope_t *sc) { |
| 1901 | if (sc->depth == 0) { |