A NULL-terminated list of strings: the pointer array plus each string. */
| 209 | |
| 210 | /* A NULL-terminated list of strings: the pointer array plus each string. */ |
| 211 | static void cr_list(cr_ctx_t *c, const char ***field) { |
| 212 | const char **list = *field; |
| 213 | if (!list) { |
| 214 | return; |
| 215 | } |
| 216 | int n = 0; |
| 217 | if (c->phase == CR_RELOCATE) { |
| 218 | /* The array may live in a block we can no longer read at its old |
| 219 | * address: relocate the pointer first, then count and walk it. */ |
| 220 | cr_blob(c, (const void **)field, sizeof(char *)); |
| 221 | list = *field; |
| 222 | while (list[n]) { |
| 223 | n++; |
| 224 | } |
| 225 | for (int i = 0; i < n; i++) { |
| 226 | cr_str(c, &list[i]); |
| 227 | } |
| 228 | return; |
| 229 | } |
| 230 | while (list[n]) { |
| 231 | n++; |
| 232 | } |
| 233 | cr_blob(c, (const void **)field, (size_t)(n + SKIP_ONE) * sizeof(char *)); |
| 234 | const char **walk = *field; /* the copy in COPY, the original otherwise */ |
| 235 | for (int i = 0; i < n && walk; i++) { |
| 236 | cr_str(c, &walk[i]); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | /* A counted list of strings (signature_param_types). */ |
| 241 | static void cr_counted_list(cr_ctx_t *c, const char ***field, int count) { |
no test coverage detected