Replaced some large local variables by other means in libisofs/builder.c
This commit is contained in:
parent
3ef67cb49d
commit
d932bfcdea
@ -4,10 +4,10 @@
|
|||||||
Arbitrary Attribute Interchange Protocol , AAIP versions 0.2 , 1.0 , 2.0.
|
Arbitrary Attribute Interchange Protocol , AAIP versions 0.2 , 1.0 , 2.0.
|
||||||
Implementation of encoding and decoding xattr and ACL.
|
Implementation of encoding and decoding xattr and ACL.
|
||||||
|
|
||||||
See test/aaip_0_2.h
|
See libisofs/aaip_0_2.h
|
||||||
http://libburnia-project.org/wiki/AAIP
|
http://libburnia-project.org/wiki/AAIP
|
||||||
|
|
||||||
Copyright (c) 2009 Thomas Schmitt, libburnia project, GPLv2+
|
Copyright (c) 2009 - 2011 Thomas Schmitt, libburnia project, GPLv2+
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Vreixo Formoso
|
* Copyright (c) 2007 Vreixo Formoso
|
||||||
* Copyright (c) 2009 Thomas Schmitt
|
* Copyright (c) 2009 - 2011 Thomas Schmitt
|
||||||
*
|
*
|
||||||
* This file is part of the libisofs project; you can redistribute it and/or
|
* This file is part of the libisofs project; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License version 2
|
* modify it under the terms of the GNU General Public License version 2
|
||||||
@ -20,6 +20,7 @@
|
|||||||
#include "fsource.h"
|
#include "fsource.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "aaip_0_2.h"
|
#include "aaip_0_2.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -104,9 +105,11 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
|||||||
char *name;
|
char *name;
|
||||||
unsigned char *aa_string = NULL;
|
unsigned char *aa_string = NULL;
|
||||||
char *a_text = NULL, *d_text = NULL;
|
char *a_text = NULL, *d_text = NULL;
|
||||||
|
char *dest = NULL;
|
||||||
|
IsoSymlink *link;
|
||||||
|
|
||||||
if (builder == NULL || src == NULL || node == NULL) {
|
if (builder == NULL || src == NULL || node == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
{ret = ISO_NULL_POINTER; goto ex;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get info about source */
|
/* get info about source */
|
||||||
@ -116,7 +119,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
|||||||
ret = iso_file_source_lstat(src, &info);
|
ret = iso_file_source_lstat(src, &info);
|
||||||
}
|
}
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = iso_file_source_get_name(src);
|
name = iso_file_source_get_name(src);
|
||||||
@ -157,9 +160,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
|||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
{
|
{
|
||||||
/* source is a symbolic link */
|
/* source is a symbolic link */
|
||||||
char dest[LIBISOFS_NODE_PATH_MAX];
|
LIBISO_ALLOC_MEM(dest, char, LIBISOFS_NODE_PATH_MAX);
|
||||||
IsoSymlink *link;
|
|
||||||
|
|
||||||
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
ret = iso_file_source_readlink(src, dest, LIBISOFS_NODE_PATH_MAX);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
break;
|
break;
|
||||||
@ -198,7 +199,7 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
|||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
free(name);
|
free(name);
|
||||||
return ret;
|
goto ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill fields */
|
/* fill fields */
|
||||||
@ -233,14 +234,17 @@ int default_create_node(IsoNodeBuilder *builder, IsoImage *image,
|
|||||||
if (ret == 1 && aa_string != NULL) {
|
if (ret == 1 && aa_string != NULL) {
|
||||||
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
|
ret = iso_node_add_xinfo(new, aaip_xinfo_func, aa_string);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto ex;
|
||||||
} else if(aa_string != NULL) {
|
} else if(aa_string != NULL) {
|
||||||
free(aa_string);
|
free(aa_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
*node = new;
|
*node = new;
|
||||||
|
|
||||||
return ISO_SUCCESS;
|
ret = ISO_SUCCESS;
|
||||||
|
ex:;
|
||||||
|
LIBISO_FREE_MEM(dest);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
Loading…
Reference in New Issue
Block a user