busctl introspect: use free_and_replace()
This commit is contained in:
@@ -143,9 +143,7 @@ static int parse_xml_annotation(Context *context, uint64_t *flags) {
|
||||
case STATE_NAME:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
free(field);
|
||||
field = name;
|
||||
name = NULL;
|
||||
free_and_replace(field, name);
|
||||
|
||||
state = STATE_ANNOTATION;
|
||||
} else {
|
||||
@@ -158,9 +156,7 @@ static int parse_xml_annotation(Context *context, uint64_t *flags) {
|
||||
case STATE_VALUE:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
free(value);
|
||||
value = name;
|
||||
name = NULL;
|
||||
free_and_replace(value, name);
|
||||
|
||||
state = STATE_ANNOTATION;
|
||||
} else {
|
||||
@@ -351,11 +347,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_INTERFACE_NAME:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
if (n_depth == 0) {
|
||||
free(context->interface_name);
|
||||
context->interface_name = name;
|
||||
name = NULL;
|
||||
}
|
||||
if (n_depth == 0)
|
||||
free_and_replace(context->interface_name, name);
|
||||
|
||||
state = STATE_INTERFACE;
|
||||
} else {
|
||||
@@ -410,12 +403,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_METHOD_NAME:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
|
||||
if (n_depth == 0) {
|
||||
free(context->member_name);
|
||||
context->member_name = name;
|
||||
name = NULL;
|
||||
}
|
||||
if (n_depth == 0)
|
||||
free_and_replace(context->member_name, name);
|
||||
|
||||
state = STATE_METHOD;
|
||||
} else {
|
||||
@@ -489,9 +478,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_METHOD_ARG_TYPE:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
free(argument_type);
|
||||
argument_type = name;
|
||||
name = NULL;
|
||||
free_and_replace(argument_type, name);
|
||||
|
||||
state = STATE_METHOD_ARG;
|
||||
} else {
|
||||
@@ -504,9 +491,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_METHOD_ARG_DIRECTION:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
free(argument_direction);
|
||||
argument_direction = name;
|
||||
name = NULL;
|
||||
free_and_replace(argument_direction, name);
|
||||
|
||||
state = STATE_METHOD_ARG;
|
||||
} else {
|
||||
@@ -561,12 +546,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_SIGNAL_NAME:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
|
||||
if (n_depth == 0) {
|
||||
free(context->member_name);
|
||||
context->member_name = name;
|
||||
name = NULL;
|
||||
}
|
||||
if (n_depth == 0)
|
||||
free_and_replace(context->member_name, name);
|
||||
|
||||
state = STATE_SIGNAL;
|
||||
} else {
|
||||
@@ -634,9 +615,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_SIGNAL_ARG_TYPE:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
free(argument_type);
|
||||
argument_type = name;
|
||||
name = NULL;
|
||||
free_and_replace(argument_type, name);
|
||||
|
||||
state = STATE_SIGNAL_ARG;
|
||||
} else {
|
||||
@@ -708,12 +687,9 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_PROPERTY_NAME:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
if (n_depth == 0)
|
||||
free_and_replace(context->member_name, name);
|
||||
|
||||
if (n_depth == 0) {
|
||||
free(context->member_name);
|
||||
context->member_name = name;
|
||||
name = NULL;
|
||||
}
|
||||
state = STATE_PROPERTY;
|
||||
} else {
|
||||
log_error("Unexpected token in <property>. (2)");
|
||||
@@ -725,12 +701,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth
|
||||
case STATE_PROPERTY_TYPE:
|
||||
|
||||
if (t == XML_ATTRIBUTE_VALUE) {
|
||||
|
||||
if (n_depth == 0) {
|
||||
free(context->member_signature);
|
||||
context->member_signature = name;
|
||||
name = NULL;
|
||||
}
|
||||
if (n_depth == 0)
|
||||
free_and_replace(context->member_signature, name);
|
||||
|
||||
state = STATE_PROPERTY;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user