summaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-11-29 19:10:40 -0800
committerKevin McCarthy <kevin@8t8.us>2020-11-30 18:41:03 -0800
commit20334587eac86b5c7753a908c16aa35c0d7762eb (patch)
tree7dc31d1c45b558efc117c222bd62f9e80371f320 /buffer.c
parente1c962aadc55c74d4f6aac31e120e81c8fd511cc (diff)
Add mutt_buffer_rewind() function.
This makes it a bit clearer what the assignment is doing, and reduces direct dptr manipulation a bit.
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 3123396c..f216780d 100644
--- a/buffer.c
+++ b/buffer.c
@@ -67,6 +67,15 @@ void mutt_buffer_clear (BUFFER *b)
*(b->dptr) = '\0';
}
+/* This is used for cases where the buffer is read from.
+ * A value is placed in the buffer, and then b->dptr is set back to the
+ * beginning as a read marker instead of write marker.
+ */
+void mutt_buffer_rewind (BUFFER *b)
+{
+ b->dptr = b->data;
+}
+
/* Creates and initializes a BUFFER by copying the seed string. */
BUFFER *mutt_buffer_from (char *seed)
{