summaryrefslogtreecommitdiffstats
path: root/mpcommon.h
diff options
context:
space:
mode:
Diffstat (limited to 'mpcommon.h')
-rw-r--r--mpcommon.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/mpcommon.h b/mpcommon.h
index bc35934e41..fd520eacf6 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -25,6 +25,11 @@
#define ROUND(x) ((int)((x) < 0 ? (x) - 0.5 : (x) + 0.5))
#define MP_TALLOC_ELEMS(p) (talloc_get_size(p) / sizeof((p)[0]))
+#define MP_GROW_ARRAY(p, nextidx) do { \
+ if ((nextidx) == MP_TALLOC_ELEMS(p)) \
+ p = talloc_realloc_size(NULL, p, talloc_get_size(p) * 2); } while (0)
+#define MP_RESIZE_ARRAY(ctx, p, count) do { \
+ p = talloc_realloc_size((ctx), p, (count) * sizeof(p[0])); } while (0)
extern const char *mplayer_version;