mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Make input data and source file names const in memacpy and stracpy.
(cherry picked from commit 176bbe83b6
)
This commit is contained in:
parent
20bc99173a
commit
4c89e80c67
@ -40,7 +40,7 @@
|
|||||||
#ifdef DEBUG_MEMLEAK
|
#ifdef DEBUG_MEMLEAK
|
||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
debug_memacpy(unsigned char *f, int l, unsigned char *src, int len)
|
debug_memacpy(const unsigned char *f, int l, const unsigned char *src, int len)
|
||||||
{
|
{
|
||||||
unsigned char *m;
|
unsigned char *m;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ debug_memacpy(unsigned char *f, int l, unsigned char *src, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
debug_stracpy(unsigned char *f, int l, unsigned char *src)
|
debug_stracpy(const unsigned char *f, int l, const unsigned char *src)
|
||||||
{
|
{
|
||||||
string_assert(f, l, src, "stracpy");
|
string_assert(f, l, src, "stracpy");
|
||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
@ -68,7 +68,7 @@ debug_stracpy(unsigned char *f, int l, unsigned char *src)
|
|||||||
#else /* DEBUG_MEMLEAK */
|
#else /* DEBUG_MEMLEAK */
|
||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
memacpy(unsigned char *src, int len)
|
memacpy(const unsigned char *src, int len)
|
||||||
{
|
{
|
||||||
unsigned char *m;
|
unsigned char *m;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ memacpy(unsigned char *src, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char *
|
unsigned char *
|
||||||
stracpy(unsigned char *src)
|
stracpy(const unsigned char *src)
|
||||||
{
|
{
|
||||||
assertm(src, "[stracpy]");
|
assertm(src, "[stracpy]");
|
||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
|
@ -25,17 +25,17 @@
|
|||||||
/* Allocates NUL terminated string with @len bytes from @src.
|
/* Allocates NUL terminated string with @len bytes from @src.
|
||||||
* If @src == NULL or @len < 0 only one byte is allocated and set it to 0. */
|
* If @src == NULL or @len < 0 only one byte is allocated and set it to 0. */
|
||||||
/* Returns the string or NULL on allocation failure. */
|
/* Returns the string or NULL on allocation failure. */
|
||||||
unsigned char *memacpy(unsigned char *src, int len);
|
unsigned char *memacpy(const unsigned char *src, int len);
|
||||||
|
|
||||||
/* Allocated NUL terminated string with the content of @src. */
|
/* Allocated NUL terminated string with the content of @src. */
|
||||||
unsigned char *stracpy(unsigned char *src);
|
unsigned char *stracpy(const unsigned char *src);
|
||||||
|
|
||||||
#else /* DEBUG_MEMLEAK */
|
#else /* DEBUG_MEMLEAK */
|
||||||
|
|
||||||
unsigned char *debug_memacpy(unsigned char *, int, unsigned char *, int);
|
unsigned char *debug_memacpy(const unsigned char *, int, const unsigned char *, int);
|
||||||
#define memacpy(s, l) debug_memacpy(__FILE__, __LINE__, s, l)
|
#define memacpy(s, l) debug_memacpy(__FILE__, __LINE__, s, l)
|
||||||
|
|
||||||
unsigned char *debug_stracpy(unsigned char *, int, unsigned char *);
|
unsigned char *debug_stracpy(const unsigned char *, int, const unsigned char *);
|
||||||
#define stracpy(s) debug_stracpy(__FILE__, __LINE__, s)
|
#define stracpy(s) debug_stracpy(__FILE__, __LINE__, s)
|
||||||
|
|
||||||
#endif /* DEBUG_MEMLEAK */
|
#endif /* DEBUG_MEMLEAK */
|
||||||
|
Loading…
Reference in New Issue
Block a user