本文整理汇总了C++中s_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ s_assert函数的具体用法?C++ s_assert怎么用?C++ s_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了s_assert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: comm_setselect
/*
* comm_setselect
*
* This is a needed exported function which will be called to register
* and deregister interest in a pending IO state for a given FD.
*/
void
comm_setselect(int fd, fdlist_t list, unsigned int type, PF * handler,
void *client_data, time_t timeout)
{
fde_t *F = &fd_table[fd];
s_assert(fd >= 0);
s_assert(F->flags.open);
if(type & COMM_SELECT_READ)
{
F->read_handler = handler;
F->read_data = client_data;
poll_update_pollfds(fd, POLLRDNORM, handler);
}
if(type & COMM_SELECT_WRITE)
{
F->write_handler = handler;
F->write_data = client_data;
poll_update_pollfds(fd, POLLWRNORM, handler);
}
if(timeout)
F->timeout = CurrentTime + (timeout / 1000);
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:29,代码来源:s_bsd_poll.c
示例2: comm_setselect
/*
* comm_setselect
*
* This is a needed exported function which will be called to register
* and deregister interest in a pending IO state for a given FD.
*/
void
comm_setselect(int fd, fdlist_t list, unsigned int type, PF * handler,
void *client_data)
{
fde_t *F = &fd_table[fd];
s_assert(fd >= 0);
s_assert(F->flags.open);
/* Update the list, even though we're not using it .. */
F->list = list;
if(type & COMM_SELECT_READ)
{
kq_update_events(F, EVFILT_READ, handler);
F->read_handler = handler;
F->read_data = client_data;
}
if(type & COMM_SELECT_WRITE)
{
kq_update_events(F, EVFILT_WRITE, handler);
F->write_handler = handler;
F->write_data = client_data;
}
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:30,代码来源:kqueue.c
示例3: mod_add_cmd
/* mod_add_cmd
*
* inputs - command name
* - pointer to struct Message
* output - none
* side effects - load this one command name
* msg->count msg->bytes is modified in place, in
* modules address space. Might not want to do that...
*/
void
mod_add_cmd(struct Message *msg)
{
s_assert(msg != NULL);
if(msg == NULL)
return;
if(hash_find(HASH_COMMAND, msg->cmd) != NULL)
return;
hash_add(HASH_COMMAND, msg->cmd, msg);
msg->count = 0;
msg->rcount = 0;
msg->bytes = 0;
}
开发者ID:thors,项目名称:ircd-ratbox,代码行数:24,代码来源:parse.c
示例4: mr_starttls
static int
mr_starttls(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
#ifdef HAVE_LIBCRYPTO
ssl_ctl_t *ctl;
rb_fde_t *F[2];
if (!MyConnect(client_p))
return 0;
if (!ssl_ok || !get_ssld_count())
{
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
return 1;
}
if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1)
{
ilog_error("error creating SSL/TLS socketpair for ssld slave");
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave");
return 1;
}
s_assert(client_p->localClient != NULL);
/* clear out any remaining plaintext lines */
rb_linebuf_donebuf(&client_p->localClient->buf_recvq);
sendto_one_numeric(client_p, RPL_STARTTLS, form_str(RPL_STARTTLS));
send_queued(client_p);
ctl = start_ssld_accept(client_p->localClient->F, F[1], rb_get_fd(F[0]));
if (ctl != NULL)
{
del_from_cli_fd_hash(client_p);
client_p->localClient->F = F[0];
add_to_cli_fd_hash(client_p);
client_p->localClient->ssl_ctl = ctl;
SetSSL(client_p);
}
else
return 1;
#else
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured");
#endif
return 0;
}
开发者ID:AbstractBeliefs,项目名称:charybdis,代码行数:48,代码来源:m_starttls.c
示例5: poll_findslot
/*
* find a spare slot in the fd list. We can optimise this out later!
* -- adrian
*/
static inline int
poll_findslot(void)
{
int i;
for (i = 0; i < MAXCONNECTIONS; i++)
{
if(pollfd_list.pollfds[i].fd == -1)
{
/* MATCH!!#$*&$ */
return i;
}
}
s_assert(1 == 0);
/* NOTREACHED */
return -1;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:20,代码来源:poll.c
示例6: clean_user_name
/* clean_user_name()
*
* input - username
* output - none
* side effects - walks through the username, returning 0 if erroneous
*/
static int
clean_user_name(char *user)
{
s_assert(user);
if(user == NULL)
return 0;
for (; *user; user++)
{
if(!IsUserChar(*user))
return 0;
}
return 1;
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:22,代码来源:m_nick.c
示例7: mod_add_cmd
/* mod_add_cmd
*
* inputs - command name
* - pointer to struct Message
* output - none
* side effects - load this one command name
* msg->count msg->bytes is modified in place, in
* modules address space. Might not want to do that...
*/
void
mod_add_cmd(struct Message *msg)
{
s_assert(msg != NULL);
if(msg == NULL)
return;
if (rb_dictionary_find(cmd_dict, msg->cmd) != NULL)
return;
msg->count = 0;
msg->rcount = 0;
msg->bytes = 0;
rb_dictionary_add(cmd_dict, msg->cmd, msg);
}
开发者ID:kleopatra999,项目名称:charybdis,代码行数:25,代码来源:parse.c
示例8: add_history
void
add_history(struct Client *client_p, int online)
{
struct Whowas *who = &WHOWAS[whowas_next];
s_assert(NULL != client_p);
if(client_p == NULL)
return;
if(who->hashv != -1)
{
if(who->online)
del_whowas_from_clist(&(who->online->whowas), who);
del_whowas_from_list(&WHOWASHASH[who->hashv], who);
}
who->hashv = hash_whowas_name(client_p->name);
who->logoff = rb_current_time();
/*
* NOTE: strcpy ok here, the sizes in the client struct MUST
* match the sizes in the whowas struct
*/
rb_strlcpy(who->name, client_p->name, sizeof(who->name));
strcpy(who->username, client_p->username);
strcpy(who->hostname, client_p->host);
strcpy(who->realname, client_p->info);
strcpy(who->suser, client_p->user->suser);
if(!EmptyString(client_p->sockhost) && strcmp(client_p->sockhost, "0")
&& show_ip(NULL, client_p))
strcpy(who->sockhost, client_p->sockhost);
else
who->sockhost[0] = '\0';
who->servername = scache_get_name(client_p->servptr->serv->nameinfo);
if(online)
{
who->online = client_p;
add_whowas_to_clist(&(client_p->whowas), who);
}
else
who->online = NULL;
add_whowas_to_list(&WHOWASHASH[who->hashv], who);
whowas_next++;
if(whowas_next == NICKNAMEHISTORYLENGTH)
whowas_next = 0;
}
开发者ID:alyx,项目名称:sporksircd,代码行数:47,代码来源:whowas.c
示例9: close_listener
/*
* close_listener - close a single listener
*/
void
close_listener(struct Listener *listener)
{
s_assert(listener != NULL);
if(listener == NULL)
return;
if(listener->F != NULL) {
rb_close(listener->F);
listener->F = NULL;
}
listener->active = 0;
if(listener->ref_count)
return;
free_listener(listener);
}
开发者ID:dequis,项目名称:elemental-ircd,代码行数:21,代码来源:listener.c
示例10: fbgetc
int
fbgetc(FBFILE * fb)
{
s_assert(fb);
if(fb == NULL)
{
errno = EINVAL;
return -1;
}
if(fb->pbptr)
{
if((fb->pbptr == (fb->pbuf + BUFSIZ)) || (!*fb->pbptr))
fb->pbptr = NULL;
}
if(fb->ptr < fb->endp || fbfill(fb) > 0)
return *fb->ptr++;
return EOF;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:19,代码来源:commio.c
示例11: s_assert
void Graphics::Initialize(const GraphicsConfig &config)
{
s_assert(!Available());
mConfig = config;
switch (mConfig.Type)
{
case GraphicsType::OPENGL3:
mCanvas = new OpenGLCanvas;
mRenderer = new OpenGLRenderer;
mResourceManager = new OpenGLGraphicsResourceManager;
break;
default:
GetLog().Error("[Graphics::Initialize] unsupport GraphicsType!\n");
break;
}
mRenderer->Initialize(mConfig);
mCanvas->Initialize();
mResourceManager->Initialize(mConfig);
}
开发者ID:leafnsand,项目名称:SamEngine,代码行数:19,代码来源:Graphics.cpp
示例12: clean_nick_name
/* clean_nick_name()
*
* input - nickname
* output - none
* side effects - walks through the nickname, returning 0 if erroneous
*/
static int
clean_nick_name(char *nick)
{
s_assert(nick);
if(nick == NULL)
return 0;
/* nicks cant start with a digit or -, and must have a length */
if(*nick == '-' || IsDigit(*nick) || !*nick)
return 0;
for (; *nick; nick++)
{
if(!IsNickChar(*nick))
return 0;
}
return 1;
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:25,代码来源:m_nick.c
示例13: close_listener
/*
* close_listener - close a single listener
*/
void
close_listener(struct Listener *listener)
{
s_assert(listener != NULL);
if(listener == NULL)
return;
if(listener->fd >= 0)
{
comm_close(listener->fd);
listener->fd = -1;
}
listener->active = 0;
if(listener->ref_count)
return;
free_listener(listener);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:22,代码来源:listener.c
示例14: fbungetc
void
fbungetc(char c, FBFILE * fb)
{
s_assert(fb);
if(fb == NULL)
{
errno = EINVAL;
return;
}
if(!fb->pbptr)
{
fb->pbptr = fb->pbuf + BUFSIZ;
}
if(fb->pbptr != fb->pbuf)
{
fb->pbptr--;
*fb->pbptr = c;
}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:20,代码来源:commio.c
示例15: get_listener_name
/*
* get_listener_name - return displayable listener name and port
* returns "host.foo.org:6667" for a given listener
*/
const char *
get_listener_name(const struct Listener *listener)
{
static char buf[HOSTLEN + HOSTLEN + PORTNAMELEN + 4];
int port = 0;
s_assert(NULL != listener);
if(listener == NULL)
return NULL;
#ifdef RB_IPV6
if(listener->addr.ss_family == AF_INET6)
port = ntohs(((const struct sockaddr_in6 *)&listener->addr)->sin6_port);
else
#endif
port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port);
rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
return buf;
}
开发者ID:Macs,项目名称:NeoIRCd,代码行数:24,代码来源:listener.c
示例16: add_connection
/*
* add_connection - creates a client which has just connected to us on
* the given fd. The sockhost field is initialized with the ip# of the host.
* The client is sent to the auth module for verification, and not put in
* any client list yet.
*/
static void
add_connection(struct Listener *listener, int fd, struct sockaddr *sai)
{
struct Client *new_client;
s_assert(NULL != listener);
/*
* get the client socket name from the socket
* the client has already been checked out in accept_connection
*/
new_client = make_client(NULL);
memcpy(&new_client->localClient->ip, sai, sizeof(struct irc_sockaddr_storage));
/*
* copy address to 'sockhost' as a string, copy it to host too
* so we have something valid to put into error messages...
*/
inetntop_sock((struct sockaddr *) &new_client->localClient->ip, new_client->sockhost,
sizeof(new_client->sockhost));
strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host));
#ifdef IPV6
if(new_client->localClient->ip.ss_family == AF_INET6
&& ConfigFileEntry.dot_in_ip6_addr == 1)
{
strlcat(new_client->host, ".", sizeof(new_client->host));
}
#endif
new_client->localClient->fd = fd;
new_client->localClient->listener = listener;
++listener->ref_count;
if(check_reject(new_client))
return;
start_auth(new_client);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:47,代码来源:listener.c
示例17: add_history
void
add_history(struct Client *client_p, int online)
{
struct Whowas *who = &WHOWAS[whowas_next];
s_assert(NULL != client_p);
if(client_p == NULL)
return;
if(who->hashv != -1)
{
if(who->online)
del_whowas_from_clist(&(who->online->whowas), who);
del_whowas_from_list(&WHOWASHASH[who->hashv], who);
}
who->hashv = hash_whowas_name(client_p->name);
who->logoff = CurrentTime;
/*
* NOTE: strcpy ok here, the sizes in the client struct MUST
* match the sizes in the whowas struct
*/
strlcpy(who->name, client_p->name, sizeof(who->name));
strcpy(who->username, client_p->username);
strcpy(who->hostname, client_p->host);
strcpy(who->realname, client_p->info);
who->servername = client_p->user->server;
if(online)
{
who->online = client_p;
add_whowas_to_clist(&(client_p->whowas), who);
}
else
who->online = NULL;
add_whowas_to_list(&WHOWASHASH[who->hashv], who);
whowas_next++;
if(whowas_next == NICKNAMEHISTORYLENGTH)
whowas_next = 0;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:41,代码来源:whowas.c
示例18: add_history
void
add_history(struct Client *client_p, int online)
{
struct Whowas *who = &WHOWAS[whowas_next];
s_assert(NULL != client_p);
if (client_p == NULL)
return;
if (who->hashv != -1)
{
if (who->online)
del_whowas_from_clist(&(who->online->whowas), who);
del_whowas_from_list(&WHOWASHASH[who->hashv], who);
}
who->hashv = hash_whowas_name(client_p->name);
who->logoff = rb_current_time();
strcpy(who->name, client_p->name);
strcpy(who->username, client_p->username);
strcpy(who->hostname, client_p->host);
strcpy(who->virthost, client_p->virthost);
strcpy(who->realname, client_p->info);
who->cloak = IsCloaked(client_p);
who->servername = client_p->servptr->name;
if (online)
{
who->online = client_p;
add_whowas_to_clist(&(client_p->whowas), who);
}
else
who->online = NULL;
add_whowas_to_list(&WHOWASHASH[who->hashv], who);
whowas_next++;
if (whowas_next == NICKNAMEHISTORYLENGTH)
whowas_next = 0;
}
开发者ID:azzurra,项目名称:bluebox,代码行数:41,代码来源:whowas.c
示例19: find_or_add
const char *
find_or_add(const char *name)
{
int hash_index;
SCACHE *ptr;
ptr = scache_hash[hash_index = hash(name)];
for (; ptr; ptr = ptr->next)
{
if(!irccmp(ptr->name, name))
return (ptr->name);
}
ptr = (SCACHE *) MyMalloc(sizeof(SCACHE));
s_assert(0 != ptr);
strlcpy(ptr->name, name, sizeof(ptr->name));
ptr->next = scache_hash[hash_index];
scache_hash[hash_index] = ptr;
return ptr->name;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:22,代码来源:scache.c
示例20: linebuf_skip_crlf
/*
* skip to end of line or the crlfs, return the number of bytes ..
*/
static inline int
linebuf_skip_crlf(char *ch, int len)
{
int orig_len = len;
/* First, skip until the first non-CRLF */
for (; len; len--, ch++)
{
if(*ch == '\r')
break;
else if(*ch == '\n')
break;
}
/* Then, skip until the last CRLF */
for (; len; len--, ch++)
{
if((*ch != '\r') && (*ch != '\n'))
break;
}
s_assert(orig_len > len);
return (orig_len - len);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:26,代码来源:linebuf.c
注:本文中的s_assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论