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

@ -146,7 +146,7 @@ int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag)
{
int ret, i, i_end, imgid, error_code;
size_t value_length= 0;
char *value= NULL, msg[ISO_MSGS_MESSAGE_LEN], severity[80];
char *value= NULL, *msg= NULL, severity[80];
unsigned char *vpt;
static char *name= "isofs.di";
@ -155,13 +155,16 @@ int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag)
Xorriso_get_di_counteR++;
#endif /* NIX */
msg= TSOB_FELD(char, ISO_MSGS_MESSAGE_LEN);
if(msg == NULL)
{ret= -1; goto ex;}
*dev= 0;
*ino= 0;
ret= iso_node_lookup_attr(node, name, &value_length, &value, 0);
if(ret <= 0) {
/* Drop any pending messages because there is no xorriso to take them */
iso_obtain_msgs("NEVER", &error_code, &imgid, msg, severity);
return(ret);
goto ex;
}
vpt= (unsigned char *) value;
for(i= 1; i <= vpt[0] && i < value_length; i++)
@ -170,7 +173,11 @@ int Xorriso__get_di(IsoNode *node, dev_t *dev, ino_t *ino, int flag)
for(i++; i < i_end && i < value_length; i++)
*ino= ((*ino) << 8) | vpt[i];
free(value);
return(1);
ret= 1;
ex:;
if(msg != NULL)
free(msg);
return(ret);
}