diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-02-24 07:37:09 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 07:37:09 -0500 |
| commit | 7cedcf270e01097ed2d675e12f9be0dfd4f7d69b (patch) | |
| tree | 8348d055ddc0c956ecdadcc64c508ecfebc9c92a /lib/northbound.c | |
| parent | ba995a720b498955720f0caeeb4d26bac2b84be4 (diff) | |
| parent | 41ef7327e3ebf9f0293c6046190aceb9d44f8414 (diff) | |
Merge pull request #12889 from LabNConsulting/chopps/fix-nb-context-arg
lib: fix init. use of nb_context to be by value not by reference
Diffstat (limited to 'lib/northbound.c')
| -rw-r--r-- | lib/northbound.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index b755264be1..6f2c522a29 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -61,7 +61,7 @@ static int nb_callback_configuration(struct nb_context *context, struct nb_config_change *change, char *errmsg, size_t errmsg_len); static struct nb_transaction * -nb_transaction_new(struct nb_context *context, struct nb_config *config, +nb_transaction_new(struct nb_context context, struct nb_config *config, struct nb_config_cbs *changes, const char *comment, char *errmsg, size_t errmsg_len); static void nb_transaction_free(struct nb_transaction *transaction); @@ -835,7 +835,7 @@ int nb_candidate_validate(struct nb_context *context, return ret; } -int nb_candidate_commit_prepare(struct nb_context *context, +int nb_candidate_commit_prepare(struct nb_context context, struct nb_config *candidate, const char *comment, struct nb_transaction **transaction, @@ -860,9 +860,8 @@ int nb_candidate_commit_prepare(struct nb_context *context, return NB_ERR_NO_CHANGES; } - if (nb_candidate_validate_code(context, candidate, &changes, errmsg, - errmsg_len) - != NB_OK) { + if (nb_candidate_validate_code(&context, candidate, &changes, errmsg, + errmsg_len) != NB_OK) { flog_warn(EC_LIB_NB_CANDIDATE_INVALID, "%s: failed to validate candidate configuration", __func__); @@ -913,7 +912,7 @@ void nb_candidate_commit_apply(struct nb_transaction *transaction, nb_transaction_free(transaction); } -int nb_candidate_commit(struct nb_context *context, struct nb_config *candidate, +int nb_candidate_commit(struct nb_context context, struct nb_config *candidate, bool save_transaction, const char *comment, uint32_t *transaction_id, char *errmsg, size_t errmsg_len) @@ -1411,13 +1410,13 @@ static int nb_callback_configuration(struct nb_context *context, } static struct nb_transaction * -nb_transaction_new(struct nb_context *context, struct nb_config *config, +nb_transaction_new(struct nb_context context, struct nb_config *config, struct nb_config_cbs *changes, const char *comment, char *errmsg, size_t errmsg_len) { struct nb_transaction *transaction; - if (nb_running_lock_check(context->client, context->user)) { + if (nb_running_lock_check(context.client, context.user)) { strlcpy(errmsg, "running configuration is locked by another client", errmsg_len); @@ -1469,7 +1468,7 @@ static int nb_transaction_process(enum nb_event event, break; /* Call the appropriate callback. */ - ret = nb_callback_configuration(transaction->context, event, + ret = nb_callback_configuration(&transaction->context, event, change, errmsg, errmsg_len); switch (event) { case NB_EV_PREPARE: @@ -1584,7 +1583,7 @@ static void nb_transaction_apply_finish(struct nb_transaction *transaction, /* Call the 'apply_finish' callbacks, sorted by their priorities. */ RB_FOREACH (cb, nb_config_cbs, &cbs) - nb_callback_apply_finish(transaction->context, cb->nb_node, + nb_callback_apply_finish(&transaction->context, cb->nb_node, cb->dnode, errmsg, errmsg_len); /* Release memory. */ |
