summaryrefslogtreecommitdiff
path: root/lib/printfrr.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-03-02 20:16:18 +0100
committerDavid Lamparter <equinox@diac24.net>2021-03-27 17:01:29 +0100
commit487eefcfbec8a24d639e6b8c805540d5c1fe38e8 (patch)
tree49b095d2ebf319223532bd5da12f3ef641450d34 /lib/printfrr.h
parenteba599a39756b3d9424467f1e1f4f4475dffad17 (diff)
lib: record output positions in printfrr
This replaces `%n` with a safe, out-of-band option that simply records the start and end offset of the output produced for each `%...` specifier. The old `%n` code is removed. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/printfrr.h')
-rw-r--r--lib/printfrr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/printfrr.h b/lib/printfrr.h
index 549334ba5b..49243248d6 100644
--- a/lib/printfrr.h
+++ b/lib/printfrr.h
@@ -28,10 +28,17 @@
extern "C" {
#endif
+struct fmt_outpos {
+ unsigned int off_start, off_end;
+};
+
struct fbuf {
char *buf;
char *pos;
size_t len;
+
+ struct fmt_outpos *outpos;
+ size_t outpos_n, outpos_i;
};
#define at(a, b) PRINTFRR(a, b)