Made improvements about pattern matching .., closed small memory leaks

This commit is contained in:
Thomas Schmitt 2008-01-15 17:45:08 +00:00
parent f5ee0b3e93
commit f1a2b29e4f
8 changed files with 65 additions and 10 deletions

View File

@ -102,9 +102,6 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
/* >>> NG How to set severities before isoburn_read_image() ? /* >>> NG How to set severities before isoburn_read_image() ?
iso_image_set_msgs_severities() demands an IsoImage iso_image_set_msgs_severities() demands an IsoImage
*/
/*
iso_image_msgs_set_severities(queue_sev, print_sev, "libisofs >>> NG : ");
*/ */
burn_msgs_set_severities(queue_sev, print_sev, "libburn : "); burn_msgs_set_severities(queue_sev, print_sev, "libburn : ");
@ -122,6 +119,15 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
} }
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag)
{
if(xorriso->libs_are_started==0)
return(0);
isoburn_finish();
return(1);
}
/* @param flag bit1= obtain outdrive, else indrive */ /* @param flag bit1= obtain outdrive, else indrive */
int Xorriso_get_drive_handles(struct XorrisO *xorriso, int Xorriso_get_drive_handles(struct XorrisO *xorriso,
struct burn_drive_info **dinfo, struct burn_drive_info **dinfo,

View File

@ -19,6 +19,8 @@ struct FindjoB;
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag); int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);
/* @param flag bit0=aquire as isoburn input drive /* @param flag bit0=aquire as isoburn input drive

View File

@ -2957,6 +2957,7 @@ int Xorriso_destroy_re(struct XorrisO *m, int flag)
} }
/* @param flag bit0= shutdown libraries */
int Xorriso_destroy(struct XorrisO **xorriso, int flag) int Xorriso_destroy(struct XorrisO **xorriso, int flag)
{ {
struct XorrisO *m; struct XorrisO *m;
@ -2964,7 +2965,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
m= *xorriso; m= *xorriso;
if(m==NULL) if(m==NULL)
return(0); return(0);
Xorriso_give_up_drive(m, 3);
Xorriso_destroy_re(m,0); Xorriso_destroy_re(m,0);
if(flag&1)
Xorriso_shutdown_libraries(m, 0);
free((char *) m); free((char *) m);
*xorriso= NULL; *xorriso= NULL;
@ -3450,7 +3454,7 @@ int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag)
int l,ret,i,count,bonked= 0,is_constant,is_still_relative= 0; int l,ret,i,count,bonked= 0,is_constant,is_still_relative= 0;
char *cpt,*npt,adr_part[2*SfileadrL],absolute_adr[2*SfileadrL],*adr_start,*wd; char *cpt,*npt,adr_part[2*SfileadrL],absolute_adr[2*SfileadrL],*adr_start,*wd;
if(flag&2) if(flag&4)
wd= xorriso->wdx; wd= xorriso->wdx;
else else
wd= xorriso->wdi; wd= xorriso->wdi;
@ -3535,11 +3539,12 @@ no_regex_available:;
if(adr_part[0]==0) if(adr_part[0]==0)
goto next_adr_part; goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]==0 && count>1) if(adr_part[0]=='.' && adr_part[1]==0 &&
(xorriso->re_fill>0 || i<count-1))
goto next_adr_part; goto next_adr_part;
if(adr_part[0]=='.' && adr_part[1]=='.' && adr_part[2]==0) { if(adr_part[0]=='.' && adr_part[1]=='.' && adr_part[2]==0) {
/* delete previous part */ /* delete previous part */
if(xorriso->re_fill<=0) { if(xorriso->re_fill<=1) {
bonked= 1; bonked= 1;
goto next_adr_part; goto next_adr_part;
} }
@ -8923,7 +8928,7 @@ end_sucessfully:;
if(xorriso->volset_change_pending) if(xorriso->volset_change_pending)
Xorriso_option_end(xorriso, 0); Xorriso_option_end(xorriso, 0);
Xorriso_process_msg_queues(xorriso, 0); Xorriso_process_msg_queues(xorriso, 0);
Xorriso_destroy(&xorriso,0); Xorriso_destroy(&xorriso,1);
exit(0); exit(0);
} }

View File

@ -16,6 +16,29 @@
struct XorrisO; struct XorrisO;
/* --------------------- Fundamental Management ------------------- */
/* Create a new xorriso object and tell it the program name to be used
with messages.
*/
int Xorriso_new(struct XorrisO ** xorriso, char *progname, int flag);
/* Make global library initializations.
This must be done with the first xorriso object that gets created and
with the first xorriso object that gets created after Xorriso_destroy(,1).
*/
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
/* Destroy xorriso object when it is no longer needed.
@param flag bit0= Make global librariy shutdown.
Use only with last xorriso object to be destroyed.
*/
int Xorriso_destroy(struct XorrisO **xorriso, int flag);
/* --------------------- Problem Status and Message API ------------------- */ /* --------------------- Problem Status and Message API ------------------- */

View File

@ -185,8 +185,6 @@ struct XorrisO { /* the global context of xorriso */
}; };
int Xorriso_destroy(struct XorrisO **xorriso, int flag);
int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag); int Xorriso_prepare_regex(struct XorrisO *xorriso, char *adr, int flag);
int Xorriso_result(struct XorrisO *xorriso, int flag); int Xorriso_result(struct XorrisO *xorriso, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.14.224645" #define Xorriso_timestamP "2008.01.15.174409"

View File

@ -101,6 +101,15 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
} }
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag)
{
if(xorriso->libs_are_started==0)
return(0);
isoburn_finish();
return(1);
}
/* @param flag bit1= obtain outdrive, else indrive */ /* @param flag bit1= obtain outdrive, else indrive */
int Xorriso_get_drive_handles(struct XorrisO *xorriso, int Xorriso_get_drive_handles(struct XorrisO *xorriso,
struct burn_drive_info **dinfo, struct burn_drive_info **dinfo,
@ -3014,3 +3023,11 @@ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag)
} }
int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag)
{
/* OG dummy */;
volid[0]= 0;
return(1);
}

View File

@ -19,6 +19,8 @@ struct FindjoB;
int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag); int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_shutdown_libraries(struct XorrisO *xorriso, int flag);
int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag); int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag);
/* @param flag bit0=aquire as isoburn input drive /* @param flag bit0=aquire as isoburn input drive
@ -129,5 +131,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag); int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag);
int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag);
#endif /* Xorrisoburn_includeD */ #endif /* Xorrisoburn_includeD */