mirror of https://github.com/xemu-project/xemu.git
libcacard: remove useless initializers
libcacard has many functions which initializes local variables at declaration time, which are always assigned some values later (often right after declaration). Clean up these initializers. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
116d554601
commit
1687a089f1
|
@ -93,8 +93,8 @@ cac_common_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response)
|
||||||
static VCardStatus
|
static VCardStatus
|
||||||
cac_applet_pki_reset(VCard *card, int channel)
|
cac_applet_pki_reset(VCard *card, int channel)
|
||||||
{
|
{
|
||||||
VCardAppletPrivate *applet_private = NULL;
|
VCardAppletPrivate *applet_private;
|
||||||
CACPKIAppletData *pki_applet = NULL;
|
CACPKIAppletData *pki_applet;
|
||||||
applet_private = vcard_get_current_applet_private(card, channel);
|
applet_private = vcard_get_current_applet_private(card, channel);
|
||||||
assert(applet_private);
|
assert(applet_private);
|
||||||
pki_applet = &(applet_private->u.pki_data);
|
pki_applet = &(applet_private->u.pki_data);
|
||||||
|
@ -113,8 +113,8 @@ static VCardStatus
|
||||||
cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu,
|
cac_applet_pki_process_apdu(VCard *card, VCardAPDU *apdu,
|
||||||
VCardResponse **response)
|
VCardResponse **response)
|
||||||
{
|
{
|
||||||
CACPKIAppletData *pki_applet = NULL;
|
CACPKIAppletData *pki_applet;
|
||||||
VCardAppletPrivate *applet_private = NULL;
|
VCardAppletPrivate *applet_private;
|
||||||
int size, next;
|
int size, next;
|
||||||
unsigned char *sign_buffer;
|
unsigned char *sign_buffer;
|
||||||
vcard_7816_status_t status;
|
vcard_7816_status_t status;
|
||||||
|
@ -279,7 +279,7 @@ cac_applet_container_process_apdu(VCard *card, VCardAPDU *apdu,
|
||||||
static void
|
static void
|
||||||
cac_delete_pki_applet_private(VCardAppletPrivate *applet_private)
|
cac_delete_pki_applet_private(VCardAppletPrivate *applet_private)
|
||||||
{
|
{
|
||||||
CACPKIAppletData *pki_applet_data = NULL;
|
CACPKIAppletData *pki_applet_data;
|
||||||
|
|
||||||
if (applet_private == NULL) {
|
if (applet_private == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -327,8 +327,8 @@ static VCardApplet *
|
||||||
cac_new_pki_applet(int i, const unsigned char *cert,
|
cac_new_pki_applet(int i, const unsigned char *cert,
|
||||||
int cert_len, VCardKey *key)
|
int cert_len, VCardKey *key)
|
||||||
{
|
{
|
||||||
VCardAppletPrivate *applet_private = NULL;
|
VCardAppletPrivate *applet_private;
|
||||||
VCardApplet *applet = NULL;
|
VCardApplet *applet;
|
||||||
unsigned char pki_aid[] = { 0xa0, 0x00, 0x00, 0x00, 0x79, 0x01, 0x00 };
|
unsigned char pki_aid[] = { 0xa0, 0x00, 0x00, 0x00, 0x79, 0x01, 0x00 };
|
||||||
int pki_aid_len = sizeof(pki_aid);
|
int pki_aid_len = sizeof(pki_aid);
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_GENERAL)
|
||||||
VCardResponse *
|
VCardResponse *
|
||||||
vcard_make_response(vcard_7816_status_t status)
|
vcard_make_response(vcard_7816_status_t status)
|
||||||
{
|
{
|
||||||
VCardResponse *response = NULL;
|
VCardResponse *response;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
/* known 7816 response codes */
|
/* known 7816 response codes */
|
||||||
|
@ -543,9 +543,8 @@ vcard_make_response(vcard_7816_status_t status)
|
||||||
return VCARD_RESPONSE_GET_STATIC(
|
return VCARD_RESPONSE_GET_STATIC(
|
||||||
VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE);
|
VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
assert(response);
|
|
||||||
return response;
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -166,8 +166,8 @@ vcard_reference(VCard *vcard)
|
||||||
void
|
void
|
||||||
vcard_free(VCard *vcard)
|
vcard_free(VCard *vcard)
|
||||||
{
|
{
|
||||||
VCardApplet *current_applet = NULL;
|
VCardApplet *current_applet;
|
||||||
VCardApplet *next_applet = NULL;
|
VCardApplet *next_applet;
|
||||||
|
|
||||||
if (vcard == NULL) {
|
if (vcard == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -367,7 +367,7 @@ vcard_7816_status_t
|
||||||
vcard_emul_login(VCard *card, unsigned char *pin, int pin_len)
|
vcard_emul_login(VCard *card, unsigned char *pin, int pin_len)
|
||||||
{
|
{
|
||||||
PK11SlotInfo *slot;
|
PK11SlotInfo *slot;
|
||||||
unsigned char *pin_string = NULL;
|
unsigned char *pin_string;
|
||||||
int i;
|
int i;
|
||||||
SECStatus rv;
|
SECStatus rv;
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ static VReader *
|
||||||
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot)
|
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot)
|
||||||
{
|
{
|
||||||
VReaderList *reader_list = vreader_get_reader_list();
|
VReaderList *reader_list = vreader_get_reader_list();
|
||||||
VReaderListEntry *current_entry = NULL;
|
VReaderListEntry *current_entry;
|
||||||
|
|
||||||
if (reader_list == NULL) {
|
if (reader_list == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1047,7 +1047,7 @@ void
|
||||||
vcard_emul_replay_insertion_events(void)
|
vcard_emul_replay_insertion_events(void)
|
||||||
{
|
{
|
||||||
VReaderListEntry *current_entry;
|
VReaderListEntry *current_entry;
|
||||||
VReaderListEntry *next_entry = NULL;
|
VReaderListEntry *next_entry;
|
||||||
VReaderList *list = vreader_get_reader_list();
|
VReaderList *list = vreader_get_reader_list();
|
||||||
|
|
||||||
for (current_entry = vreader_list_get_first(list); current_entry;
|
for (current_entry = vreader_list_get_first(list); current_entry;
|
||||||
|
|
|
@ -339,7 +339,7 @@ void
|
||||||
vreader_list_delete(VReaderList *list)
|
vreader_list_delete(VReaderList *list)
|
||||||
{
|
{
|
||||||
VReaderListEntry *current_entry;
|
VReaderListEntry *current_entry;
|
||||||
VReaderListEntry *next_entry = NULL;
|
VReaderListEntry *next_entry;
|
||||||
for (current_entry = vreader_list_get_first(list); current_entry;
|
for (current_entry = vreader_list_get_first(list); current_entry;
|
||||||
current_entry = next_entry) {
|
current_entry = next_entry) {
|
||||||
next_entry = vreader_list_get_next(current_entry);
|
next_entry = vreader_list_get_next(current_entry);
|
||||||
|
@ -430,8 +430,8 @@ vreader_list_unlock(void)
|
||||||
static VReaderList *
|
static VReaderList *
|
||||||
vreader_copy_list(VReaderList *list)
|
vreader_copy_list(VReaderList *list)
|
||||||
{
|
{
|
||||||
VReaderList *new_list = NULL;
|
VReaderList *new_list;
|
||||||
VReaderListEntry *current_entry = NULL;
|
VReaderListEntry *current_entry;
|
||||||
|
|
||||||
new_list = vreader_list_new();
|
new_list = vreader_list_new();
|
||||||
if (new_list == NULL) {
|
if (new_list == NULL) {
|
||||||
|
@ -463,7 +463,7 @@ VReader *
|
||||||
vreader_get_reader_by_id(vreader_id_t id)
|
vreader_get_reader_by_id(vreader_id_t id)
|
||||||
{
|
{
|
||||||
VReader *reader = NULL;
|
VReader *reader = NULL;
|
||||||
VReaderListEntry *current_entry = NULL;
|
VReaderListEntry *current_entry;
|
||||||
|
|
||||||
if (id == (vreader_id_t) -1) {
|
if (id == (vreader_id_t) -1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -487,7 +487,7 @@ VReader *
|
||||||
vreader_get_reader_by_name(const char *name)
|
vreader_get_reader_by_name(const char *name)
|
||||||
{
|
{
|
||||||
VReader *reader = NULL;
|
VReader *reader = NULL;
|
||||||
VReaderListEntry *current_entry = NULL;
|
VReaderListEntry *current_entry;
|
||||||
|
|
||||||
vreader_list_lock();
|
vreader_list_lock();
|
||||||
for (current_entry = vreader_list_get_first(vreader_list); current_entry;
|
for (current_entry = vreader_list_get_first(vreader_list); current_entry;
|
||||||
|
|
|
@ -131,8 +131,8 @@ static void *
|
||||||
event_thread(void *arg)
|
event_thread(void *arg)
|
||||||
{
|
{
|
||||||
unsigned char atr[MAX_ATR_LEN];
|
unsigned char atr[MAX_ATR_LEN];
|
||||||
int atr_len = MAX_ATR_LEN;
|
int atr_len;
|
||||||
VEvent *event = NULL;
|
VEvent *event;
|
||||||
unsigned int reader_id;
|
unsigned int reader_id;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue