lib/c/criu.h: rm explicit numbering of enum elements

Submitted by Kir Kolyshkin on Sept. 14, 2016, 9:04 p.m.

Details

Message ID 1473887063-10069-1-git-send-email-kir@openvz.org
State Accepted
Series "lib/c/criu.h: rm explicit numbering of enum elements"
Commit 1e1507bf08540f38194e4d2369f1d4b057b39ed9
Headers show

Commit Message

Kir Kolyshkin Sept. 14, 2016, 9:04 p.m.
C standard specifies that the first enum element is 0 and the next ones
are +1 to a previous element (C90, "3.5.2.2 Enumeration
specifiers").
Therefore, there is no need to explicitly specify element values.

The explicit initializers were added in the first commit introducing
this enum (commit 46e8aee).

While at it, let's also add a comma after the last element, for any
future patch adding more elements to look better.

No functional change.

Cc: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
---
 lib/c/criu.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/c/criu.h b/lib/c/criu.h
index c28369f..5755782 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -32,13 +32,13 @@  enum criu_service_comm {
 };
 
 enum criu_cg_mode {
-	CRIU_CG_MODE_IGNORE	= 0,
-	CRIU_CG_MODE_NONE	= 1,
-	CRIU_CG_MODE_PROPS	= 2,
-	CRIU_CG_MODE_SOFT	= 3,
-	CRIU_CG_MODE_FULL	= 4,
-	CRIU_CG_MODE_STRICT	= 5,
-	CRIU_CG_MODE_DEFAULT	= 6
+	CRIU_CG_MODE_IGNORE,
+	CRIU_CG_MODE_NONE,
+	CRIU_CG_MODE_PROPS,
+	CRIU_CG_MODE_SOFT,
+	CRIU_CG_MODE_FULL,
+	CRIU_CG_MODE_STRICT,
+	CRIU_CG_MODE_DEFAULT,
 };
 
 void criu_set_service_address(char *path);

Comments

Ruslan Kuprieiev Sept. 14, 2016, 9:09 p.m.
Thanks.

Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>


On 09/15/2016 12:04 AM, Kir Kolyshkin wrote:
> C standard specifies that the first enum element is 0 and the next ones
> are +1 to a previous element (C90, "3.5.2.2 Enumeration
> specifiers").
> Therefore, there is no need to explicitly specify element values.
>
> The explicit initializers were added in the first commit introducing
> this enum (commit 46e8aee).
>
> While at it, let's also add a comma after the last element, for any
> future patch adding more elements to look better.
>
> No functional change.
>
> Cc: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
> Signed-off-by: Kir Kolyshkin <kir@openvz.org>
> ---
>   lib/c/criu.h | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/lib/c/criu.h b/lib/c/criu.h
> index c28369f..5755782 100644
> --- a/lib/c/criu.h
> +++ b/lib/c/criu.h
> @@ -32,13 +32,13 @@ enum criu_service_comm {
>   };
>   
>   enum criu_cg_mode {
> -	CRIU_CG_MODE_IGNORE	= 0,
> -	CRIU_CG_MODE_NONE	= 1,
> -	CRIU_CG_MODE_PROPS	= 2,
> -	CRIU_CG_MODE_SOFT	= 3,
> -	CRIU_CG_MODE_FULL	= 4,
> -	CRIU_CG_MODE_STRICT	= 5,
> -	CRIU_CG_MODE_DEFAULT	= 6
> +	CRIU_CG_MODE_IGNORE,
> +	CRIU_CG_MODE_NONE,
> +	CRIU_CG_MODE_PROPS,
> +	CRIU_CG_MODE_SOFT,
> +	CRIU_CG_MODE_FULL,
> +	CRIU_CG_MODE_STRICT,
> +	CRIU_CG_MODE_DEFAULT,
>   };
>   
>   void criu_set_service_address(char *path);
Pavel Emelianov Sept. 19, 2016, 9:27 a.m.
Applied