[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/17] libcacard: Fix cppcheck warning and remove unn
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 06/17] libcacard: Fix cppcheck warning and remove unneeded code |
Date: |
Sat, 22 Jun 2013 13:24:25 +0400 |
From: Stefan Weil <address@hidden>
The local function vcard_emul_alloc_arrays always returned PR_TRUE.
Therefore cppcheck complained about code which handled the
non-existent PR_FALSE case.
Remove the function's return value and the dead code.
Signed-off-by: Stefan Weil <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
libcacard/vcard_emul_nss.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index 1a3e568..fb429b1 100644
--- a/libcacard/vcard_emul_nss.c
+++ b/libcacard/vcard_emul_nss.c
@@ -90,17 +90,13 @@ static int nss_emul_init;
/*
* allocate the set of arrays for certs, cert_len, key
*/
-static PRBool
+static void
vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp,
VCardKey ***keysp, int cert_count)
{
- *certsp = NULL;
- *cert_lenp = NULL;
- *keysp = NULL;
*certsp = (unsigned char **)g_malloc(sizeof(unsigned char *)*cert_count);
*cert_lenp = (int *)g_malloc(sizeof(int)*cert_count);
*keysp = (VCardKey **)g_malloc(sizeof(VCardKey *)*cert_count);
- return PR_TRUE;
}
/*
@@ -601,7 +597,6 @@ vcard_emul_mirror_card(VReader *vreader)
int *cert_len;
VCardKey **keys;
PK11SlotInfo *slot;
- PRBool ret;
VCard *card;
slot = vcard_emul_reader_get_slot(vreader);
@@ -627,10 +622,7 @@ vcard_emul_mirror_card(VReader *vreader)
}
/* allocate the arrays */
- ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
- if (ret == PR_FALSE) {
- return NULL;
- }
+ vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
/* fill in the arrays */
cert_count = 0;
@@ -878,7 +870,7 @@ VCardEmulError
vcard_emul_init(const VCardEmulOptions *options)
{
SECStatus rv;
- PRBool ret, has_readers = PR_FALSE;
+ PRBool has_readers = PR_FALSE;
VReader *vreader;
VReaderEmul *vreader_emul;
SECMODListLock *module_lock;
@@ -944,11 +936,9 @@ vcard_emul_init(const VCardEmulOptions *options)
vreader_add_reader(vreader);
cert_count = options->vreader[i].cert_count;
- ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
- options->vreader[i].cert_count);
- if (ret == PR_FALSE) {
- continue;
- }
+ vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
+ options->vreader[i].cert_count);
+
cert_count = 0;
for (j = 0; j < options->vreader[i].cert_count; j++) {
/* we should have a better way of identifying certs than by
--
1.7.10.4
- [Qemu-devel] [PULL 03/17] qemu-img: Add missing GCC_FMT_ATTR, (continued)
- [Qemu-devel] [PULL 03/17] qemu-img: Add missing GCC_FMT_ATTR, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 04/17] kvm: Fix potential resource leak (missing fclose), Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 05/17] savevm: Fix potential memory leak, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 12/17] vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 17/17] configure: Add signed*signed check to [u]int128_t test, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 16/17] Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 08/17] configure: Fix "ERROR: ERROR: " for missing/incompatible DTC, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 13/17] qemu-char: use bool in qemu_chr_open_socket and simplify code a bit, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 07/17] audio: Replace static functions in header file by macros, remove GCC_ATTR, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 09/17] acl: acl_add can't insert before last list element, fix, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 06/17] libcacard: Fix cppcheck warning and remove unneeded code,
Michael Tokarev <=
- [Qemu-devel] [PULL 15/17] qapi: lack of two commas in dict, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 10/17] qxl: Fix QXLRam initialisation., Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 14/17] sd: pass bool parameter for sd_init, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 11/17] block/nand: Formatting sweep, Michael Tokarev, 2013/06/22