mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Fixes some new warnings under clang-15
- -Wdeprecated-non-prototype /src/le/libevent/strlcpy.c:48:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype] event_strlcpy_(dst, src, siz) - -Wstrict-prototypes /src/le/libevent/evthread.c:82:70: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] struct evthread_condition_callbacks *evthread_get_condition_callbacks() - -Wunused-but-set-variable /src/le/libevent/test/regress_buffer.c:130:6: warning: variable 'n' set but not used [-Wunused-but-set-variable] int n = 0; ^
This commit is contained in:
parent
3d138bda11
commit
35375101e7
@ -74,12 +74,12 @@ evthread_set_id_callback(unsigned long (*id_fn)(void))
|
|||||||
evthread_id_fn_ = id_fn;
|
evthread_id_fn_ = id_fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct evthread_lock_callbacks *evthread_get_lock_callbacks()
|
struct evthread_lock_callbacks *evthread_get_lock_callbacks(void)
|
||||||
{
|
{
|
||||||
return evthread_lock_debugging_enabled_
|
return evthread_lock_debugging_enabled_
|
||||||
? &original_lock_fns_ : &evthread_lock_fns_;
|
? &original_lock_fns_ : &evthread_lock_fns_;
|
||||||
}
|
}
|
||||||
struct evthread_condition_callbacks *evthread_get_condition_callbacks()
|
struct evthread_condition_callbacks *evthread_get_condition_callbacks(void)
|
||||||
{
|
{
|
||||||
return evthread_lock_debugging_enabled_
|
return evthread_lock_debugging_enabled_
|
||||||
? &original_cond_fns_ : &evthread_cond_fns_;
|
? &original_cond_fns_ : &evthread_cond_fns_;
|
||||||
|
@ -44,11 +44,7 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp
|
|||||||
* will be copied. Always NUL terminates (unless siz == 0).
|
* will be copied. Always NUL terminates (unless siz == 0).
|
||||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t event_strlcpy_(char *dst, const char *src, size_t siz)
|
||||||
event_strlcpy_(dst, src, siz)
|
|
||||||
char *dst;
|
|
||||||
const char *src;
|
|
||||||
size_t siz;
|
|
||||||
{
|
{
|
||||||
register char *d = dst;
|
register char *d = dst;
|
||||||
register const char *s = src;
|
register const char *s = src;
|
||||||
|
@ -127,19 +127,16 @@ evbuffer_get_waste(struct evbuffer *buf, size_t *allocatedp, size_t *wastedp, si
|
|||||||
{
|
{
|
||||||
struct evbuffer_chain *chain;
|
struct evbuffer_chain *chain;
|
||||||
size_t a, w, u;
|
size_t a, w, u;
|
||||||
int n = 0;
|
|
||||||
u = a = w = 0;
|
u = a = w = 0;
|
||||||
|
|
||||||
chain = buf->first;
|
chain = buf->first;
|
||||||
/* skip empty at start */
|
/* skip empty at start */
|
||||||
while (chain && chain->off==0) {
|
while (chain && chain->off==0) {
|
||||||
++n;
|
|
||||||
a += chain->buffer_len;
|
a += chain->buffer_len;
|
||||||
chain = chain->next;
|
chain = chain->next;
|
||||||
}
|
}
|
||||||
/* first nonempty chain: stuff at the end only is wasted. */
|
/* first nonempty chain: stuff at the end only is wasted. */
|
||||||
if (chain) {
|
if (chain) {
|
||||||
++n;
|
|
||||||
a += chain->buffer_len;
|
a += chain->buffer_len;
|
||||||
u += chain->off;
|
u += chain->off;
|
||||||
if (chain->next && chain->next->off)
|
if (chain->next && chain->next->off)
|
||||||
@ -148,7 +145,6 @@ evbuffer_get_waste(struct evbuffer *buf, size_t *allocatedp, size_t *wastedp, si
|
|||||||
}
|
}
|
||||||
/* subsequent nonempty chains */
|
/* subsequent nonempty chains */
|
||||||
while (chain && chain->off) {
|
while (chain && chain->off) {
|
||||||
++n;
|
|
||||||
a += chain->buffer_len;
|
a += chain->buffer_len;
|
||||||
w += (size_t)chain->misalign;
|
w += (size_t)chain->misalign;
|
||||||
u += chain->off;
|
u += chain->off;
|
||||||
@ -158,7 +154,6 @@ evbuffer_get_waste(struct evbuffer *buf, size_t *allocatedp, size_t *wastedp, si
|
|||||||
}
|
}
|
||||||
/* subsequent empty chains */
|
/* subsequent empty chains */
|
||||||
while (chain) {
|
while (chain) {
|
||||||
++n;
|
|
||||||
a += chain->buffer_len;
|
a += chain->buffer_len;
|
||||||
}
|
}
|
||||||
*allocatedp = a;
|
*allocatedp = a;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user