summaryrefslogtreecommitdiffstats
path: root/module/zcommon
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2017-11-04 14:25:13 -0600
committerBrian Behlendorf <[email protected]>2017-11-04 13:25:13 -0700
commit1c27024e22af4386b592b30d40e6a0820ceb48c1 (patch)
tree689d4b821fd6910a137a0f93351351def5011cec /module/zcommon
parentdf1f129bc4150fd6ea3f23a01154a71ffa48bf12 (diff)
Undo c89 workarounds to match with upstream
With PR 5756 the zfs module now supports c99 and the remaining past c89 workarounds can be undone. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #6816
Diffstat (limited to 'module/zcommon')
-rw-r--r--module/zcommon/zfeature_common.c16
-rw-r--r--module/zcommon/zfs_namecheck.c5
-rw-r--r--module/zcommon/zprop_common.c4
3 files changed, 9 insertions, 16 deletions
diff --git a/module/zcommon/zfeature_common.c b/module/zcommon/zfeature_common.c
index 045162c68..7b782b45d 100644
--- a/module/zcommon/zfeature_common.c
+++ b/module/zcommon/zfeature_common.c
@@ -91,26 +91,21 @@ zfeature_is_valid_guid(const char *name)
boolean_t
zfeature_is_supported(const char *guid)
{
- spa_feature_t i;
-
if (zfeature_checks_disable)
return (B_TRUE);
- for (i = 0; i < SPA_FEATURES; i++) {
+ for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {
zfeature_info_t *feature = &spa_feature_table[i];
if (strcmp(guid, feature->fi_guid) == 0)
return (B_TRUE);
}
-
return (B_FALSE);
}
int
zfeature_lookup_name(const char *name, spa_feature_t *res)
{
- spa_feature_t i;
-
- for (i = 0; i < SPA_FEATURES; i++) {
+ for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {
zfeature_info_t *feature = &spa_feature_table[i];
if (strcmp(name, feature->fi_uname) == 0) {
if (res != NULL)
@@ -126,9 +121,8 @@ boolean_t
zfeature_depends_on(spa_feature_t fid, spa_feature_t check)
{
zfeature_info_t *feature = &spa_feature_table[fid];
- int i;
- for (i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) {
+ for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) {
if (feature->fi_depends[i] == check)
return (B_TRUE);
}
@@ -138,9 +132,7 @@ zfeature_depends_on(spa_feature_t fid, spa_feature_t check)
static boolean_t
deps_contains_feature(const spa_feature_t *deps, const spa_feature_t feature)
{
- int i;
-
- for (i = 0; deps[i] != SPA_FEATURE_NONE; i++)
+ for (int i = 0; deps[i] != SPA_FEATURE_NONE; i++)
if (deps[i] == feature)
return (B_TRUE);
diff --git a/module/zcommon/zfs_namecheck.c b/module/zcommon/zfs_namecheck.c
index e8db93be7..42a7c6c93 100644
--- a/module/zcommon/zfs_namecheck.c
+++ b/module/zcommon/zfs_namecheck.c
@@ -136,12 +136,13 @@ permset_namecheck(const char *path, namecheck_err_t *why, char *what)
int
entity_namecheck(const char *path, namecheck_err_t *why, char *what)
{
- const char *start, *end, *loc;
+ const char *start, *end;
int found_delim;
/*
* Make sure the name is not too long.
*/
+
if (strlen(path) >= ZFS_MAX_DATASET_NAME_LEN) {
if (why)
*why = NAME_ERR_TOOLONG;
@@ -178,7 +179,7 @@ entity_namecheck(const char *path, namecheck_err_t *why, char *what)
}
/* Validate the contents of this component */
- for (loc = start; loc != end; loc++) {
+ for (const char *loc = start; loc != end; loc++) {
if (!valid_char(*loc) && *loc != '%') {
if (why) {
*why = NAME_ERR_INVALCHAR;
diff --git a/module/zcommon/zprop_common.c b/module/zcommon/zprop_common.c
index b32c22657..a4528d248 100644
--- a/module/zcommon/zprop_common.c
+++ b/module/zcommon/zprop_common.c
@@ -166,7 +166,7 @@ int
zprop_iter_common(zprop_func func, void *cb, boolean_t show_all,
boolean_t ordered, zfs_type_t type)
{
- int i, j, num_props, size, prop;
+ int i, num_props, size, prop;
zprop_desc_t *prop_tbl;
zprop_desc_t **order;
@@ -181,7 +181,7 @@ zprop_iter_common(zprop_func func, void *cb, boolean_t show_all,
return (ZPROP_CONT);
#endif
- for (j = 0; j < num_props; j++)
+ for (int j = 0; j < num_props; j++)
order[j] = &prop_tbl[j];
if (ordered) {