]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add FR_DBUFF_COPY() analogous to FR_SBUFF_COPY() (#3834)
authorJames Jones <jejones3141@gmail.com>
Tue, 5 Jan 2021 16:15:12 +0000 (10:15 -0600)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 16:15:12 +0000 (16:15 +0000)
src/lib/util/dbuff.h

index 67e408a713f7da6612e68f3f9b90fb186adf9e9f..2c485f3263dc87073787383c1c0abc256c9ef19a 100644 (file)
@@ -205,6 +205,25 @@ do { \
        .parent         = (_dbuff) \
 }
 
+/** Let the dbuff be advanced by operations on its child
+ *
+ *
+ * @param[in] _dbuff   to make an ephemeral copy of.
+ */
+#define FR_DBUFF_COPY(_dbuff) (fr_dbuff_t) \
+{ \
+       .buff           = (_dbuff)->buff, \
+       .start          = (_dbuff)->p, \
+       .end            = (_dbuff)->end, \
+       .p              = (_dbuff)->p, \
+       .is_const       = (_dbuff)->is_const, \
+       .adv_parent     = true, \
+       .shifted        = (_dbuff)->shifted, \
+       .extend         = (_dbuff)->extend, \
+       .uctx           = (_dbuff)->uctx, \
+       .parent         = (_dbuff) \
+}
+
 /** @cond */
 
 /** Reserve _reserve bytes in the dbuff when passing it to another function