chiark / gitweb /
macro: increase VA_FORMAT_ADVANCE type array and hit assert when it is reached
authorLennart Poettering <lennart@poettering.net>
Mon, 24 Sep 2012 21:42:29 +0000 (23:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Sep 2012 21:42:29 +0000 (23:42 +0200)
src/shared/macro.h

index 0dd210afa7c419dcf362281134f325ed3542616b..dbdf5b3fb00f2d83362ab9bd5f97f9cc699b64b4 100644 (file)
@@ -193,10 +193,12 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
 #define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
 #define _cleanup_umask_ __attribute__((cleanup(umaskp)))
 
 #define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
 #define _cleanup_umask_ __attribute__((cleanup(umaskp)))
 
-#define VA_FORMAT_ADVANCE(format, ap) do {                              \
-        int _argtypes[64];                                              \
+#define VA_FORMAT_ADVANCE(format, ap)                                   \
+do {                                                                    \
+        int _argtypes[128];                                             \
         size_t _i, _k;                                                  \
         _k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
         size_t _i, _k;                                                  \
         _k = parse_printf_format((format), ELEMENTSOF(_argtypes), _argtypes); \
+        assert(_k < ELEMENTSOF(_argtypes));                             \
         for (_i = 0; _i < _k; _i++) {                                   \
                 if (_argtypes[_i] & PA_FLAG_PTR)  {                     \
                         (void) va_arg(ap, void*);                       \
         for (_i = 0; _i < _k; _i++) {                                   \
                 if (_argtypes[_i] & PA_FLAG_PTR)  {                     \
                         (void) va_arg(ap, void*);                       \