#include <pcap.h>
#include <stdio.h>
+#include "optimize.h"
+
void
bpf_dump(const struct bpf_program *p, int option)
{
}
for (i = 0; i < n; ++insn, ++i) {
#ifdef BDEBUG
- extern int bids[];
- if (bids[i] > 0)
+ if (i < NBIDS && bids[i] > 0)
printf("[%02d]", bids[i] - 1);
else
printf(" -- ");
#include "pcap-int.h"
#include "gencode.h"
+#include "optimize.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
* and expect it to provide meaningful information.
*/
#ifdef BDEBUG
-int bids[1000];
+int bids[NBIDS];
#endif
/*
free(offset);
#ifdef BDEBUG
- bids[dst - conv_state->fstart] = p->id + 1;
+ if (dst - conv_state->fstart < NBIDS)
+ bids[dst - conv_state->fstart] = p->id + 1;
#endif
dst->code = (u_short)p->s.code;
dst->k = p->s.k;
--- /dev/null
+/*
+ * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/*
+ * Some stuff for use when debugging the optimizer.
+ */
+#ifdef BDEBUG
+extern int pcap_optimizer_debug; /* optimizer debugging level */
+
+#define NBIDS 1000
+extern int bids[NBIDS];
+#endif
#include "pcap-int.h"
+#include "optimize.h"
+
#ifdef HAVE_DAG_API
#include "pcap-dag.h"
#endif /* HAVE_DAG_API */
PCAP_API_DEF void
pcap_set_optimizer_debug(int value)
{
- extern int pcap_optimizer_debug;
-
pcap_optimizer_debug = value;
}
#endif