mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
Provide an alternative CTDB_NO_MEMORY_NULL() for functions which return a pointer
(This used to be ctdb commit 51c79e19df777fb53a5c210efc1c9d3159059de3)
This commit is contained in:
parent
6b97bddd7c
commit
606a4d9113
@ -186,7 +186,7 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_context *ctdb,
|
||||
int ret;
|
||||
|
||||
state = talloc_zero(ctdb, struct ctdb_call_state);
|
||||
CTDB_NO_MEMORY(ctdb, state);
|
||||
CTDB_NO_MEMORY_NULL(ctdb, state);
|
||||
|
||||
state->state = CTDB_CALL_DONE;
|
||||
state->node = ctdb->nodes[ctdb->vnn];
|
||||
@ -213,11 +213,11 @@ struct ctdb_call_state *ctdb_call_send(struct ctdb_context *ctdb,
|
||||
}
|
||||
|
||||
state = talloc_zero(ctdb, struct ctdb_call_state);
|
||||
CTDB_NO_MEMORY(ctdb, state);
|
||||
CTDB_NO_MEMORY_NULL(ctdb, state);
|
||||
|
||||
len = sizeof(*state->c) + key.dsize + (call_data?call_data->dsize:0);
|
||||
state->c = talloc_size(ctdb, len);
|
||||
CTDB_NO_MEMORY(ctdb, state->c);
|
||||
CTDB_NO_MEMORY_NULL(ctdb, state->c);
|
||||
|
||||
state->c->hdr.length = len;
|
||||
state->c->hdr.operation = CTDB_REQ_CALL;
|
||||
|
@ -94,6 +94,10 @@ struct ctdb_context {
|
||||
ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
|
||||
return -1; }} while (0)
|
||||
|
||||
#define CTDB_NO_MEMORY_NULL(ctdb, p) do { if (!(p)) { \
|
||||
ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
|
||||
return NULL; }} while (0)
|
||||
|
||||
/* arbitrary maximum timeout for ctdb operations */
|
||||
#define CTDB_REQ_TIMEOUT 10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user