summaryrefslogtreecommitdiffstats
path: root/package/libpcap/patches/201-space_optimization.patch
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-08 11:24:12 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-08 11:24:12 +0000
commit228d1c4df21088ffb0f2e087eae8c4323ad05760 (patch)
tree5155ea7bc428f0af268c4c63435d0696d18b124d /package/libpcap/patches/201-space_optimization.patch
parente260ab73e0a396b3ba39824beb1fb71716828a7f (diff)
move library packages to package/libs/
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33657 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/libpcap/patches/201-space_optimization.patch')
-rw-r--r--package/libpcap/patches/201-space_optimization.patch133
1 files changed, 0 insertions, 133 deletions
diff --git a/package/libpcap/patches/201-space_optimization.patch b/package/libpcap/patches/201-space_optimization.patch
deleted file mode 100644
index f3eec4c83..000000000
--- a/package/libpcap/patches/201-space_optimization.patch
+++ /dev/null
@@ -1,133 +0,0 @@
---- a/gencode.c
-+++ b/gencode.c
-@@ -491,20 +491,6 @@ pcap_compile_nopcap(int snaplen_arg, int
- }
-
- /*
-- * Clean up a "struct bpf_program" by freeing all the memory allocated
-- * in it.
-- */
--void
--pcap_freecode(struct bpf_program *program)
--{
-- program->bf_len = 0;
-- if (program->bf_insns != NULL) {
-- free((char *)program->bf_insns);
-- program->bf_insns = NULL;
-- }
--}
--
--/*
- * Backpatch the blocks in 'list' to 'target'. The 'sense' field indicates
- * which of the jt and jf fields has been resolved and which is a pointer
- * back to another unresolved block (or nil). At least one of the fields
---- a/pcap.c
-+++ b/pcap.c
-@@ -748,6 +748,59 @@ static const u_char charmap[] = {
- (u_char)'\374', (u_char)'\375', (u_char)'\376', (u_char)'\377',
- };
-
-+/*
-+ * Clean up a "struct bpf_program" by freeing all the memory allocated
-+ * in it.
-+ */
-+void
-+pcap_freecode(struct bpf_program *program)
-+{
-+ program->bf_len = 0;
-+ if (program->bf_insns != NULL) {
-+ free((char *)program->bf_insns);
-+ program->bf_insns = NULL;
-+ }
-+}
-+
-+/*
-+ * Make a copy of a BPF program and put it in the "fcode" member of
-+ * a "pcap_t".
-+ *
-+ * If we fail to allocate memory for the copy, fill in the "errbuf"
-+ * member of the "pcap_t" with an error message, and return -1;
-+ * otherwise, return 0.
-+ */
-+int
-+install_bpf_program(pcap_t *p, struct bpf_program *fp)
-+{
-+ size_t prog_size;
-+
-+ /*
-+ * Validate the program.
-+ */
-+ if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
-+ snprintf(p->errbuf, sizeof(p->errbuf),
-+ "BPF program is not valid");
-+ return (-1);
-+ }
-+
-+ /*
-+ * Free up any already installed program.
-+ */
-+ pcap_freecode(&p->fcode);
-+
-+ prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
-+ p->fcode.bf_len = fp->bf_len;
-+ p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
-+ if (p->fcode.bf_insns == NULL) {
-+ snprintf(p->errbuf, sizeof(p->errbuf),
-+ "malloc: %s", pcap_strerror(errno));
-+ return (-1);
-+ }
-+ memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
-+ return (0);
-+}
-+
- int
- pcap_strcasecmp(const char *s1, const char *s2)
- {
---- a/optimize.c
-+++ b/optimize.c
-@@ -2292,45 +2292,6 @@ icode_to_fcode(root, lenp)
- return fp;
- }
-
--/*
-- * Make a copy of a BPF program and put it in the "fcode" member of
-- * a "pcap_t".
-- *
-- * If we fail to allocate memory for the copy, fill in the "errbuf"
-- * member of the "pcap_t" with an error message, and return -1;
-- * otherwise, return 0.
-- */
--int
--install_bpf_program(pcap_t *p, struct bpf_program *fp)
--{
-- size_t prog_size;
--
-- /*
-- * Validate the program.
-- */
-- if (!bpf_validate(fp->bf_insns, fp->bf_len)) {
-- snprintf(p->errbuf, sizeof(p->errbuf),
-- "BPF program is not valid");
-- return (-1);
-- }
--
-- /*
-- * Free up any already installed program.
-- */
-- pcap_freecode(&p->fcode);
--
-- prog_size = sizeof(*fp->bf_insns) * fp->bf_len;
-- p->fcode.bf_len = fp->bf_len;
-- p->fcode.bf_insns = (struct bpf_insn *)malloc(prog_size);
-- if (p->fcode.bf_insns == NULL) {
-- snprintf(p->errbuf, sizeof(p->errbuf),
-- "malloc: %s", pcap_strerror(errno));
-- return (-1);
-- }
-- memcpy(p->fcode.bf_insns, fp->bf_insns, prog_size);
-- return (0);
--}
--
- #ifdef BDEBUG
- static void
- opt_dump(root)