Rename one of the "always" variables to "body" for improved readability.
authorbenno <benno@openbsd.org>
Sun, 2 Jul 2017 14:27:30 +0000 (14:27 +0000)
committerbenno <benno@openbsd.org>
Sun, 2 Jul 2017 14:27:30 +0000 (14:27 +0000)
No functional change.
from Rob Pierce.

ok stsp@ and me

usr.sbin/ifstated/ifstated.c
usr.sbin/ifstated/ifstated.h
usr.sbin/ifstated/parse.y

index 1e0267a..ff2ed98 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ifstated.c,v 1.45 2017/06/28 11:10:08 benno Exp $     */
+/*     $OpenBSD: ifstated.c,v 1.46 2017/07/02 14:27:30 benno Exp $     */
 
 /*
  * Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -218,7 +218,7 @@ load_config(void)
                conf->nextstate = conf->curstate;
                conf->curstate = NULL;
                while (state_change())
-                       do_action(conf->curstate->always);
+                       do_action(conf->curstate->body);
        }
        return (0);
 }
@@ -530,9 +530,9 @@ eval_state(struct ifsd_state *state)
        struct ifsd_external *external = TAILQ_FIRST(&state->external_tests);
        if (external == NULL || external->lastexec >= state->entered ||
            external->lastexec == 0) {
-               do_action(state->always);
+               do_action(state->body);
                while (state_change())
-                       do_action(conf->curstate->always);
+                       do_action(conf->curstate->body);
        }
 }
 
@@ -639,12 +639,12 @@ clear_config(struct ifsd_config *oconf)
        while ((state = TAILQ_FIRST(&oconf->states)) != NULL) {
                TAILQ_REMOVE(&oconf->states, state, entries);
                remove_action(state->init, state);
-               remove_action(state->always, state);
+               remove_action(state->body, state);
                free(state->name);
                free(state);
        }
        remove_action(oconf->always.init, &oconf->always);
-       remove_action(oconf->always.always, &oconf->always);
+       remove_action(oconf->always.body, &oconf->always);
        free(oconf);
 }
 
index 16173cc..a096f66 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ifstated.h,v 1.12 2017/06/28 11:10:08 benno Exp $     */
+/*     $OpenBSD: ifstated.h,v 1.13 2017/07/02 14:27:30 benno Exp $     */
 
 /*
  * Copyright (c) 2004 Ryan McBride
@@ -110,7 +110,7 @@ struct ifsd_state {
        struct ifsd_external_list        external_tests;
        TAILQ_ENTRY(ifsd_state)          entries;
        struct ifsd_action              *init;
-       struct ifsd_action              *always;
+       struct ifsd_action              *body;
        u_int32_t                        entered;
        char                            *name;
 };
index 254ef74..e90b450 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.41 2017/06/18 12:03:47 benno Exp $        */
+/*     $OpenBSD: parse.y,v 1.42 2017/07/02 14:27:30 benno Exp $        */
 
 /*
  * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org>
@@ -245,9 +245,9 @@ init                : INIT {
                                curaction = conf->always.init;
                } action_block {
                        if (curstate != NULL)
-                               curaction = curstate->always;
+                               curaction = curstate->body;
                        else
-                               curaction = conf->always.always;
+                               curaction = conf->always.body;
                }
                ;
 
@@ -339,11 +339,11 @@ state             : STATE string {
                        init_state(state);
                        state->name = $2;
                        curstate = state;
-                       curaction = state->always;
+                       curaction = state->body;
                } optnl '{' optnl stateopts_l '}' {
                        TAILQ_INSERT_TAIL(&conf->states, curstate, entries);
                        curstate = NULL;
-                       curaction = conf->always.always;
+                       curaction = conf->always.body;
                }
                ;
 
@@ -747,7 +747,7 @@ parse_config(char *filename, int opts)
        TAILQ_INIT(&conf->states);
 
        init_state(&conf->always);
-       curaction = conf->always.always;
+       curaction = conf->always.body;
        conf->opts = opts;
 
        yyparse();
@@ -755,7 +755,7 @@ parse_config(char *filename, int opts)
        /* Link states */
        TAILQ_FOREACH(state, &conf->states, entries) {
                link_states(state->init);
-               link_states(state->always);
+               link_states(state->body);
        }
 
        errors = file->errors;
@@ -928,10 +928,10 @@ init_state(struct ifsd_state *state)
        state->init->type = IFSD_ACTION_CONDITION;
        TAILQ_INIT(&state->init->act.c.actions);
 
-       if ((state->always = calloc(1, sizeof(*state->always))) == NULL)
+       if ((state->body = calloc(1, sizeof(*state->body))) == NULL)
                err(1, "init_state: calloc");
-       state->always->type = IFSD_ACTION_CONDITION;
-       TAILQ_INIT(&state->always->act.c.actions);
+       state->body->type = IFSD_ACTION_CONDITION;
+       TAILQ_INIT(&state->body->act.c.actions);
 }
 
 struct ifsd_ifstate *