1
0
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:
Kalle Olavi Niemitalo 2007-01-02 21:26:55 +02:00 committed by Kalle Olavi Niemitalo
parent 20bc99173a
commit 4c89e80c67
2 changed files with 8 additions and 8 deletions

View File

@ -40,7 +40,7 @@
#ifdef DEBUG_MEMLEAK
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;
@ -57,7 +57,7 @@ debug_memacpy(unsigned char *f, int l, unsigned char *src, int len)
}
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");
if_assert_failed return NULL;
@ -68,7 +68,7 @@ debug_stracpy(unsigned char *f, int l, unsigned char *src)
#else /* DEBUG_MEMLEAK */
unsigned char *
memacpy(unsigned char *src, int len)
memacpy(const unsigned char *src, int len)
{
unsigned char *m;
@ -85,7 +85,7 @@ memacpy(unsigned char *src, int len)
}
unsigned char *
stracpy(unsigned char *src)
stracpy(const unsigned char *src)
{
assertm(src, "[stracpy]");
if_assert_failed return NULL;

View File

@ -25,17 +25,17 @@
/* 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. */
/* 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. */
unsigned char *stracpy(unsigned char *src);
unsigned char *stracpy(const unsigned char *src);
#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)
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)
#endif /* DEBUG_MEMLEAK */