mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
ctdb-common: Drop ctdb context from ctdb_parse_address()
Having it require a CTDB context stops ctdb_parse_address() from being used in more generic code. Just use the existing talloc context for memory allocations. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
a1e65d0c8d
commit
3cbeb17d0f
@ -155,8 +155,7 @@ void ctdb_external_trace(void)
|
||||
/*
|
||||
parse a IP:port pair
|
||||
*/
|
||||
int ctdb_parse_address(struct ctdb_context *ctdb,
|
||||
TALLOC_CTX *mem_ctx, const char *str,
|
||||
int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str,
|
||||
struct ctdb_address *address)
|
||||
{
|
||||
struct servent *se;
|
||||
@ -174,7 +173,10 @@ int ctdb_parse_address(struct ctdb_context *ctdb,
|
||||
}
|
||||
|
||||
address->address = talloc_strdup(mem_ctx, ctdb_addr_to_str(&addr));
|
||||
CTDB_NO_MEMORY(ctdb, address->address);
|
||||
if (address->address == NULL) {
|
||||
DEBUG(DEBUG_ERR, (__location__ " Out of memory\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (se == NULL) {
|
||||
address->port = CTDB_PORT;
|
||||
|
@ -726,8 +726,7 @@ bool ctdb_set_helper(const char *type, char *helper, size_t size,
|
||||
const char *envvar, const char *dir, const char *file);
|
||||
void ctdb_external_trace(void);
|
||||
bool ctdb_same_address(struct ctdb_address *a1, struct ctdb_address *a2);
|
||||
int ctdb_parse_address(struct ctdb_context *ctdb,
|
||||
TALLOC_CTX *mem_ctx, const char *str,
|
||||
int ctdb_parse_address(TALLOC_CTX *mem_ctx, const char *str,
|
||||
struct ctdb_address *address);
|
||||
bool ctdb_same_ip(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2);
|
||||
bool ctdb_same_sockaddr(const ctdb_sock_addr *ip1, const ctdb_sock_addr *ip2);
|
||||
|
@ -92,7 +92,7 @@ static int ctdb_add_node(struct ctdb_context *ctdb, const char *nstr, uint32_t f
|
||||
CTDB_NO_MEMORY(ctdb, *nodep);
|
||||
node = *nodep;
|
||||
|
||||
if (ctdb_parse_address(ctdb, node, nstr, &node->address) != 0) {
|
||||
if (ctdb_parse_address(node, nstr, &node->address) != 0) {
|
||||
return -1;
|
||||
}
|
||||
node->ctdb = ctdb;
|
||||
@ -181,7 +181,7 @@ void ctdb_load_nodes_file(struct ctdb_context *ctdb)
|
||||
*/
|
||||
int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
|
||||
{
|
||||
if (ctdb_parse_address(ctdb, ctdb, address, &ctdb->address) != 0) {
|
||||
if (ctdb_parse_address(ctdb, address, &ctdb->address) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user