diff options
author | Guy Harris <gharris@sonic.net> | 2021-06-16 02:01:23 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-06-16 02:01:23 -0700 |
commit | 25a254823f21dee60f621b445e6689b2bbf9d9c4 (patch) | |
tree | 38f5033c9ea6dde5bdfbb9b4399d86be0de7579b /wiretap/pcapng.c | |
parent | f541e5e769321df0b4968164f583ecd684152d0e (diff) |
wsutil: add a header that defines some "round to power of 2" macros.
Add macros to round to multiples of 2, 4, 8, 16, and 32.
Use them instead of independently defined macros.
(We don't define a general "round to a power of 2" macro to avoid the
risk of somebody passing something other than a power of 2 to it.)
Diffstat (limited to 'wiretap/pcapng.c')
-rw-r--r-- | wiretap/pcapng.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index af844827f4..5eb8c435b9 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -27,6 +27,7 @@ #include <wsutil/strtoi.h> #include <wsutil/glib-compat.h> #include <wsutil/ws_assert.h> +#include <wsutil/ws_roundup.h> #include "wtap-int.h" #include "file_wrappers.h" @@ -37,7 +38,7 @@ #include "pcapng_module.h" #include "secrets-types.h" -#define ROUND_TO_4BYTE(len) ((len + 3) & ~3) +#define ROUND_TO_4BYTE(len) WS_ROUNDUP_4(len) static gboolean pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, |