Replaced some large local variables by other means which save stack space

This commit is contained in:
Thomas Schmitt 2011-05-02 09:09:10 +00:00
parent 686659514b
commit 4926c98dd4
2 changed files with 29 additions and 19 deletions

View File

@ -463,24 +463,31 @@ return:
*/
{
int i,ret;
char reply[SfileadrL];
char *reply= NULL;
reply= TSOB_FELD(char, SfileadrL);
if(reply == NULL)
return(-1);
*reply_count= 0;
for(i=0;i<max_replies;i++) {
ret= Dirseq_next_adr(o,reply,flag&(1|2|4));
if(ret<0)
return(ret);
goto ex;
if(ret==0)
break;
if(Sregex_string(&(replies[i]),reply,0)<=0)
return(-1);
{ret= -1; goto ex;}
(*reply_count)++;
}
if((*reply_count)==0)
return(0);
{ret= 0; goto ex;}
if(flag&16)
Sort_argv(*reply_count,replies,0);
return(1);
ret= 1;
ex:;
free(reply);
return(ret);
}
@ -764,7 +771,7 @@ int Exclusions_add_not_leafs(struct ExclusionS *o, char *not_leafs_descr,
int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
{
struct Xorriso_lsT *s;
char leaf[SfileadrL], *leaf_pt;
char *leaf= NULL, *leaf_pt;
regmatch_t match[1];
int ret, was_non_slash, l;
@ -774,12 +781,12 @@ int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
l= strlen(s->text);
if(strncmp(abs_path, s->text, l)==0)
if(abs_path[l]=='/' || abs_path[l]==0)
return(1);
{ret= 1; goto ex;}
}
} else {
for(s= o->not_paths; s!=NULL; s= s->next)
if(strcmp(abs_path, s->text)==0)
return(1);
{ret= 1; goto ex;}
}
/* determine leafname */
@ -794,8 +801,8 @@ int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
was_non_slash= 1;
}
if(strlen(leaf_pt)>=SfileadrL)
return(-1);
strcpy(leaf, leaf_pt);
{ret= -1; goto ex;}
leaf= strdup(leaf_pt);
leaf_pt= strchr(leaf, '/');
if(leaf_pt!=NULL)
*leaf_pt= 0;
@ -804,9 +811,13 @@ int Exclusions_match(struct ExclusionS *o, char *abs_path, int flag)
for(s= o->not_leafs; s!=NULL; s= s->next) {
ret= regexec((regex_t *) s->text, leaf, 1, match, 0);
if(ret==0)
return(2);
{ret= 2; goto ex;}
}
return(0);
ret= 0;
ex:
if(leaf != NULL)
free(leaf);
return(ret);
}
@ -953,7 +964,6 @@ int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper,
struct XorrisO *xorriso, int flag)
{
int ret;
char sfe[5*SfileadrL];
struct utimbuf utime_buffer;
struct PermiteM *m, *m_next;
@ -974,9 +984,9 @@ int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper,
if(ret==-1) {
if(xorriso!=NULL) {
sprintf(xorriso->info_text,
"Cannot change access permissions of disk directory: chmod %o %s",
(unsigned int) (m->stbuf.st_mode & 07777),
Text_shellsafe(m->disk_path, sfe, 0));
"Cannot change access permissions of disk directory: chmod %o ",
(unsigned int) (m->stbuf.st_mode & 07777));
Text_shellsafe(m->disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
0);
}
@ -990,8 +1000,8 @@ int Permstack_pop(struct PermiteM **o, struct PermiteM *stopper,
ret= utime(m->disk_path,&utime_buffer);
if(ret==-1 && xorriso!=NULL) {
sprintf(xorriso->info_text,
"Cannot change timestamps of disk directory: %s",
Text_shellsafe(m->disk_path, sfe, 0));
"Cannot change timestamps of disk directory: ");
Text_shellsafe(m->disk_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
0);
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.04.30.121138"
#define Xorriso_timestamP "2011.05.02.090908"