libevent: remove unnecessary CONSTCOND comments

Since lint1/tree.c 1.202 from 2021-01-31, lint no longer needs the
/*CONSTCOND*/ for do-while-0 "loops".

This reduces the local modifications.

No functional change.
This commit is contained in:
rillig 2021-04-10 19:02:37 +00:00
parent 07861fad6f
commit a848e48c71
14 changed files with 68 additions and 68 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufferevent-internal.h,v 1.4 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: bufferevent-internal.h,v 1.5 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2008-2012 Niels Provos and Nick Mathewson
@ -461,14 +461,14 @@ bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *a
do { \
if (evutil_timerisset(&(bev)->timeout_read)) \
event_add(&(bev)->ev_read, &(bev)->timeout_read); \
} while (/*CONSTCOND*/0)
} while (0)
/** Internal use: We have just successfully written data from an inbuf, so
* reset the read timeout (if any). */
#define BEV_RESET_GENERIC_WRITE_TIMEOUT(bev) \
do { \
if (evutil_timerisset(&(bev)->timeout_write)) \
event_add(&(bev)->ev_write, &(bev)->timeout_write); \
} while (/*CONSTCOND*/0)
} while (0)
#define BEV_DEL_GENERIC_READ_TIMEOUT(bev) \
event_del(&(bev)->ev_read)
#define BEV_DEL_GENERIC_WRITE_TIMEOUT(bev) \
@ -487,13 +487,13 @@ bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *a
#define BEV_LOCK(b) do { \
struct bufferevent_private *locking = BEV_UPCAST(b); \
EVLOCK_LOCK(locking->lock, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** Internal: Release the lock (if any) on a bufferevent */
#define BEV_UNLOCK(b) do { \
struct bufferevent_private *locking = BEV_UPCAST(b); \
EVLOCK_UNLOCK(locking->lock, 0); \
} while (/*CONSTCOND*/0)
} while (0)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufferevent.c,v 1.5 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: bufferevent.c,v 1.6 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu>
@ -29,7 +29,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: bufferevent.c,v 1.5 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: bufferevent.c,v 1.6 2021/04/10 19:02:37 rillig Exp $");
#include "evconfig-private.h"
#include <sys/types.h>
@ -238,7 +238,7 @@ bufferevent_run_deferred_callbacks_unlocked(struct event_callback *cb, void *arg
(bevp)->bev.ev_base, \
&(bevp)->deferred)) \
bufferevent_incref_(&(bevp)->bev); \
} while (/*CONSTCOND*/0)
} while (0)
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: bufferevent_ratelim.c,v 1.4 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: bufferevent_ratelim.c,v 1.5 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@ -484,7 +484,7 @@ bev_group_random_element_(struct bufferevent_rate_limit_group *group)
bev = LIST_NEXT(bev, rate_limiting->next_in_group)) { \
block ; \
} \
} while (/*CONSTCOND*/0)
} while (0)
static void
bev_group_unsuspend_reading_(struct bufferevent_rate_limit_group *g)

View File

@ -1,4 +1,4 @@
/* $NetBSD: evbuffer-internal.h,v 1.5 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: evbuffer-internal.h,v 1.6 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
@ -287,19 +287,19 @@ struct evbuffer_multicast_parent {
#define EVBUFFER_LOCK(buffer) \
do { \
EVLOCK_LOCK((buffer)->lock, 0); \
} while (/*CONSTCOND*/0)
} while (0)
#define EVBUFFER_UNLOCK(buffer) \
do { \
EVLOCK_UNLOCK((buffer)->lock, 0); \
} while (/*CONSTCOND*/0)
} while (0)
#define EVBUFFER_LOCK2(buffer1, buffer2) \
do { \
EVLOCK_LOCK2((buffer1)->lock, (buffer2)->lock, 0, 0); \
} while (/*CONSTCOND*/0)
} while (0)
#define EVBUFFER_UNLOCK2(buffer1, buffer2) \
do { \
EVLOCK_UNLOCK2((buffer1)->lock, (buffer2)->lock, 0, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** Increase the reference count of buf by one. */
void evbuffer_incref_(struct evbuffer *buf);
@ -332,7 +332,7 @@ int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch,
#define WSABUF_FROM_EVBUFFER_IOV(i,ei) do { \
(i)->buf = (ei)->iov_base; \
(i)->len = (unsigned long)(ei)->iov_len; \
} while (/*CONSTCOND*/0)
} while (0)
/* XXXX the cast above is safe for now, but not if we allow mmaps on win64.
* See note in buffer_iocp's launch_write function */

View File

@ -1,4 +1,4 @@
/* $NetBSD: evdns.c,v 1.5 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: evdns.c,v 1.6 2021/04/10 19:02:37 rillig Exp $ */
/* Copyright 2006-2007 Niels Provos
* Copyright 2007-2012 Nick Mathewson and Niels Provos
@ -52,7 +52,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: evdns.c,v 1.5 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: evdns.c,v 1.6 2021/04/10 19:02:37 rillig Exp $");
#include "evconfig-private.h"
#include <sys/types.h>
@ -1080,7 +1080,7 @@ reply_parse(struct evdns_base *base, u8 *packet, int length) {
if (name_parse(packet, length, &j, tmp_name, \
sizeof(tmp_name))<0) \
goto err; \
} while (/*CONSTCOND*/0)
} while (0)
reply.type = req->request_type;
@ -1629,14 +1629,14 @@ dnsname_to_labels(u8 *const buf, size_t buf_len, off_t j,
t_ = htons(x); \
memcpy(buf + j, &t_, 2); \
j += 2; \
} while (/*CONSTCOND*/0)
} while (0)
#define APPEND32(x) do { \
if (j + 4 > (off_t)buf_len) \
goto overflow; \
t32_ = htonl(x); \
memcpy(buf + j, &t32_, 4); \
j += 4; \
} while (/*CONSTCOND*/0)
} while (0)
if (name_len > 255) return -2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: evmap.c,v 1.4 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: evmap.c,v 1.5 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@ -27,7 +27,7 @@
*/
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: evmap.c,v 1.4 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: evmap.c,v 1.5 2021/04/10 19:02:37 rillig Exp $");
#include "evconfig-private.h"
#ifdef _WIN32
@ -141,7 +141,7 @@ HT_GENERATE(event_io_map, event_map_entry, map_node, hashsocket, eqsocket,
HT_FOI_INSERT_(map_node, map, &key_, ent_, ptr) \
}); \
(x) = &ent_->ent.type; \
} while (/*CONSTCOND*/0)
} while (0)
void evmap_io_initmap_(struct event_io_map *ctx)
{
@ -180,7 +180,7 @@ void evmap_io_clear_(struct event_io_map *ctx)
(ctor)((struct type *)(map)->entries[slot]); \
} \
(x) = (struct type *)((map)->entries[slot]); \
} while (/*CONSTCOND*/0)
} while (0)
/* If we aren't using hashtables, then define the IO_SLOT macros and functions
as thin aliases over the SIGNAL_SLOT versions. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: evthread-internal.h,v 1.4 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: evthread-internal.h,v 1.5 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2008-2012 Niels Provos, Nick Mathewson
@ -89,21 +89,21 @@ extern int evthread_lock_debugging_enabled_;
void *lock_tmp_ = (lockvar); \
if (lock_tmp_ && evthread_lock_fns_.free) \
evthread_lock_fns_.free(lock_tmp_, (locktype)); \
} while (/*CONSTCOND*/0)
} while (0)
/** Acquire a lock. */
#define EVLOCK_LOCK(lockvar,mode) \
do { \
if (lockvar) \
evthread_lock_fns_.lock(mode, lockvar); \
} while (/*CONSTCOND*/0)
} while (0)
/** Release a lock */
#define EVLOCK_UNLOCK(lockvar,mode) \
do { \
if (lockvar) \
evthread_lock_fns_.unlock(mode, lockvar); \
} while (/*CONSTCOND*/0)
} while (0)
/** Helper: put lockvar1 and lockvar2 into pointerwise ascending order. */
#define EVLOCK_SORTLOCKS_(lockvar1, lockvar2) \
@ -113,18 +113,18 @@ extern int evthread_lock_debugging_enabled_;
lockvar1 = lockvar2; \
lockvar2 = tmp; \
} \
} while (/*CONSTCOND*/0)
} while (0)
/** Lock an event_base, if it is set up for locking. Acquires the lock
in the base structure whose field is named 'lockvar'. */
#define EVBASE_ACQUIRE_LOCK(base, lockvar) do { \
EVLOCK_LOCK((base)->lockvar, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** Unlock an event_base, if it is set up for locking. */
#define EVBASE_RELEASE_LOCK(base, lockvar) do { \
EVLOCK_UNLOCK((base)->lockvar, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** If lock debugging is enabled, and lock is non-null, assert that 'lock' is
* locked and held by us. */
@ -133,7 +133,7 @@ extern int evthread_lock_debugging_enabled_;
if ((lock) && evthread_lock_debugging_enabled_) { \
EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
} \
} while (/*CONSTCOND*/0)
} while (0)
/** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
* manage to get it. */
@ -156,13 +156,13 @@ EVLOCK_TRY_LOCK_(void *lock)
do { \
(condvar) = evthread_cond_fns_.alloc_condition ? \
evthread_cond_fns_.alloc_condition(0) : NULL; \
} while (/*CONSTCOND*/0)
} while (0)
/** Deallocate and free a condition variable in condvar */
#define EVTHREAD_FREE_COND(cond) \
do { \
if (cond) \
evthread_cond_fns_.free_condition((cond)); \
} while (/*CONSTCOND*/0)
} while (0)
/** Signal one thread waiting on cond */
#define EVTHREAD_COND_SIGNAL(cond) \
( (cond) ? evthread_cond_fns_.signal_condition((cond), 0) : 0 )
@ -222,32 +222,32 @@ int evthreadimpl_locking_enabled_(void);
void *lock_tmp_ = (lockvar); \
if (lock_tmp_) \
evthreadimpl_lock_free_(lock_tmp_, (locktype)); \
} while (/*CONSTCOND*/0)
} while (0)
/** Acquire a lock. */
#define EVLOCK_LOCK(lockvar,mode) \
do { \
if (lockvar) \
evthreadimpl_lock_lock_(mode, lockvar); \
} while (/*CONSTCOND*/0)
} while (0)
/** Release a lock */
#define EVLOCK_UNLOCK(lockvar,mode) \
do { \
if (lockvar) \
evthreadimpl_lock_unlock_(mode, lockvar); \
} while (/*CONSTCOND*/0)
} while (0)
/** Lock an event_base, if it is set up for locking. Acquires the lock
in the base structure whose field is named 'lockvar'. */
#define EVBASE_ACQUIRE_LOCK(base, lockvar) do { \
EVLOCK_LOCK((base)->lockvar, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** Unlock an event_base, if it is set up for locking. */
#define EVBASE_RELEASE_LOCK(base, lockvar) do { \
EVLOCK_UNLOCK((base)->lockvar, 0); \
} while (/*CONSTCOND*/0)
} while (0)
/** If lock debugging is enabled, and lock is non-null, assert that 'lock' is
* locked and held by us. */
@ -256,7 +256,7 @@ int evthreadimpl_locking_enabled_(void);
if ((lock) && evthreadimpl_is_lock_debugging_enabled_()) { \
EVUTIL_ASSERT(evthread_is_debug_lock_held_(lock)); \
} \
} while (/*CONSTCOND*/0)
} while (0)
/** Try to grab the lock for 'lockvar' without blocking, and return 1 if we
* manage to get it. */
@ -278,13 +278,13 @@ EVLOCK_TRY_LOCK_(void *lock)
#define EVTHREAD_ALLOC_COND(condvar) \
do { \
(condvar) = evthreadimpl_cond_alloc_(0); \
} while (/*CONSTCOND*/0)
} while (0)
/** Deallocate and free a condition variable in condvar */
#define EVTHREAD_FREE_COND(cond) \
do { \
if (cond) \
evthreadimpl_cond_free_((cond)); \
} while (/*CONSTCOND*/0)
} while (0)
/** Signal one thread waiting on cond */
#define EVTHREAD_COND_SIGNAL(cond) \
( (cond) ? evthreadimpl_cond_signal_((cond), 0) : 0 )
@ -345,7 +345,7 @@ EVLOCK_TRY_LOCK_(void *lock)
lockvar1 = lockvar2; \
lockvar2 = tmp; \
} \
} while (/*CONSTCOND*/0)
} while (0)
/** Acquire both lock1 and lock2. Always allocates locks in the same order,
* so that two threads locking two locks with LOCK2 will not deadlock. */
@ -357,7 +357,7 @@ EVLOCK_TRY_LOCK_(void *lock)
EVLOCK_LOCK(lock1_tmplock_,mode1); \
if (lock2_tmplock_ != lock1_tmplock_) \
EVLOCK_LOCK(lock2_tmplock_,mode2); \
} while (/*CONSTCOND*/0)
} while (0)
/** Release both lock1 and lock2. */
#define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) \
do { \
@ -367,7 +367,7 @@ EVLOCK_TRY_LOCK_(void *lock)
if (lock2_tmplock_ != lock1_tmplock_) \
EVLOCK_UNLOCK(lock2_tmplock_,mode2); \
EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
} while (/*CONSTCOND*/0)
} while (0)
EVENT2_EXPORT_SYMBOL
int evthread_is_debug_lock_held_(void *lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ratelim-internal.h,v 1.3 2017/01/31 23:17:39 christos Exp $ */
/* $NetBSD: ratelim-internal.h,v 1.4 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
*
@ -92,12 +92,12 @@ int bufferevent_remove_from_rate_limit_group_internal_(struct bufferevent *bev,
#define ev_token_bucket_decrement_read(b,n) \
do { \
(b)->read_limit -= (n); \
} while (/*CONSTCOND*/0)
} while (0)
/** Decrease the write limit of 'b' by 'n' bytes */
#define ev_token_bucket_decrement_write(b,n) \
do { \
(b)->write_limit -= (n); \
} while (/*CONSTCOND*/0)
} while (0)
#ifdef __cplusplus
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: regress.c,v 1.10 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: regress.c,v 1.11 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2003-2007 Niels Provos <provos@citi.umich.edu>
@ -35,7 +35,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: regress.c,v 1.10 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: regress.c,v 1.11 2021/04/10 19:02:37 rillig Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@ -293,7 +293,7 @@ combined_write_cb(evutil_socket_t fd, short event, void *arg)
TT_FAIL(("Legacy test %s not wrapped properly", x)); \
return; \
} \
} while (/*CONSTCOND*/0)
} while (0)
#define cleanup_test() setup_test("cleanup")
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: regress.h,v 1.7 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: regress.h,v 1.8 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
@ -119,7 +119,7 @@ int test_ai_eq_(const struct evutil_addrinfo *ai, const char *sockaddr_port,
#define test_ai_eq(ai, str, s, p) do { \
if (test_ai_eq_((ai), (str), (s), (p), __LINE__)<0) \
goto end; \
} while (/*CONSTCOND*/0)
} while (0)
#define test_timeval_diff_leq(tv1, tv2, diff, tolerance) \
tt_int_op(labs(timeval_msec_diff((tv1), (tv2)) - diff), <=, tolerance)

View File

@ -1,4 +1,4 @@
/* $NetBSD: regress_buffer.c,v 1.7 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: regress_buffer.c,v 1.8 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2003-2007 Niels Provos <provos@citi.umich.edu>
@ -35,7 +35,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: regress_buffer.c,v 1.7 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: regress_buffer.c,v 1.8 2021/04/10 19:02:37 rillig Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@ -2567,7 +2567,7 @@ test_evbuffer_freeze(void *ptr)
} else { \
tt_int_op((a), ==, (endcase)); \
} \
} while (/*CONSTCOND*/0)
} while (0)
orig_length = evbuffer_get_length(buf);

View File

@ -1,4 +1,4 @@
/* $NetBSD: regress_http.c,v 1.7 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: regress_http.c,v 1.8 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2003-2007 Niels Provos <provos@citi.umich.edu>
@ -36,7 +36,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: regress_http.c,v 1.7 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: regress_http.c,v 1.8 2021/04/10 19:02:37 rillig Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@ -2926,7 +2926,7 @@ http_uriencode_test(void *ptr)
free(s); \
free(s2); \
s = s2 = NULL; \
} while (/*CONSTCOND*/0)
} while (0)
#define DEC(from,want,dp) do { \
s = evhttp_uridecode((from),(dp),&sz); \
@ -2935,7 +2935,7 @@ http_uriencode_test(void *ptr)
tt_int_op(sz,==,strlen(want)); \
free(s); \
s = NULL; \
} while (/*CONSTCOND*/0)
} while (0)
#define OLD_DEC(from,want) do { \
s = evhttp_decode_uri((from)); \
@ -2943,7 +2943,7 @@ http_uriencode_test(void *ptr)
tt_str_op(s,==,(want)); \
free(s); \
s = NULL; \
} while (/*CONSTCOND*/0)
} while (0)
ENC("Hello", "Hello",0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: regress_util.c,v 1.4 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: regress_util.c,v 1.5 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2009-2012 Nick Mathewson and Niels Provos
@ -39,7 +39,7 @@
#include "event2/event-config.h"
#include <sys/cdefs.h>
__RCSID("$NetBSD: regress_util.c,v 1.4 2021/04/07 03:36:48 christos Exp $");
__RCSID("$NetBSD: regress_util.c,v 1.5 2021/04/10 19:02:37 rillig Exp $");
#include <sys/types.h>
@ -628,12 +628,12 @@ test_evutil_log(void *ptr)
logsev = 0; \
if (logmsg) free(logmsg); \
logmsg = NULL; \
} while (/*CONSTCOND*/0)
} while (0)
#define LOGEQ(sev,msg) do { \
tt_int_op(logsev,==,sev); \
tt_assert(logmsg != NULL); \
tt_str_op(logmsg,==,msg); \
} while (/*CONSTCOND*/0)
} while (0)
#ifdef CAN_CHECK_ERR
/* We need to disable these tests for now. Previously, the logging

View File

@ -1,4 +1,4 @@
/* $NetBSD: util-internal.h,v 1.5 2021/04/07 03:36:48 christos Exp $ */
/* $NetBSD: util-internal.h,v 1.6 2021/04/10 19:02:37 rillig Exp $ */
/*
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
@ -375,7 +375,7 @@ ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t
__FILE__,__LINE__,#cond,__func__); \
abort(); \
} \
} while (/*CONSTCOND*/0)
} while (0)
#define EVUTIL_FAILURE_CHECK(cond) EVUTIL_UNLIKELY(cond)
#endif