libcacard: Fix cppcheck warning and remove unneeded code
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 <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
		
							parent
							
								
									4f08005776
								
							
						
					
					
						commit
						48f0475f81
					
				| 
						 | 
					@ -90,17 +90,13 @@ static int nss_emul_init;
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * allocate the set of arrays for certs, cert_len, key
 | 
					 * allocate the set of arrays for certs, cert_len, key
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static PRBool
 | 
					static void
 | 
				
			||||||
vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp,
 | 
					vcard_emul_alloc_arrays(unsigned char ***certsp, int **cert_lenp,
 | 
				
			||||||
                        VCardKey ***keysp, int cert_count)
 | 
					                        VCardKey ***keysp, int cert_count)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    *certsp = NULL;
 | 
					 | 
				
			||||||
    *cert_lenp = NULL;
 | 
					 | 
				
			||||||
    *keysp = NULL;
 | 
					 | 
				
			||||||
    *certsp = (unsigned char **)g_malloc(sizeof(unsigned char *)*cert_count);
 | 
					    *certsp = (unsigned char **)g_malloc(sizeof(unsigned char *)*cert_count);
 | 
				
			||||||
    *cert_lenp = (int *)g_malloc(sizeof(int)*cert_count);
 | 
					    *cert_lenp = (int *)g_malloc(sizeof(int)*cert_count);
 | 
				
			||||||
    *keysp = (VCardKey **)g_malloc(sizeof(VCardKey *)*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;
 | 
					    int *cert_len;
 | 
				
			||||||
    VCardKey **keys;
 | 
					    VCardKey **keys;
 | 
				
			||||||
    PK11SlotInfo *slot;
 | 
					    PK11SlotInfo *slot;
 | 
				
			||||||
    PRBool ret;
 | 
					 | 
				
			||||||
    VCard *card;
 | 
					    VCard *card;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    slot = vcard_emul_reader_get_slot(vreader);
 | 
					    slot = vcard_emul_reader_get_slot(vreader);
 | 
				
			||||||
| 
						 | 
					@ -627,10 +622,7 @@ vcard_emul_mirror_card(VReader *vreader)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* allocate the arrays */
 | 
					    /* allocate the arrays */
 | 
				
			||||||
    ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
 | 
					    vcard_emul_alloc_arrays(&certs, &cert_len, &keys, cert_count);
 | 
				
			||||||
    if (ret == PR_FALSE) {
 | 
					 | 
				
			||||||
        return NULL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* fill in the arrays */
 | 
					    /* fill in the arrays */
 | 
				
			||||||
    cert_count = 0;
 | 
					    cert_count = 0;
 | 
				
			||||||
| 
						 | 
					@ -878,7 +870,7 @@ VCardEmulError
 | 
				
			||||||
vcard_emul_init(const VCardEmulOptions *options)
 | 
					vcard_emul_init(const VCardEmulOptions *options)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SECStatus rv;
 | 
					    SECStatus rv;
 | 
				
			||||||
    PRBool ret, has_readers = PR_FALSE;
 | 
					    PRBool has_readers = PR_FALSE;
 | 
				
			||||||
    VReader *vreader;
 | 
					    VReader *vreader;
 | 
				
			||||||
    VReaderEmul *vreader_emul;
 | 
					    VReaderEmul *vreader_emul;
 | 
				
			||||||
    SECMODListLock *module_lock;
 | 
					    SECMODListLock *module_lock;
 | 
				
			||||||
| 
						 | 
					@ -944,11 +936,9 @@ vcard_emul_init(const VCardEmulOptions *options)
 | 
				
			||||||
        vreader_add_reader(vreader);
 | 
					        vreader_add_reader(vreader);
 | 
				
			||||||
        cert_count = options->vreader[i].cert_count;
 | 
					        cert_count = options->vreader[i].cert_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ret = vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
 | 
					        vcard_emul_alloc_arrays(&certs, &cert_len, &keys,
 | 
				
			||||||
                                      options->vreader[i].cert_count);
 | 
					                                options->vreader[i].cert_count);
 | 
				
			||||||
        if (ret == PR_FALSE) {
 | 
					
 | 
				
			||||||
            continue;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        cert_count = 0;
 | 
					        cert_count = 0;
 | 
				
			||||||
        for (j = 0; j < options->vreader[i].cert_count; j++) {
 | 
					        for (j = 0; j < options->vreader[i].cert_count; j++) {
 | 
				
			||||||
            /* we should have a better way of identifying certs than by
 | 
					            /* we should have a better way of identifying certs than by
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue