| 195 | } |
| 196 | |
| 197 | HEADER_NV *header_split(const char *s) |
| 198 | { |
| 199 | HEADER_NV *header; |
| 200 | |
| 201 | #define SKIP_SPACE(x) { \ |
| 202 | while (*(x) == ' ' || *(x) == '\t') \ |
| 203 | (x)++; \ |
| 204 | } |
| 205 | SKIP_SPACE(s); |
| 206 | if (*s == 0) |
| 207 | return (NULL); |
| 208 | |
| 209 | header = (HEADER_NV*) acl_mycalloc(1, sizeof(HEADER_NV)); |
| 210 | header->name = acl_mystrdup(s); |
| 211 | char *ptr = strchr(header->name, ':'); |
| 212 | if (ptr == NULL) { |
| 213 | header_nv_free(header); |
| 214 | return (NULL); |
| 215 | } |
| 216 | *ptr++ = 0; |
| 217 | SKIP_SPACE(ptr); |
| 218 | if (*ptr == 0) { |
| 219 | header_nv_free(header); |
| 220 | return (NULL); |
| 221 | } |
| 222 | header->value = ptr; |
| 223 | return (header); |
| 224 | } |
| 225 | |
| 226 | void header_nv_free(HEADER_NV *header) |
| 227 | { |
no test coverage detected
searching dependent graphs…