Hi John,
please try to squash in the following patch, courtesy of Boris
--
diff --git a/libxkutil/capability_parsing.c b/libxkutil/capability_parsing.c
index e3c0f2b..2acd45b 100644
--- a/libxkutil/capability_parsing.c
+++ b/libxkutil/capability_parsing.c
@@ -15,8 +15,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
@@ -464,16 +464,14 @@ static char *_findDefArch(struct capabilities *caps,
char *ret = NULL;
int i;
- if (os_type == NULL)
- return NULL;
-
- for (i = 0; i < caps->num_guests; i++)
+ for (i = 0; i < caps->num_guests; i++) {
if (STREQC(caps->guests[i].ostype, os_type) &&
(host_arch == NULL || (host_arch != NULL &&
STREQC(caps->guests[i].arch.name, host_arch)))) {
ret = caps->guests[i].arch.name;
break;
}
+ }
return ret;
}
@@ -482,13 +480,11 @@ char *get_default_arch(struct capabilities *caps,
{
char *ret = NULL;
- if (caps != NULL) {
- if (os_type != NULL) {
- /* search first guest matching os_type and host arch */
- ret = _findDefArch(caps, os_type, caps->host.cpu_arch);
- if (ret== NULL) /* search first matching guest */
- ret = _findDefArch(caps, os_type, NULL);
- }
+ if (caps != NULL && os_type != NULL) {
+ /* search first guest matching os_type and host arch */
+ ret = _findDefArch(caps, os_type, caps->host.cpu_arch);
+ if (ret == NULL) /* search first matching guest */
+ ret = _findDefArch(caps, os_type, NULL);
}
return ret;
}
@@ -505,10 +501,9 @@ char *get_default_machine(
if (caps != NULL) {
di = findDomainInfo(caps, os_type, arch, domain_type);
if (di != NULL && di->num_machines > 0) {
- ret = di->machines[0].canonical_name;
- if (ret == NULL) {
- ret = di->machines[0].name;
- }
+ ret = di->machines[0].canonical_name ?
+ di->machines[0].canonical_name :
+ di->machines[0].name;
}
}
return ret;
@@ -533,16 +528,16 @@ char *get_default_emulator(struct capabilities *caps,
bool use_kvm(struct capabilities *caps) {
if (host_supports_kvm(caps) && !get_disable_kvm())
return true;
- else
- return false;
+ return false;
}
bool host_supports_kvm(struct capabilities *caps)
{
bool kvm = false;
- if (caps != NULL)
+ if (caps != NULL) {
if (findDomainInfo(caps, NULL, NULL, "kvm") != NULL)
kvm = true;
+ }
return kvm;
}
/*
diff --git a/libxkutil/capability_parsing.h b/libxkutil/capability_parsing.h
index d258f62..41a4933 100644
--- a/libxkutil/capability_parsing.h
+++ b/libxkutil/capability_parsing.h
@@ -15,8 +15,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
*/
#ifndef __CAPABILITY_PARSING_H
#define __CAPABILITY_PARSING_H
diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c
index de2c88a..af5e508 100644
--- a/libxkutil/xml_parse_test.c
+++ b/libxkutil/xml_parse_test.c
@@ -220,12 +220,12 @@ static void print_cap_domain_info(struct cap_domain_info
*capgdiinfo,
struct cap_machine capgminfo;
int i;
- if (capgdiinfo==NULL)
+ if (capgdiinfo == NULL)
return;
- if (capgdiinfo->emulator!=NULL)
+ if (capgdiinfo->emulator != NULL)
print_value(d, " Emulator", capgdiinfo->emulator);
- if (capgdiinfo->loader!=NULL)
+ if (capgdiinfo->loader != NULL)
print_value(d, " Loader", capgdiinfo->loader);
for (i = 0; i < capgdiinfo->num_machines; i++) {
capgminfo = capgdiinfo->machines[i];
Mit freundlichen Grüßen/Kind Regards
Viktor Mihajlovski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294