mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
librpc/ndr: Add ndr_push_steal_switch_value()
This will allow generated code to instead push and pop union values onto the switch_list stack, which is more memory efficient than creating a single large list to be scannned and eventually discarded. Merge into unreleased ABI 1.0.0 BUG: https://bugzilla.samba.org/show_bug.cgi?id=13876 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
parent
603f23b19c
commit
e1a15710a4
@ -215,6 +215,7 @@ ndr_push_setup_relative_base_offset1: enum ndr_err_code (struct ndr_push *, cons
|
||||
ndr_push_setup_relative_base_offset2: enum ndr_err_code (struct ndr_push *, const void *)
|
||||
ndr_push_short_relative_ptr1: enum ndr_err_code (struct ndr_push *, const void *)
|
||||
ndr_push_short_relative_ptr2: enum ndr_err_code (struct ndr_push *, const void *)
|
||||
ndr_push_steal_switch_value: uint32_t (struct ndr_push *, const void *)
|
||||
ndr_push_string: enum ndr_err_code (struct ndr_push *, int, const char *)
|
||||
ndr_push_string_array: enum ndr_err_code (struct ndr_push *, int, const char **)
|
||||
ndr_push_struct_blob: enum ndr_err_code (DATA_BLOB *, TALLOC_CTX *, const void *, ndr_push_flags_fn_t)
|
||||
|
@ -617,6 +617,7 @@ enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p,
|
||||
enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val);
|
||||
enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val);
|
||||
uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p);
|
||||
uint32_t ndr_push_steal_switch_value(struct ndr_push *ndr, const void *p);
|
||||
uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p);
|
||||
uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p);
|
||||
uint32_t ndr_pull_steal_switch_value(struct ndr_pull *ndr, const void *p);
|
||||
|
@ -1238,6 +1238,20 @@ _PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p)
|
||||
return ndr_token_peek(&ndr->switch_list, p);
|
||||
}
|
||||
|
||||
/* retrieve a switch value (for push) and remove it from the list */
|
||||
_PUBLIC_ uint32_t ndr_push_steal_switch_value(struct ndr_push *ndr, const void *p)
|
||||
{
|
||||
enum ndr_err_code status;
|
||||
uint32_t v;
|
||||
|
||||
status = ndr_token_retrieve(&ndr->switch_list, p, &v);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p)
|
||||
{
|
||||
return ndr_token_peek(&ndr->switch_list, p);
|
||||
|
Loading…
Reference in New Issue
Block a user