3 @@ -429,20 +429,6 @@ pcap_compile_nopcap(int snaplen_arg, int
7 - * Clean up a "struct bpf_program" by freeing all the memory allocated
11 -pcap_freecode(struct bpf_program *program)
13 - program->bf_len = 0;
14 - if (program->bf_insns != NULL) {
15 - free((char *)program->bf_insns);
16 - program->bf_insns = NULL;
21 * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates
22 * which of the jt and jf fields has been resolved and which is a pointer
23 * back to another unresolved block (or nil). At least one of the fields
26 @@ -2263,36 +2263,6 @@ icode_to_fcode(root, lenp)
31 - * Make a copy of a BPF program and put it in the "fcode" member of
34 - * If we fail to allocate memory for the copy, fill in the "errbuf"
35 - * member of the "pcap_t" with an error message, and return -1;
36 - * otherwise, return 0.
39 -install_bpf_program(pcap_t *p, struct bpf_program *fp)
44 - * Free up any already installed program.
46 - pcap_freecode(&p->fcode);
48 - prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
49 - p->fcode.bf_len = fp->bf_len;
50 - p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
51 - if (p->fcode.bf_insns == NULL) {
52 - snprintf(p->errbuf, sizeof(p->errbuf),
53 - "malloc: %s", pcap_strerror(errno));
56 - memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
65 @@ -463,6 +463,52 @@ static const u_char charmap[] = {
66 (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
70 + * Clean up a "struct bpf_program" by freeing all the memory allocated
74 +pcap_freecode(struct bpf_program *program)
76 + program->bf_len = 0;
77 + if (program->bf_insns != NULL) {
78 + free((char *)program->bf_insns);
79 + program->bf_insns = NULL;
85 + * Make a copy of a BPF program and put it in the "fcode" member of
88 + * If we fail to allocate memory for the copy, fill in the "errbuf"
89 + * member of the "pcap_t" with an error message, and return -1;
90 + * otherwise, return 0.
93 +install_bpf_program(pcap_t *p, struct bpf_program *fp)
98 + * Free up any already installed program.
100 + pcap_freecode(&p->fcode);
102 + prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
103 + p->fcode.bf_len = fp->bf_len;
104 + p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
105 + if (p->fcode.bf_insns == NULL) {
106 + snprintf(p->errbuf, sizeof(p->errbuf),
107 + "malloc: %s", pcap_strerror(errno));
110 + memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
116 pcap_strcasecmp(const char *s1, const char *s2)