mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
librb: silence some fairly harmless compiler warnings
These include warnings about "break" statements that will never be executed (because they are after "return" statements), unused macros (lost to code refactoring or never even used in the first place), functions that call abort() or loop indefinitely but aren't marked with the "noreturn" attribute, and use of variables possibly uninitialised (a false positive).
This commit is contained in:
parent
d5ad6015c5
commit
47a66e154f
8 changed files with 7 additions and 23 deletions
|
@ -58,5 +58,5 @@ void rb_helper_write_flush(rb_helper *helper);
|
|||
void rb_helper_run(rb_helper *helper);
|
||||
void rb_helper_close(rb_helper *helper);
|
||||
int rb_helper_read(rb_helper *helper, void *buf, size_t bufsize);
|
||||
void rb_helper_loop(rb_helper *helper, long delay);
|
||||
void rb_helper_loop(rb_helper *helper, long delay) __attribute__((noreturn));
|
||||
#endif
|
||||
|
|
|
@ -215,14 +215,14 @@ typedef void die_cb(const char *buffer);
|
|||
char *rb_ctime(const time_t, char *, size_t);
|
||||
char *rb_date(const time_t, char *, size_t);
|
||||
void rb_lib_log(const char *, ...);
|
||||
void rb_lib_restart(const char *, ...);
|
||||
void rb_lib_restart(const char *, ...) __attribute__((noreturn));
|
||||
void rb_lib_die(const char *, ...);
|
||||
void rb_set_time(void);
|
||||
const char *rb_lib_version(void);
|
||||
|
||||
void rb_lib_init(log_cb * xilog, restart_cb * irestart, die_cb * idie, int closeall, int maxfds,
|
||||
size_t dh_size, size_t fd_heap_size);
|
||||
void rb_lib_loop(long delay);
|
||||
void rb_lib_loop(long delay) __attribute__((noreturn));
|
||||
|
||||
time_t rb_current_time(void);
|
||||
const struct timeval *rb_current_time_tv(void);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
|
||||
void rb_outofmemory(void);
|
||||
void rb_outofmemory(void) __attribute__((noreturn));
|
||||
|
||||
static inline void *
|
||||
rb_malloc(size_t size)
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include <librb_config.h>
|
||||
#include <rb_lib.h>
|
||||
|
||||
static void _rb_bh_fail(const char *reason, const char *file, int line) __attribute__((noreturn));
|
||||
|
||||
static uintptr_t offset_pad;
|
||||
|
||||
/* status information for an allocated block in heap */
|
||||
|
|
|
@ -1345,16 +1345,13 @@ rb_inet_ntop_sock(struct sockaddr *src, char *dst, unsigned int size)
|
|||
{
|
||||
case AF_INET:
|
||||
return (rb_inet_ntop(AF_INET, &((struct sockaddr_in *)src)->sin_addr, dst, size));
|
||||
break;
|
||||
#ifdef RB_IPV6
|
||||
case AF_INET6:
|
||||
return (rb_inet_ntop
|
||||
(AF_INET6, &((struct sockaddr_in6 *)src)->sin6_addr, dst, size));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,16 +46,12 @@ rb_crypt(const char *key, const char *salt)
|
|||
{
|
||||
case '1':
|
||||
return rb_md5_crypt(key, salt);
|
||||
break;
|
||||
case '5':
|
||||
return rb_sha256_crypt(key, salt);
|
||||
break;
|
||||
case '6':
|
||||
return rb_sha512_crypt(key, salt);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -536,7 +532,7 @@ rb_do_des(uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int co
|
|||
* l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
|
||||
*/
|
||||
uint32_t l, r, *kl, *kr, *kl1, *kr1;
|
||||
uint32_t f, r48l, r48r;
|
||||
uint32_t f = 0, r48l, r48r;
|
||||
int round;
|
||||
|
||||
if(count == 0)
|
||||
|
@ -748,9 +744,6 @@ rb_des_crypt(const char *key, const char *setting)
|
|||
* edited for clarity and style only.
|
||||
*/
|
||||
|
||||
#define MD5_BLOCK_LENGTH 64
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
|
||||
#define MD5_SIZE 16
|
||||
|
||||
static void
|
||||
|
|
|
@ -31,10 +31,6 @@ static rb_bh *rb_linebuf_heap;
|
|||
|
||||
static int bufline_count = 0;
|
||||
|
||||
#ifndef LINEBUF_HEAP_SIZE
|
||||
#define LINEBUF_HEAP_SIZE 2048
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rb_linebuf_init
|
||||
*
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
* #define PATRICIA_DEBUG 1
|
||||
*/
|
||||
|
||||
#define PREFIX_HEAP_COUNT 1024
|
||||
#define NODE_HEAP_COUNT 1024
|
||||
#define PATRICIA_HEAP_COUNT 128
|
||||
|
||||
void
|
||||
rb_init_patricia(void)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue