Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b634b36f
Commit
b634b36f
authored
Sep 04, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mem: Improve documentation wording and spelling
parent
26b241c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
mem.c
libavutil/mem.c
+2
-2
mem.h
libavutil/mem.h
+14
-16
No files found.
libavutil/mem.c
View file @
b634b36f
...
@@ -65,7 +65,7 @@ void *av_malloc(size_t size)
...
@@ -65,7 +65,7 @@ void *av_malloc(size_t size)
long
diff
;
long
diff
;
#endif
#endif
/* let's disallow possibl
e
ambiguous cases */
/* let's disallow possibl
y
ambiguous cases */
if
(
size
>
(
INT_MAX
-
32
)
||
!
size
)
if
(
size
>
(
INT_MAX
-
32
)
||
!
size
)
return
NULL
;
return
NULL
;
...
@@ -119,7 +119,7 @@ void *av_realloc(void *ptr, size_t size)
...
@@ -119,7 +119,7 @@ void *av_realloc(void *ptr, size_t size)
int
diff
;
int
diff
;
#endif
#endif
/* let's disallow possibl
e
ambiguous cases */
/* let's disallow possibl
y
ambiguous cases */
if
(
size
>
(
INT_MAX
-
16
))
if
(
size
>
(
INT_MAX
-
16
))
return
NULL
;
return
NULL
;
...
...
libavutil/mem.h
View file @
b634b36f
...
@@ -82,8 +82,7 @@
...
@@ -82,8 +82,7 @@
void
*
av_malloc
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
void
*
av_malloc
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
/**
/**
* Helper function to allocate a block of size * nmemb bytes with
* Allocate a block of size * nmemb bytes with av_malloc().
* using av_malloc()
* @param nmemb Number of elements
* @param nmemb Number of elements
* @param size Size of the single element
* @param size Size of the single element
* @return Pointer to the allocated block, NULL if the block cannot
* @return Pointer to the allocated block, NULL if the block cannot
...
@@ -101,14 +100,14 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
...
@@ -101,14 +100,14 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
* Allocate or reallocate a block of memory.
* Allocate or reallocate a block of memory.
* If ptr is NULL and size > 0, allocate a new block. If
* If ptr is NULL and size > 0, allocate a new block. If
* size is zero, free the memory block pointed to by ptr.
* size is zero, free the memory block pointed to by ptr.
* @note Pointers provided by av_malloc family of functions cannot be
* passed to av_realloc().
* @param ptr Pointer to a memory block already allocated with
* @param ptr Pointer to a memory block already allocated with
* av_realloc() or NULL.
* av_realloc() or NULL.
* @param size Size in bytes
for
the memory block to be allocated or
* @param size Size in bytes
of
the memory block to be allocated or
* reallocated.
* reallocated.
* @return Pointer to a newly
reallocated block or NULL if the block
* @return Pointer to a newly
-
reallocated block or NULL if the block
* cannot be reallocated or the function is used to free the memory block.
* cannot be reallocated or the function is used to free the memory block.
* @note av_realloc() is not guaranteed to maintain the alignment of
* pointers originating from the av_malloc() family of functions.
* @see av_fast_realloc()
* @see av_fast_realloc()
*/
*/
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
...
@@ -117,29 +116,29 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
...
@@ -117,29 +116,29 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
* Allocate or reallocate an array.
* Allocate or reallocate an array.
* If ptr is NULL and nmemb > 0, allocate a new block. If
* If ptr is NULL and nmemb > 0, allocate a new block. If
* nmemb is zero, free the memory block pointed to by ptr.
* nmemb is zero, free the memory block pointed to by ptr.
* @note Pointers provided by av_malloc family of functions cannot be
* passed to av_realloc_array().
* @param ptr Pointer to a memory block already allocated with
* @param ptr Pointer to a memory block already allocated with
* av_realloc() or NULL.
* av_realloc() or NULL.
* @param nmemb Number of elements
* @param nmemb Number of elements
* @param size Size of the single element
* @param size Size of the single element
* @return Pointer to a newly
reallocated block or NULL if the block
* @return Pointer to a newly
-
reallocated block or NULL if the block
* cannot be reallocated or the function is used to free the memory block.
* cannot be reallocated or the function is used to free the memory block.
* @note av_realloc_array() is not guaranteed to maintain the alignment of
* pointers originating from the av_malloc() family of functions.
*/
*/
av_alloc_size
(
2
,
3
)
void
*
av_realloc_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
av_alloc_size
(
2
,
3
)
void
*
av_realloc_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
/**
/**
* Allocate or reallocate an array.
* Allocate or reallocate an array
through a pointer to a pointer
.
* If *ptr is NULL and nmemb > 0, allocate a new block. If
* If *ptr is NULL and nmemb > 0, allocate a new block. If
* nmemb is zero, free the memory block pointed to by ptr.
* nmemb is zero, free the memory block pointed to by ptr.
* @note Pointers provided by av_malloc family of functions cannot be
* passed to av_reallocp_array().
* @param ptr Pointer to a pointer to a memory block already allocated
* @param ptr Pointer to a pointer to a memory block already allocated
* with av_realloc(), or pointer to a pointer to NULL.
* with av_realloc(), or pointer to a pointer to NULL.
* The pointer is updated on success, or freed on failure.
* The pointer is updated on success, or freed on failure.
* @param nmemb Number of elements
* @param nmemb Number of elements
* @param size Size of the single element
* @param size Size of the single element
* @return Zero on success, an AVERROR error code on failure.
* @return Zero on success, an AVERROR error code on failure.
* @note av_reallocp_array() is not guaranteed to maintain the alignment of
* pointers originating from the av_malloc() family of functions.
*/
*/
av_alloc_size
(
2
,
3
)
int
av_reallocp_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
av_alloc_size
(
2
,
3
)
int
av_reallocp_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
);
...
@@ -164,8 +163,7 @@ void av_free(void *ptr);
...
@@ -164,8 +163,7 @@ void av_free(void *ptr);
void
*
av_mallocz
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
void
*
av_mallocz
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
/**
/**
* Helper function to allocate a block of size * nmemb bytes with
* Allocate a block of size * nmemb bytes with av_mallocz().
* using av_mallocz()
* @param nmemb Number of elements
* @param nmemb Number of elements
* @param size Size of the single element
* @param size Size of the single element
* @return Pointer to the allocated block, NULL if the block cannot
* @return Pointer to the allocated block, NULL if the block cannot
...
@@ -183,7 +181,7 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
...
@@ -183,7 +181,7 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
/**
/**
* Duplicate the string s.
* Duplicate the string s.
* @param s string to be duplicated
* @param s string to be duplicated
* @return Pointer to a newly
allocated string containing a
* @return Pointer to a newly
-
allocated string containing a
* copy of s or NULL if the string cannot be allocated.
* copy of s or NULL if the string cannot be allocated.
*/
*/
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
...
@@ -198,7 +196,7 @@ char *av_strdup(const char *s) av_malloc_attrib;
...
@@ -198,7 +196,7 @@ char *av_strdup(const char *s) av_malloc_attrib;
void
av_freep
(
void
*
ptr
);
void
av_freep
(
void
*
ptr
);
/**
/**
*
@brief
deliberately overlapping memcpy implementation
* deliberately overlapping memcpy implementation
* @param dst destination buffer
* @param dst destination buffer
* @param back how many bytes back we start (the initial size of the overlapping window)
* @param back how many bytes back we start (the initial size of the overlapping window)
* @param cnt number of bytes to copy, must be >= 0
* @param cnt number of bytes to copy, must be >= 0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment