summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir/ptexmac.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir/ptexmac.h')
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexmac.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ptexmac.h b/Build/source/texk/web2c/pdftexdir/ptexmac.h
index 54e12159245..cebb279138a 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexmac.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexmac.h
@@ -1,5 +1,5 @@
/* ptexmac.h: common macros for pdfTeX.
-Copyright 1996-2018 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2021 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -215,4 +215,32 @@ size_t T##_limit
# define str_prefix(s1, s2) (strncmp((s1), (s2), strlen(s2)) == 0)
+/* (un)dumping a string means dumping the allocation size, followed
+ * by the bytes. The trailing \0 is (un)dumped as well, because that
+ * makes the code simpler.
+ */
+
+#define dumpcharptr(a) \
+ do { \
+ integer x; \
+ if (a!=NULL) { \
+ x = strlen(a)+1; \
+ generic_dump(x); dumpthings(*a, x); \
+ } else { \
+ x = 0; generic_dump(x); \
+ } \
+ } while (0)
+
+#define undumpcharptr(s) \
+ do { \
+ integer x; \
+ char *a; \
+ generic_undump (x); \
+ if (x>0) { \
+ a = malloc(x); \
+ undumpthings(*a,x); \
+ s = a ; \
+ } else { s = NULL; } \
+ } while (0)
+
#endif /* PDFTEXMAC */