summaryrefslogtreecommitdiffstats
path: root/runtime/loc2c-runtime.h
diff options
context:
space:
mode:
authorbrolley <brolley>2008-03-10 18:45:03 +0000
committerbrolley <brolley>2008-03-10 18:45:03 +0000
commit1775b972583588e562c1e6f614da60806c720168 (patch)
tree68098aee5444bf221be7348094d6862905d6f97e /runtime/loc2c-runtime.h
parent3829dbe3c614758a956d3390a83fd946a695bd38 (diff)
downloadsystemtap-steved-1775b972583588e562c1e6f614da60806c720168.tar.gz
systemtap-steved-1775b972583588e562c1e6f614da60806c720168.tar.xz
systemtap-steved-1775b972583588e562c1e6f614da60806c720168.zip
2008-03-10 Dave Brolley <brolley@redhat.com>
PR5189 * vsprintf.c (_stp_vsnprintf): Arguments for dynamic width and precision are of type 'int' again. * loc2c-runtime.h (deref_string): Copy the data only if dst is not NULL. (deref_buffer): New macro.
Diffstat (limited to 'runtime/loc2c-runtime.h')
-rw-r--r--runtime/loc2c-runtime.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h
index 4674e399..7ea1b1e4 100644
--- a/runtime/loc2c-runtime.h
+++ b/runtime/loc2c-runtime.h
@@ -623,8 +623,26 @@
for (_len = (maxbytes), _addr = (uintptr_t)(addr); \
_len > 1 && (_c = deref (1, _addr)) != '\0'; \
--_len, ++_addr) \
- *_d++ = _c; \
- *_d = '\0'; \
+ if (_d) \
+ *_d++ = _c; \
+ if (_d) \
+ *_d = '\0'; \
+ (dst); \
+ })
+
+#define deref_buffer(dst, addr, numbytes) \
+ ({ \
+ uintptr_t _addr; \
+ size_t _len; \
+ unsigned char _c; \
+ char *_d = (dst); \
+ for (_len = (numbytes), _addr = (uintptr_t)(addr); \
+ _len >= 1; \
+ --_len, ++_addr) { \
+ _c = deref (1, _addr); \
+ if (_d) \
+ *_d++ = _c; \
+ } \
(dst); \
})