Skip to contentSkip to conversation

libcacard: stop including qemu-common.h

PATCH In review Michael Tokarev 3 participants 5 messages Apr 27, 2015 – May 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libcacard: stop including qemu-common.h

From: Paolo Bonzini <[email protected]>

This is a small step towards making libcacard standalone.

---
v2: update vscclient.c too, use unistd.h on !WIN32 and getopt.h on *nix

 libcacard/cac.c            | 5 ++++-
 libcacard/card_7816.c      | 4 +++-
 libcacard/event.c          | 2 +-
 libcacard/vcard.c          | 4 +++-
 libcacard/vcard_emul_nss.c | 2 +-
 libcacard/vreader.c        | 4 +++-
 libcacard/vscclient.c      | 8 +++++++-
 7 files changed, 22 insertions(+), 7 deletions(-)
libcacard/cac.c +4 -1
index f38fdce..bc84534 100644
@@ -5,7 +5,10 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
+#include <stdbool.h>
 
 #include "cac.h"
 #include "vcard.h"
libcacard/card_7816.c +3 -1
index 814fa16..22fd334 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/event.c +1 -1
index 4c551e4..63f4057 100644
@@ -5,7 +5,7 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "vreader.h"
libcacard/vcard.c +3 -1
index d140a8e..1a87208 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vcard_emul_nss.c +1 -1
index 950edee..6955f69 100644
@@ -25,7 +25,7 @@
 #include <prthread.h>
 #include <secerr.h>
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "card_7816t.h"
libcacard/vreader.c +3 -1
index 0315dd8..9725f46 100644
@@ -10,7 +10,9 @@
 #endif
 #define G_LOG_DOMAIN "libcacard"
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vscclient.c +7 -1
index fa6041d..0652684 100644
@@ -10,14 +10,20 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #ifndef _WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include <unistd.h>
 #define closesocket(x) close(x)
+#else
+#include <getopt.h>
 #endif
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vscard_common.h"
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 8 lines · Michael Tokarev

From: Paolo Bonzini <[email protected]>

This is a small step towards making libcacard standalone.

---
v2: update vscclient.c too, use unistd.h on !WIN32 and getopt.h on *nix

Thanks very much Michael. The vscclient.c parts look good, you may want to add your changes before your S-o-b line.

Paolo

Quoted 124 lines
 libcacard/cac.c            | 5 ++++-
 libcacard/card_7816.c      | 4 +++-
 libcacard/event.c          | 2 +-
 libcacard/vcard.c          | 4 +++-
 libcacard/vcard_emul_nss.c | 2 +-
 libcacard/vreader.c        | 4 +++-
 libcacard/vscclient.c      | 8 +++++++-
 7 files changed, 22 insertions(+), 7 deletions(-)
libcacard/cac.c +4 -1
index f38fdce..bc84534 100644
@@ -5,7 +5,10 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
+#include <stdbool.h>
 
 #include "cac.h"
 #include "vcard.h"
libcacard/card_7816.c +3 -1
index 814fa16..22fd334 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/event.c +1 -1
index 4c551e4..63f4057 100644
@@ -5,7 +5,7 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "vreader.h"
libcacard/vcard.c +3 -1
index d140a8e..1a87208 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vcard_emul_nss.c +1 -1
index 950edee..6955f69 100644
@@ -25,7 +25,7 @@
 #include <prthread.h>
 #include <secerr.h>
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "card_7816t.h"
libcacard/vreader.c +3 -1
index 0315dd8..9725f46 100644
@@ -10,7 +10,9 @@
 #endif
 #define G_LOG_DOMAIN "libcacard"
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vscclient.c +7 -1
index fa6041d..0652684 100644
@@ -10,14 +10,20 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #ifndef _WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include <unistd.h>
 #define closesocket(x) close(x)
+#else
+#include <getopt.h>
 #endif
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vscard_common.h"
 
#2 lore raw
In reply to Michael Tokarev

Hello,

Quoted 3 lines · Michael Tokarev

From: Paolo Bonzini <[email protected]>

This is a small step towards making libcacard standalone.

on my system the removal of qemu-common.h inclusion broke compilation due to assert being used in glib-compat.h. A fix might be to include assert.h in glib-compat.h.

Thanks,

Laurent

Quoted 131 lines

---
v2: update vscclient.c too, use unistd.h on !WIN32 and getopt.h on *nix

 libcacard/cac.c            | 5 ++++-
 libcacard/card_7816.c      | 4 +++-
 libcacard/event.c          | 2 +-
 libcacard/vcard.c          | 4 +++-
 libcacard/vcard_emul_nss.c | 2 +-
 libcacard/vreader.c        | 4 +++-
 libcacard/vscclient.c      | 8 +++++++-
 7 files changed, 22 insertions(+), 7 deletions(-)
libcacard/cac.c +4 -1
index f38fdce..bc84534 100644
@@ -5,7 +5,10 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
+#include <stdbool.h>
 
 #include "cac.h"
 #include "vcard.h"
libcacard/card_7816.c +3 -1
index 814fa16..22fd334 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/event.c +1 -1
index 4c551e4..63f4057 100644
@@ -5,7 +5,7 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "vreader.h"
libcacard/vcard.c +3 -1
index d140a8e..1a87208 100644
@@ -5,7 +5,9 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vcard_emul_nss.c +1 -1
index 950edee..6955f69 100644
@@ -25,7 +25,7 @@
 #include <prthread.h>
 #include <secerr.h>
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vcard.h"
 #include "card_7816t.h"
libcacard/vreader.c +3 -1
index 0315dd8..9725f46 100644
@@ -10,7 +10,9 @@
 #endif
 #define G_LOG_DOMAIN "libcacard"
 
-#include "qemu-common.h"
+#include "glib-compat.h"
+
+#include <string.h>
 
 #include "vcard.h"
 #include "vcard_emul.h"
libcacard/vscclient.c +7 -2
index fa6041d..0652684 100644
@@ -10,14 +10,20 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #ifndef _WIN32
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include <unistd.h>
 #define closesocket(x) close(x)
+#else
+#include <getopt.h>
 #endif
 
-#include "qemu-common.h"
+#include "glib-compat.h"
 
 #include "vscard_common.h"
 
--

2.1.4

#3 lore raw
Quoted 9 lines · Laurent Desnogues

Hello,

Quoted 3 lines · Michael Tokarev

From: Paolo Bonzini <[email protected]>

This is a small step towards making libcacard standalone.

on my system the removal of qemu-common.h inclusion broke compilation due to assert being used in glib-compat.h.

Interesting. What kind of build environment is that? I compile-tested on several platforms, all went fine.. ;)

Quoted 2 lines

A fix might be to include
assert.h in glib-compat.h.

I prefer s/assert/g_assert/ in glib-compat.h.

Thanks,

/mjt

#4 lore raw
Quoted 6 lines · Michael Tokarev
Quoted 5 lines · Laurent Desnogues

Hello,

Quoted 2 lines · Michael Tokarev

From: Paolo Bonzini <[email protected]>

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

This is a small step towards making libcacard standalone.

on my system the removal of qemu-common.h inclusion broke compilation due to assert being used in glib-compat.h.

Interesting. What kind of build environment is that? I compile-tested on several platforms, all went fine.. ;)

That's a CentOS 6.6 machine with glib2 2.28.8.

Quoted 4 lines
Quoted 2 lines

A fix might be to include
assert.h in glib-compat.h.

I prefer s/assert/g_assert/ in glib-compat.h.

That indeed looks better :-)

Thanks,

Laurent

Quoted 4 lines

Thanks,

/mjt