From cfd4c301618eb8decbf17bac2db6ba3bd2c65ad6 Mon Sep 17 00:00:00 2001 From: Tim Wickberg <tim@schedmd.com> Date: Fri, 13 Jan 2017 00:42:53 -0500 Subject: [PATCH] Add unpack_bit_str_hex_as_inx macro to pack.h. RPCs will switch to using bit_str_hex for serialization from bit_fmt, but receivers still need to access this as a inx formatted array for now. Collapse this into one macro rather than repeating a bunch of times. Note that this would be better performing if consolidated into a single function rather than using unpack_bit_str_hex then bitstr2inx to convert; although this is a client-side function and less important than avoiding performance and throughput issues within slurmctld. --- src/common/pack.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/common/pack.h b/src/common/pack.h index 4a9f1d78379..f5043363d1d 100644 --- a/src/common/pack.h +++ b/src/common/pack.h @@ -328,6 +328,15 @@ int unpackmem_array(char *valp, uint32_t size_valp, Buf buffer); *bitmap = NULL; \ } while (0) +/* note: this would be faster if collapsed into a single function + * rather than a combination of unpack_bit_str_hex and bitstr2inx */ +#define unpack_bit_str_hex_as_inx(inx, buf) do { \ + bitstr_t *b = NULL; \ + unpack_bit_str_hex(&b, buf); \ + *inx = bitstr2inx(b); \ + bit_free(b); \ +} while (0) + #define unpackstr_ptr \ unpackmem_ptr -- GitLab