| 39 |
#include <stdio.h> |
#include <stdio.h> |
| 40 |
#include <stdlib.h> |
#include <stdlib.h> |
| 41 |
#include <string.h> |
#include <string.h> |
| 42 |
#include <unistd.h> |
//#include <unistd.h> |
| 43 |
|
|
| 44 |
#include "nfotiser.h" |
#include "nfotiser.h" |
| 45 |
|
|
| 109 |
if (munmap(cp, len)) |
if (munmap(cp, len)) |
| 110 |
err(255, "cannot munmap"); |
err(255, "cannot munmap"); |
| 111 |
/* don't need the file any more */ |
/* don't need the file any more */ |
|
close(fd); |
|
| 112 |
|
|
| 113 |
/* now we can operate on the NUL-terminated R/W string “buf” */ |
/* now we can operate on the NUL-terminated R/W string “buf” */ |
| 114 |
if (buf[len - 1] != '\n') |
if (buf[len - 1] != '\n') |
| 276 |
} |
} |
| 277 |
putchar('\n'); |
putchar('\n'); |
| 278 |
} |
} |
| 279 |
|
|
| 280 |
|
void |
| 281 |
|
parser_free(struct parser_result *head) |
| 282 |
|
{ |
| 283 |
|
struct parser_res *entry; |
| 284 |
|
|
| 285 |
|
if (head == NULL) |
| 286 |
|
return; |
| 287 |
|
|
| 288 |
|
while (!CIRCLEQ_EMPTY(head)) { |
| 289 |
|
entry = CIRCLEQ_FIRST(head); |
| 290 |
|
CIRCLEQ_REMOVE(head, entry, e); |
| 291 |
|
if (entry->kw_multi != NULL) |
| 292 |
|
free(entry->kw_multi); |
| 293 |
|
if (entry->value != NULL) |
| 294 |
|
free(entry->value); |
| 295 |
|
free(entry); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
free(head); |
| 299 |
|
} |