]> The Tcpdump Group git mirrors - libpcap/commitdiff
Declare pcap_wsockinit() in pcap-int.h.
authorGuy Harris <[email protected]>
Fri, 4 Sep 2015 23:06:22 +0000 (16:06 -0700)
committerGuy Harris <[email protected]>
Fri, 4 Sep 2015 23:06:22 +0000 (16:06 -0700)
We probably shouldn't be exporting something called wsockinit() at all,
as it's too likely to collide with routines in code that calls us.  I
don't know whether Wine implemented it in order to run Windows programs
that call it, or if there actually *are* such programs, but we'll leave
it around for now.

Call pcap_wsockinit() in pcap_compile(), and don't bother declaring it;
rely on it being declared in pcap-int.h, so we run less of a risk of the
declaration and definition getting out of sync (not that we're likely to
change its signature, but...).

In the definitions of it and wsockinit(), explicitly note that they take
no arguments.

gencode.c
pcap-int.h
pcap-win32.c

index 872f70d90266d2ed471ec4ccdb99fdfed47eaad4..95357b56f680ab89462dfe07c188e080026cf8f9 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -441,11 +441,10 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
         * a separate -lpthread, we might not want to do that.
         */
 #ifdef _WIN32
-       extern int wsockinit (void);
        static int done = 0;
 
        if (!done)
-               wsockinit();
+               pcap_wsockinit();
        done = 1;
        EnterCriticalSection(&g_PcapCompileCriticalSection);
 #endif
index d73f902c37de6c200e32e3ce39a0c27c497c77fb..6e54141a95216174b2ba180801ae47b66ea56175 100644 (file)
@@ -468,6 +468,7 @@ void        pcap_oneshot(u_char *, const struct pcap_pkthdr *, const u_char *);
 
 #ifdef _WIN32
 void   pcap_win32_err_to_str(DWORD, char *);
+void   pcap_wsockinit (void);
 #endif
 
 int    install_bpf_program(pcap_t *, struct bpf_program *);
index 5445d696457ac87fdb92a3541ca02b032b35a3ec..bc285aebd7a337dbd0db136ac415bcd7ef625c41 100644 (file)
@@ -99,7 +99,7 @@ BOOL WINAPI DllMain(
 
 /* Start winsock */
 int
-wsockinit()
+wsockinit(void)
 {
        WORD wVersionRequested;
        WSADATA wsaData;
@@ -120,7 +120,8 @@ wsockinit()
        return err;
 }
 
-int pcap_wsockinit()
+int
+pcap_wsockinit(void)
 {
        return wsockinit();
 }