summaryrefslogtreecommitdiff
path: root/libavutil/mem.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-18 23:59:38 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-05-24 00:41:14 +0200
commit6b4c0be5586acad3bbafd7d2dd02a8328a5ab632 (patch)
tree7b5f2b3dc685733b61f3a81f26a44fa3daacb65b /libavutil/mem.c
parent5f3c436bdf36395974af93c815b86f439e25f36c (diff)
mem: define the MAX_MALLOC_SIZE constant and use it in place of INT_MAX
This makes re-dimensionating the constant simpler, since now it is defined only in one place.
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r--libavutil/mem.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 57dc658b97..29ecbfa055 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -65,6 +65,8 @@ void free(void *ptr);
memory allocator. You do not need to suppress this file because the
linker will do it automatically. */
+#define MAX_MALLOC_SIZE INT_MAX
+
void *av_malloc(size_t size)
{
void *ptr = NULL;
@@ -73,7 +75,7 @@ void *av_malloc(size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-32) )
+ if (size > (MAX_MALLOC_SIZE-32))
return NULL;
#if CONFIG_MEMALIGN_HACK
@@ -127,7 +129,7 @@ void *av_realloc(void *ptr, size_t size)
#endif
/* let's disallow possible ambiguous cases */
- if(size > (INT_MAX-16) )
+ if (size > (MAX_MALLOC_SIZE-16))
return NULL;
#if CONFIG_MEMALIGN_HACK