diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-06 00:53:10 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-06 00:53:10 +0200 |
commit | 89b0559e1980a1065094a9c2f88cc4ce9ecdb457 (patch) | |
tree | d7a3796c2f469b29e3855efd5910a414bbaa56eb /src/libmdsserver/macros.h | |
parent | kill all threads (diff) | |
download | mds-89b0559e1980a1065094a9c2f88cc4ce9ecdb457.tar.gz mds-89b0559e1980a1065094a9c2f88cc4ce9ecdb457.tar.bz2 mds-89b0559e1980a1065094a9c2f88cc4ce9ecdb457.tar.xz |
add buf_set/get_next macros
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/macros.h')
-rw-r--r-- | src/libmdsserver/macros.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index 2690917..f1c6076 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -152,5 +152,33 @@ buffer -= (count) * sizeof(type) / sizeof(char) +/** + * This macro combines `buf_set` with `buf_next`, it sets + * element zero and increase the pointer by one element + * + * @param buffer:char* The buffer + * @param type The data type of the elements for the data type to cast the buffer to + * @param variable:type The new value of the element + * @return :variable The new value of the element + */ +#define buf_set_next(buffer, type, variable) \ + buf_set(buffer, type, 0, variable); \ + buf_next(buffer, type, 1) + + +/** + * This macro combines `buf_set` with `buf_next`, it sets + * element zero and increase the pointer by one element + * + * @param buffer:char* The buffer + * @param type The data type of the elements for the data type to cast the buffer to + * @param variable:type Slot to set with the value of the element + * @return :variable The value of the element + */ +#define buf_get_next(buffer, type, variable) \ + buf_get(buffer, type, 0, variable); \ + buf_next(buffer, type, 1) + + #endif |