msgbuf: s_assert is not a substitute for proper code
(dns, m_alias, m_stats updated as msgbuf no longer includes s_assert.h)
This commit is contained in:
parent
d2b3a2a474
commit
169a1c3535
4 changed files with 25 additions and 14 deletions
|
@ -19,8 +19,6 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "s_assert.h"
|
|
||||||
|
|
||||||
#ifndef CHARYBDIS__MSGBUF_H
|
#ifndef CHARYBDIS__MSGBUF_H
|
||||||
#define CHARYBDIS__MSGBUF_H
|
#define CHARYBDIS__MSGBUF_H
|
||||||
|
|
||||||
|
@ -80,21 +78,21 @@ msgbuf_init(struct MsgBuf *msgbuf)
|
||||||
static inline void
|
static inline void
|
||||||
msgbuf_append_tag(struct MsgBuf *msgbuf, const char *key, const char *value, unsigned int capmask)
|
msgbuf_append_tag(struct MsgBuf *msgbuf, const char *key, const char *value, unsigned int capmask)
|
||||||
{
|
{
|
||||||
s_assert(msgbuf->n_tags < MAXPARA);
|
if (msgbuf->n_tags < MAXPARA) {
|
||||||
|
msgbuf->tags[msgbuf->n_tags].key = key;
|
||||||
msgbuf->tags[msgbuf->n_tags].key = key;
|
msgbuf->tags[msgbuf->n_tags].value = value;
|
||||||
msgbuf->tags[msgbuf->n_tags].value = value;
|
msgbuf->tags[msgbuf->n_tags].capmask = capmask;
|
||||||
msgbuf->tags[msgbuf->n_tags].capmask = capmask;
|
msgbuf->n_tags++;
|
||||||
msgbuf->n_tags++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
msgbuf_append_para(struct MsgBuf *msgbuf, const char *para)
|
msgbuf_append_para(struct MsgBuf *msgbuf, const char *para)
|
||||||
{
|
{
|
||||||
s_assert(msgbuf->n_para < MAXPARA);
|
if (msgbuf->n_para < MAXPARA) {
|
||||||
|
msgbuf->para[msgbuf->n_para] = para;
|
||||||
msgbuf->para[msgbuf->n_para] = para;
|
msgbuf->n_para++;
|
||||||
msgbuf->n_para++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
15
ircd/dns.c
15
ircd/dns.c
|
@ -36,6 +36,7 @@
|
||||||
#include "numeric.h"
|
#include "numeric.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
#include "s_assert.h"
|
||||||
|
|
||||||
#define DNS_HOST_IPV4 ((char)'4')
|
#define DNS_HOST_IPV4 ((char)'4')
|
||||||
#define DNS_HOST_IPV6 ((char)'6')
|
#define DNS_HOST_IPV6 ((char)'6')
|
||||||
|
@ -82,7 +83,7 @@ handle_dns_failure(uint32_t xid)
|
||||||
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
|
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
|
||||||
s_assert(req);
|
s_assert(req);
|
||||||
|
|
||||||
if(req->callback == NULL)
|
if(req == NULL || req->callback == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
req->callback("FAILED", 0, 0, req->data);
|
req->callback("FAILED", 0, 0, req->data);
|
||||||
|
@ -96,7 +97,7 @@ handle_dns_stat_failure(uint32_t xid)
|
||||||
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
|
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
|
||||||
s_assert(req);
|
s_assert(req);
|
||||||
|
|
||||||
if(req->callback == NULL)
|
if(req == NULL || req->callback == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
req->callback(1, NULL, 2, req->data);
|
req->callback(1, NULL, 2, req->data);
|
||||||
|
@ -110,6 +111,10 @@ cancel_lookup(uint32_t xid)
|
||||||
{
|
{
|
||||||
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
|
struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid));
|
||||||
s_assert(req);
|
s_assert(req);
|
||||||
|
|
||||||
|
if (req == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
req->callback = NULL;
|
req->callback = NULL;
|
||||||
req->data = NULL;
|
req->data = NULL;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +124,10 @@ cancel_dns_stats(uint32_t xid)
|
||||||
{
|
{
|
||||||
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
|
struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid));
|
||||||
s_assert(req);
|
s_assert(req);
|
||||||
|
|
||||||
|
if (req == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
req->callback = NULL;
|
req->callback = NULL;
|
||||||
req->data = NULL;
|
req->data = NULL;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +254,8 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con
|
||||||
req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid));
|
req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid));
|
||||||
|
|
||||||
s_assert(req);
|
s_assert(req);
|
||||||
|
if (req == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if(req->callback == NULL)
|
if(req->callback == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "numeric.h"
|
#include "numeric.h"
|
||||||
#include "send.h"
|
#include "send.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
#include "s_assert.h"
|
||||||
|
|
||||||
static const char alias_desc[] = "Provides the system for services aliases";
|
static const char alias_desc[] = "Provides the system for services aliases";
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "whowas.h"
|
#include "whowas.h"
|
||||||
#include "rb_radixtree.h"
|
#include "rb_radixtree.h"
|
||||||
#include "sslproc.h"
|
#include "sslproc.h"
|
||||||
|
#include "s_assert.h"
|
||||||
|
|
||||||
static const char stats_desc[] =
|
static const char stats_desc[] =
|
||||||
"Provides the STATS command to inspect various server/network information";
|
"Provides the STATS command to inspect various server/network information";
|
||||||
|
|
Loading…
Reference in a new issue