| 79 | } |
| 80 | |
| 81 | static void rune_altern_encode(const struct rune_altern *altern, |
| 82 | void (*cb)(const char *s, size_t len, |
| 83 | void *arg), |
| 84 | void *arg) |
| 85 | { |
| 86 | char cond = altern->condition; |
| 87 | const char *p; |
| 88 | |
| 89 | cb(altern->fieldname, strlen(altern->fieldname), arg); |
| 90 | cb(&cond, 1, arg); |
| 91 | |
| 92 | p = altern->value; |
| 93 | for (;;) { |
| 94 | char esc[2] = { '\\' }; |
| 95 | size_t len = strcspn(p, "\\|&"); |
| 96 | cb(p, len, arg); |
| 97 | if (!p[len]) |
| 98 | break; |
| 99 | esc[1] = p[len]; |
| 100 | cb(esc, 2, arg); |
| 101 | p += len + 1; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | static void rune_restr_encode(const struct rune_restr *restr, |
| 106 | void (*cb)(const char *s, size_t len, |