summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2005-01-19 10:31:51 +0000
committerPeter Kjellerstedt <peter.kjellerstedt@axis.com>2005-01-19 10:31:51 +0000
commitacd92003c8145079c6226211848e26b0472d8445 (patch)
tree56f271fbcb5b1453d93b89843daedfff749d2419
parent7b735a37585a73e8ec60a03ff52e24fe98f10cec (diff)
Avoid compiler warnings.
-rw-r--r--ldso/libdl/libdl.c6
-rw-r--r--libc/stdio/_trans2r.c4
-rw-r--r--libc/stdio/_trans2w.c4
-rw-r--r--libc/stdlib/malloc-standard/free.c62
-rw-r--r--libc/stdlib/malloc-standard/mallinfo.c24
-rw-r--r--libcrypt/md5.c10
6 files changed, 56 insertions, 54 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 56e6850d0..012056a35 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -358,7 +358,7 @@ void *dlopen(const char *libname, int flag)
if (dl_elf_func && *dl_elf_func != NULL) {
#ifdef __SUPPORT_LD_DEBUG__
if(_dl_debug)
- fprintf(stderr, "running ctors for library %s at '%x'\n", tpnt->libname, dl_elf_func);
+ fprintf(stderr, "running ctors for library %s at '%x'\n", tpnt->libname, (unsigned)dl_elf_func);
#endif
(*dl_elf_func) ();
}
@@ -466,7 +466,7 @@ static int do_dlclose(void *vhandle, int need_fini)
dl_elf_fini = (int (*)(void)) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]);
#ifdef __SUPPORT_LD_DEBUG__
if(_dl_debug)
- fprintf(stderr, "running dtors for library %s at '%x'\n", tpnt->libname, dl_elf_fini);
+ fprintf(stderr, "running dtors for library %s at '%x'\n", tpnt->libname, (unsigned)dl_elf_fini);
#endif
(*dl_elf_fini) ();
}
@@ -555,7 +555,7 @@ char *dlerror(void)
return NULL;
retval = dl_error_names[_dl_error_number];
_dl_error_number = 0;
- return retval;
+ return (char *)retval;
}
/*
diff --git a/libc/stdio/_trans2r.c b/libc/stdio/_trans2r.c
index d33d9eba8..9afb75428 100644
--- a/libc/stdio/_trans2r.c
+++ b/libc/stdio/_trans2r.c
@@ -41,9 +41,13 @@ int __stdio_trans2r(FILE * __restrict stream)
#endif
if (stream->__modeflags & __FLAG_WRITEONLY) {
+#if defined(__UCLIBC_HAS_WCHAR__) || !defined(__UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__)
DO_EBADF:
+#endif
__set_errno(EBADF);
+#ifdef __UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__
ERROR:
+#endif
__STDIO_STREAM_SET_ERROR(stream);
__STDIO_STREAM_VALIDATE(stream);
return EOF;
diff --git a/libc/stdio/_trans2w.c b/libc/stdio/_trans2w.c
index fdde2bebf..7ab3403c0 100644
--- a/libc/stdio/_trans2w.c
+++ b/libc/stdio/_trans2w.c
@@ -40,9 +40,13 @@ int __stdio_trans2w(FILE * __restrict stream)
#endif
if (stream->__modeflags & __FLAG_READONLY) {
+#if defined(__UCLIBC_HAS_WCHAR__) || !defined(__UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__)
DO_EBADF:
+#endif
__set_errno(EBADF);
+#ifdef __UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION__
ERROR:
+#endif
__STDIO_STREAM_SET_ERROR(stream);
__STDIO_STREAM_VALIDATE(stream);
return EOF;
diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
index ec4debd56..94e1d65b1 100644
--- a/libc/stdlib/malloc-standard/free.c
+++ b/libc/stdlib/malloc-standard/free.c
@@ -17,37 +17,6 @@
#include "malloc.h"
-/* ------------------------- malloc_trim -------------------------
- malloc_trim(size_t pad);
-
- If possible, gives memory back to the system (via negative
- arguments to sbrk) if there is unused memory at the `high' end of
- the malloc pool. You can call this after freeing large blocks of
- memory to potentially reduce the system-level memory requirements
- of a program. However, it cannot guarantee to reduce memory. Under
- some allocation patterns, some large free blocks of memory will be
- locked between two used chunks, so they cannot be given back to
- the system.
-
- The `pad' argument to malloc_trim represents the amount of free
- trailing space to leave untrimmed. If this argument is zero,
- only the minimum amount of memory to maintain internal data
- structures will be left (one page or less). Non-zero arguments
- can be supplied to maintain enough trailing space to service
- future expected allocations without having to re-obtain memory
- from the system.
-
- Malloc_trim returns 1 if it actually released any memory, else 0.
- On systems that do not support "negative sbrks", it will always
- return 0.
-*/
-int malloc_trim(size_t pad)
-{
- mstate av = get_malloc_state();
- __malloc_consolidate(av);
- return __malloc_trim(pad, av);
-}
-
/* ------------------------- __malloc_trim -------------------------
__malloc_trim is an inverse of sorts to __malloc_alloc. It gives memory
back to the system (via negative arguments to sbrk) if there is unused
@@ -109,6 +78,37 @@ static int __malloc_trim(size_t pad, mstate av)
return 0;
}
+/* ------------------------- malloc_trim -------------------------
+ malloc_trim(size_t pad);
+
+ If possible, gives memory back to the system (via negative
+ arguments to sbrk) if there is unused memory at the `high' end of
+ the malloc pool. You can call this after freeing large blocks of
+ memory to potentially reduce the system-level memory requirements
+ of a program. However, it cannot guarantee to reduce memory. Under
+ some allocation patterns, some large free blocks of memory will be
+ locked between two used chunks, so they cannot be given back to
+ the system.
+
+ The `pad' argument to malloc_trim represents the amount of free
+ trailing space to leave untrimmed. If this argument is zero,
+ only the minimum amount of memory to maintain internal data
+ structures will be left (one page or less). Non-zero arguments
+ can be supplied to maintain enough trailing space to service
+ future expected allocations without having to re-obtain memory
+ from the system.
+
+ Malloc_trim returns 1 if it actually released any memory, else 0.
+ On systems that do not support "negative sbrks", it will always
+ return 0.
+*/
+int malloc_trim(size_t pad)
+{
+ mstate av = get_malloc_state();
+ __malloc_consolidate(av);
+ return __malloc_trim(pad, av);
+}
+
/*
Initialize a malloc_state struct.
diff --git a/libc/stdlib/malloc-standard/mallinfo.c b/libc/stdlib/malloc-standard/mallinfo.c
index f35aab00f..51ac423fe 100644
--- a/libc/stdlib/malloc-standard/mallinfo.c
+++ b/libc/stdlib/malloc-standard/mallinfo.c
@@ -88,19 +88,19 @@ void malloc_stats(FILE *file)
}
mi = mallinfo();
- fprintf(file, "total bytes allocated = %10lu\n", (unsigned int)(mi.arena + mi.hblkhd));
- fprintf(file, "total bytes in use bytes = %10lu\n", (unsigned int)(mi.uordblks + mi.hblkhd));
- fprintf(file, "total non-mmapped bytes allocated = %10lu\n", (unsigned int)(mi.arena));
- fprintf(file, "number of mmapped regions = %10lu\n", (unsigned int)(mi.hblks));
- fprintf(file, "total allocated mmap space = %10lu\n", (unsigned int)(mi.hblkhd));
- fprintf(file, "total allocated sbrk space = %10lu\n", (unsigned int)(mi.uordblks));
+ fprintf(file, "total bytes allocated = %10u\n", (unsigned int)(mi.arena + mi.hblkhd));
+ fprintf(file, "total bytes in use bytes = %10u\n", (unsigned int)(mi.uordblks + mi.hblkhd));
+ fprintf(file, "total non-mmapped bytes allocated = %10d\n", mi.arena);
+ fprintf(file, "number of mmapped regions = %10d\n", mi.hblks);
+ fprintf(file, "total allocated mmap space = %10d\n", mi.hblkhd);
+ fprintf(file, "total allocated sbrk space = %10d\n", mi.uordblks);
#if 0
- fprintf(file, "number of free chunks = %10lu\n", (unsigned int)(mi.ordblks));
- fprintf(file, "number of fastbin blocks = %10lu\n", (unsigned int)(mi.smblks));
- fprintf(file, "space in freed fastbin blocks = %10lu\n", (unsigned int)(mi.fsmblks));
+ fprintf(file, "number of free chunks = %10d\n", mi.ordblks);
+ fprintf(file, "number of fastbin blocks = %10d\n", mi.smblks);
+ fprintf(file, "space in freed fastbin blocks = %10d\n", mi.fsmblks);
#endif
- fprintf(file, "maximum total allocated space = %10lu\n", (unsigned int)(mi.usmblks));
- fprintf(file, "total free space = %10lu\n", (unsigned int)(mi.fordblks));
- fprintf(file, "memory releasable via malloc_trim = %10lu\n", (unsigned int)(mi.keepcost));
+ fprintf(file, "maximum total allocated space = %10d\n", mi.usmblks);
+ fprintf(file, "total free space = %10d\n", mi.fordblks);
+ fprintf(file, "memory releasable via malloc_trim = %10d\n", mi.keepcost);
}
diff --git a/libcrypt/md5.c b/libcrypt/md5.c
index cf8757083..27ee2a802 100644
--- a/libcrypt/md5.c
+++ b/libcrypt/md5.c
@@ -112,10 +112,7 @@ static const unsigned char __md5_itoa64[] = /* 0 ... 63 => ascii - 64 */
*/
static void
-__md5_Encode (output, input, len)
- unsigned char *output;
- u_int32_t *input;
- unsigned int len;
+__md5_Encode (unsigned char *output, u_int32_t *input, unsigned int len)
{
unsigned int i, j;
@@ -133,10 +130,7 @@ __md5_Encode (output, input, len)
*/
static void
-__md5_Decode (output, input, len)
- u_int32_t *output;
- const unsigned char *input;
- unsigned int len;
+__md5_Decode (u_int32_t *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;