Skip to content

Commit 337db29

Browse files
committed
Refactor: based: Avoid xmlNodePtr and clean up includes
This is just some miscellaneous cleanup. For the most part, we use xmlNode * instead of xmlNodePtr nowadays, because "const xmlNodePtr" doesn't work. Also drop some unused includes and add some that were missing in based_transaction.{c,h}. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 415b273 commit 337db29

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

daemons/based/based_transaction.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
#include <stdbool.h>
1313

14-
#include <glib.h>
15-
#include <libxml/tree.h>
14+
#include <libxml/tree.h> // xmlNode
1615

1716
#include "pacemaker-based.h"
1817

@@ -54,8 +53,8 @@ based_transaction_source_str(const pcmk__client_t *client, const char *origin)
5453
* \return Standard Pacemaker return code
5554
*/
5655
static int
57-
process_transaction_requests(xmlNodePtr transaction,
58-
const pcmk__client_t *client, const char *source)
56+
process_transaction_requests(xmlNode *transaction, const pcmk__client_t *client,
57+
const char *source)
5958
{
6059
for (xmlNode *request = pcmk__xe_first_child(transaction,
6160
PCMK__XE_CIB_COMMAND, NULL,
@@ -116,10 +115,10 @@ process_transaction_requests(xmlNodePtr transaction,
116115
* success, and for freeing it on failure.
117116
*/
118117
int
119-
based_commit_transaction(xmlNodePtr transaction, const pcmk__client_t *client,
120-
const char *origin, xmlNodePtr *result_cib)
118+
based_commit_transaction(xmlNode *transaction, const pcmk__client_t *client,
119+
const char *origin, xmlNode **result_cib)
121120
{
122-
xmlNodePtr saved_cib = the_cib;
121+
xmlNode *saved_cib = the_cib;
123122
int rc = pcmk_rc_ok;
124123
char *source = NULL;
125124

daemons/based/based_transaction.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the Pacemaker project contributors
2+
* Copyright 2023-2025 the Pacemaker project contributors
33
*
44
* The version control history for this file may have further details.
55
*
@@ -10,15 +10,14 @@
1010
#ifndef BASED_TRANSACTION__H
1111
#define BASED_TRANSACTION__H
1212

13-
#include <crm_internal.h>
13+
#include <libxml/tree.h> // xmlNode
1414

15-
#include <libxml/tree.h>
15+
#include <crm/common/internal.h> // pcmk__client_t
1616

1717
char *based_transaction_source_str(const pcmk__client_t *client,
1818
const char *origin);
1919

20-
int based_commit_transaction(xmlNodePtr transaction,
21-
const pcmk__client_t *client,
22-
const char *origin, xmlNodePtr *result_cib);
20+
int based_commit_transaction(xmlNode *transaction, const pcmk__client_t *client,
21+
const char *origin, xmlNode **result_cib);
2322

2423
#endif // BASED_TRANSACTION__H

include/crm/common/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <crm/common/actions_internal.h>
2626
#include <crm/common/digest_internal.h>
2727
#include <crm/common/health_internal.h>
28+
#include <crm/common/ipc_internal.h>
2829
#include <crm/common/io_internal.h>
2930
#include <crm/common/iso8601_internal.h>
3031
#include <crm/common/mainloop_internal.h>

0 commit comments

Comments
 (0)