Replaced some large local variables by other means

This commit is contained in:
2011-05-08 17:47:43 +00:00
parent f5ceb22dea
commit 1b3558580e
8 changed files with 50 additions and 15 deletions

View File

@ -1080,13 +1080,15 @@ ex:;
int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
{
char adr[BURN_DRIVE_ADR_LEN];
int i, j, max_dev_len= 1, pad;
char *adr= NULL;
int i, j, max_dev_len= 1, pad, ret;
struct burn_drive_info *drive_list= NULL;
unsigned int drive_count;
char *respt, perms[8];
struct stat stbuf;
Xorriso_alloc_meM(adr, char, BURN_DRIVE_ADR_LEN);
sprintf(xorriso->info_text, "Beginning to scan for devices ...\n");
Xorriso_info(xorriso,0);
@ -1103,7 +1105,7 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
sprintf(xorriso->info_text, "No drives found");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
{ret= 0; goto ex;}
}
sprintf(xorriso->info_text, "Full drive scan done\n");
Xorriso_info(xorriso,0);
@ -1147,7 +1149,10 @@ int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
burn_drive_info_free(drive_list);
Xorriso_process_msg_queues(xorriso,0);
return(1);
ret= 1;
ex:;
Xorriso_free_meM(adr);
return(ret);
}
@ -1580,13 +1585,16 @@ int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba,
struct burn_drive_info *dinfo= NULL;
struct burn_drive *drive= NULL;
off_t pos, data_count, to_read;
char data[64 * 1024], data_md5[16];
char *data= NULL, data_md5[16];
void *ctx = NULL;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to check session MD5 checksum", 0);
if(ret <= 0)
goto ex;
Xorriso_alloc_meM(data, char, 64 * 1024);
ret= iso_md5_start(&ctx);
if(ret <= 0) {
Xorriso_no_malloc_memory(xorriso, NULL, 0);
@ -1614,6 +1622,7 @@ ex:;
Xorriso_process_msg_queues(xorriso,0);
if(ctx != NULL)
iso_md5_end(&ctx, data_md5);
Xorriso_free_meM(data);
return(ret);
}