add optional driver for the hw watchdog on gateworks avila boards (requires soldering...
[openwrt.git] / package / libpcap / patches / 105-space_optimization.patch
1 --- a/gencode.c
2 +++ b/gencode.c
3 @@ -429,20 +429,6 @@ pcap_compile_nopcap(int snaplen_arg, int
4 }
5
6 /*
7 - * Clean up a "struct bpf_program" by freeing all the memory allocated
8 - * in it.
9 - */
10 -void
11 -pcap_freecode(struct bpf_program *program)
12 -{
13 - program->bf_len = 0;
14 - if (program->bf_insns != NULL) {
15 - free((char *)program->bf_insns);
16 - program->bf_insns = NULL;
17 - }
18 -}
19 -
20 -/*
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
24 --- a/optimize.c
25 +++ b/optimize.c
26 @@ -2263,36 +2263,6 @@ icode_to_fcode(root, lenp)
27 return fp;
28 }
29
30 -/*
31 - * Make a copy of a BPF program and put it in the "fcode" member of
32 - * a "pcap_t".
33 - *
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.
37 - */
38 -int
39 -install_bpf_program(pcap_t *p, struct bpf_program *fp)
40 -{
41 - size_t prog_size;
42 -
43 - /*
44 - * Free up any already installed program.
45 - */
46 - pcap_freecode(&p->fcode);
47 -
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));
54 - return (-1);
55 - }
56 - memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
57 - return (0);
58 -}
59 -
60 #ifdef BDEBUG
61 static void
62 opt_dump(root)
63 --- a/pcap.c
64 +++ b/pcap.c
65 @@ -463,6 +463,52 @@ static const u_char charmap[] = {
66 (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
67 };
68
69 +/*
70 + * Clean up a "struct bpf_program" by freeing all the memory allocated
71 + * in it.
72 + */
73 +void
74 +pcap_freecode(struct bpf_program *program)
75 +{
76 + program->bf_len = 0;
77 + if (program->bf_insns != NULL) {
78 + free((char *)program->bf_insns);
79 + program->bf_insns = NULL;
80 + }
81 +}
82 +
83 +
84 +/*
85 + * Make a copy of a BPF program and put it in the "fcode" member of
86 + * a "pcap_t".
87 + *
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.
91 + */
92 +int
93 +install_bpf_program(pcap_t *p, struct bpf_program *fp)
94 +{
95 + size_t prog_size;
96 +
97 + /*
98 + * Free up any already installed program.
99 + */
100 + pcap_freecode(&p->fcode);
101 +
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));
108 + return (-1);
109 + }
110 + memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
111 + return (0);
112 +}
113 +
114 +
115 int
116 pcap_strcasecmp(const char *s1, const char *s2)
117 {
This page took 0.045853 seconds and 5 git commands to generate.