diff --git a/ChangeLog b/ChangeLog index 06fdab54e1..78635bb64d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue, 3 Feb 2009 14:06:06 +0100 Jim Meyering + + build: enable redundant-const check + * Makefile.cfg (local-checks-to-skip): Remove sc_redundant_const. + * src/lxc_controller.c: Remove redundant "const"(s). + * src/storage_backend_fs.c: Likewise. + * src/util.h: Likewise. + * src/xen_internal.c: Likewise. + * tests/qparamtest.c: Likewise. + Tue, 3 Feb 2009 14:06:06 +0100 Jim Meyering syntax-check: enable more checks diff --git a/Makefile.cfg b/Makefile.cfg index 0c2b8101da..b93d8dc4d3 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -46,7 +46,6 @@ local-checks-to-skip = \ sc_prohibit_quote_without_use \ sc_prohibit_quotearg_without_use \ sc_prohibit_stat_st_blocks \ - sc_redundant_const \ sc_root_tests \ sc_space_tab \ sc_sun_os_names \ diff --git a/src/lxc_controller.c b/src/lxc_controller.c index e25fe76cd6..58dfe023d8 100644 --- a/src/lxc_controller.c +++ b/src/lxc_controller.c @@ -507,7 +507,7 @@ int main(int argc, char *argv[]) virDomainDefPtr def = NULL; char *configFile = NULL; char *sockpath = NULL; - const struct option const options[] = { + const struct option options[] = { { "background", 0, NULL, 'b' }, { "name", 1, NULL, 'n' }, { "veth", 1, NULL, 'v' }, @@ -662,4 +662,3 @@ cleanup: return rc; } - diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c index 345dc40e10..240de96848 100644 --- a/src/storage_backend_fs.c +++ b/src/storage_backend_fs.c @@ -1,7 +1,7 @@ /* * storage_backend_fs.c: storage backend for FS and directory handling * - * Copyright (C) 2007-2008 Red Hat, Inc. + * Copyright (C) 2007-2009 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -84,7 +84,7 @@ struct FileTypeInfo { int (*getBackingStore)(virConnectPtr conn, char **res, const unsigned char *buf, size_t buf_size); }; -const struct FileTypeInfo const fileTypeInfo[] = { +struct FileTypeInfo const fileTypeInfo[] = { /* Bochs */ /* XXX Untested { VIR_STORAGE_VOL_BOCHS, "Bochs Virtual HD Image", NULL, @@ -1020,7 +1020,7 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn, * Need to add in progress bars & bg thread somehow */ if (vol->allocation) { unsigned long long remain = vol->allocation; - static const char const zeros[4096]; + static char const zeros[4096]; while (remain) { int bytes = sizeof(zeros); if (bytes > remain) diff --git a/src/util.h b/src/util.h index e731ba49b4..c5532648b9 100644 --- a/src/util.h +++ b/src/util.h @@ -143,7 +143,7 @@ const char *virEnumToString(const char *const*types, int type); #define VIR_ENUM_IMPL(name, lastVal, ...) \ - static const char const *name ## TypeList[] = { __VA_ARGS__ }; \ + static const char *const name ## TypeList[] = { __VA_ARGS__ }; \ extern int (* name ## Verify (void)) [verify_true (ARRAY_CARDINALITY(name ## TypeList) == lastVal)]; \ const char *name ## TypeToString(int type) { \ return virEnumToString(name ## TypeList, \ diff --git a/src/xen_internal.c b/src/xen_internal.c index 9a7272fdb7..0a01f5e073 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -1,7 +1,7 @@ /* * xen_internal.c: direct access to Xen hypervisor level * - * Copyright (C) 2005, 2006, 2007, 2008 Red Hat, Inc. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc. * * See COPYING.LIB for the License of this software * @@ -2178,7 +2178,7 @@ xenHypervisorBuildCapabilities(virConnectPtr conn, for (i = 0; i < nr_guest_archs; ++i) { virCapsGuestPtr guest; - const char const *machines[] = { guest_archs[i].hvm ? "xenfv" : "xenpv" }; + char const *const machines[] = {guest_archs[i].hvm ? "xenfv" : "xenpv"}; if ((guest = virCapabilitiesAddGuest(caps, guest_archs[i].hvm ? "hvm" : "xen", diff --git a/tests/qparamtest.c b/tests/qparamtest.c index f8f2d29d35..a4ed1fb8a2 100644 --- a/tests/qparamtest.c +++ b/tests/qparamtest.c @@ -175,12 +175,12 @@ fail: return ret; } -static const struct qparamParseDataEntry const params1[] = { { "foo", "one" }, { "bar", "two" } }; -static const struct qparamParseDataEntry const params2[] = { { "foo", "one" }, { "foo", "two" } }; -static const struct qparamParseDataEntry const params3[] = { { "foo", "&one" }, { "bar", "&two" } }; -static const struct qparamParseDataEntry const params4[] = { { "foo", "" } }; -static const struct qparamParseDataEntry const params5[] = { { "foo", "one two" } }; -static const struct qparamParseDataEntry const params6[] = { { "foo", "one" } }; +static const struct qparamParseDataEntry params1[] = { { "foo", "one" }, { "bar", "two" } }; +static const struct qparamParseDataEntry params2[] = { { "foo", "one" }, { "foo", "two" } }; +static const struct qparamParseDataEntry params3[] = { { "foo", "&one" }, { "bar", "&two" } }; +static const struct qparamParseDataEntry params4[] = { { "foo", "" } }; +static const struct qparamParseDataEntry params5[] = { { "foo", "one two" } }; +static const struct qparamParseDataEntry params6[] = { { "foo", "one" } }; static int mymain(int argc ATTRIBUTE_UNUSED,