本文整理匯總了C++中EXTRA_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ EXTRA_ASSERT函數的具體用法?C++ EXTRA_ASSERT怎麽用?C++ EXTRA_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EXTRA_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: _client_connect
static GError*
_client_connect(struct gridd_client_s *client)
{
GError *err = NULL;
client->fd = _connect(client->url, &err);
if (client->fd < 0) {
EXTRA_ASSERT(err != NULL);
g_prefix_error(&err, "Connect error: ");
return err;
}
EXTRA_ASSERT(err == NULL);
g_get_current_time(&(client->tv_step));
client->step = CONNECTING;
return NULL;
}
示例2: sqlx_name_dup
void
sqlx_name_dup (struct sqlx_name_mutable_s *dst, const struct sqlx_name_s *src)
{
EXTRA_ASSERT(dst != NULL && src != NULL);
oio_str_replace (&dst->ns, src->ns);
oio_str_replace (&dst->base, src->base);
oio_str_replace (&dst->type, src->type);
}
示例3: sqlx_cache_set_close_hook
sqlx_cache_t *
sqlx_cache_set_close_hook(sqlx_cache_t *cache,
sqlx_cache_close_hook hook)
{
EXTRA_ASSERT(cache != NULL);
cache->close_hook = hook;
return cache;
}
示例4: hc_resolver_flush_services
void
hc_resolver_flush_services(struct hc_resolver_s *r)
{
EXTRA_ASSERT(r != NULL);
g_mutex_lock(&r->lock);
_lru_flush(r->services.cache);
g_mutex_unlock(&r->lock);
}
示例5: _m0_remote_m0info
static GError *
_m0_remote_m0info (const char *m0, GByteArray *req, GSList **out)
{
EXTRA_ASSERT (m0 != NULL);
EXTRA_ASSERT (out != NULL);
GSList *result = NULL;
GError *e = gridd_client_exec_and_decode (m0, M0V2_CLIENT_TIMEOUT,
req, &result, meta0_info_unmarshall);
if (!e) {
*out = result;
return NULL;
} else {
g_slist_free_full (result, (GDestroyNotify)meta0_info_clean);
*out = NULL;
return e;
}
}
示例6: hc_resolver_set_now
void
hc_resolver_set_now(struct hc_resolver_s *r, time_t now)
{
EXTRA_ASSERT(r != NULL);
g_mutex_lock(&r->lock);
r->bogonow = now;
g_mutex_unlock(&r->lock);
}
示例7: hc_resolver_flush_csm0
void
hc_resolver_flush_csm0(struct hc_resolver_s *r)
{
EXTRA_ASSERT(r != NULL);
g_mutex_lock(&r->lock);
_lru_flush(r->csm0.cache);
g_mutex_unlock(&r->lock);
}
示例8: meta2_backend_init
GError *
meta2_backend_init(struct meta2_backend_s **result,
struct sqlx_repository_s *repo, const gchar *ns,
struct grid_lbpool_s *glp, struct hc_resolver_s *resolver)
{
GError *err = NULL;
struct meta2_backend_s *m2 = NULL;
gsize s;
EXTRA_ASSERT(result != NULL);
EXTRA_ASSERT(glp != NULL);
EXTRA_ASSERT(repo != NULL);
EXTRA_ASSERT(resolver != NULL);
m2 = g_malloc0(sizeof(struct meta2_backend_s));
s = metautils_strlcpy_physical_ns(m2->backend.ns_name, ns,
sizeof(m2->backend.ns_name));
if (sizeof(m2->backend.ns_name) <= s) {
g_free(m2);
return NEWERROR(CODE_BAD_REQUEST, "Namespace too long");
}
m2->backend.type = NAME_SRVTYPE_META2;
m2->backend.repo = repo;
m2->backend.lb = glp;
m2->policies = service_update_policies_create();
g_mutex_init(&m2->nsinfo_lock);
m2->flag_precheck_on_generate = TRUE;
err = sqlx_repository_configure_type(m2->backend.repo,
NAME_SRVTYPE_META2, schema);
if (NULL != err) {
meta2_backend_clean(m2);
g_prefix_error(&err, "Backend init error: ");
return err;
}
m2->resolver = resolver;
GRID_DEBUG("M2V2 backend created for NS[%s] and repo[%p]",
m2->backend.ns_name, m2->backend.repo);
*result = m2;
return NULL;
}
示例9: sqlx_pack_QUERY_single
GByteArray*
sqlx_pack_QUERY_single(const struct sqlx_name_s *name, const gchar *query,
gboolean autocreate)
{
EXTRA_ASSERT(name != NULL);
EXTRA_ASSERT(query != NULL);
struct Table *t = calloc(1, sizeof(Table_t));
OCTET_STRING_fromBuf(&(t->name), query, strlen(query));
struct TableSequence *ts = calloc(1, sizeof(TableSequence_t));
asn_sequence_add(&(ts->list), t);
GByteArray *req = sqlx_pack_QUERY(name, query, ts, autocreate);
asn_DEF_TableSequence.free_struct(&asn_DEF_TableSequence, ts, FALSE);
return req;
}
示例10: _load_from_file_attr
static gboolean
_load_from_file_attr(struct attr_handle_s *attr_handle, GError ** error)
{
FILE *stream;
struct stat chunk_stats;
char lineBuf[8192];
EXTRA_ASSERT(attr_handle != NULL);
EXTRA_ASSERT(attr_handle->attr_hash != NULL);
/* stat the file */
if (0 > stat(attr_handle->attr_path, &chunk_stats)) {
SETERRCODE(error, errno, "Attr file [%s] not found for chunk", attr_handle->attr_path);
return FALSE;
}
stream = fopen(attr_handle->attr_path, "r");
if (!stream) {
SETERRCODE(error, errno, "Failed to open stream to file [%s] : %s)",
attr_handle->attr_path, strerror(errno));
return FALSE;
}
while (fgets(lineBuf, sizeof(lineBuf), stream)) {
/* Remove trailing \n */
int line_len = strlen(lineBuf);
if (lineBuf[line_len-1] == '\n')
lineBuf[line_len-1] = '\0';
char **tokens = g_strsplit(lineBuf, ":", 2);
if (tokens) {
if (*tokens && *(tokens + 1)) {
g_hash_table_insert(attr_handle->attr_hash, *tokens, *(tokens + 1));
g_free(tokens);
}
else
g_strfreev(tokens);
}
}
fclose(stream);
return TRUE;
}
示例11: meta2_backend_initiated
gboolean
meta2_backend_initiated(struct meta2_backend_s *m2)
{
EXTRA_ASSERT(m2 != NULL);
g_mutex_lock (&m2->nsinfo_lock);
gboolean rc = (NULL != m2->nsinfo);
g_mutex_unlock (&m2->nsinfo_lock);
return rc;
}
示例12: oio_events_queue_factory__create_zmq
GError *
oio_events_queue_factory__create_zmq (const char *zurl,
struct oio_events_queue_s **out)
{
EXTRA_ASSERT (zurl != NULL);
EXTRA_ASSERT (out != NULL);
struct _queue_AGENT_s *self = g_malloc0 (sizeof(*self));
self->vtable = &vtable_AGENT;
self->queue = g_async_queue_new ();
self->url = g_strdup (zurl);
self->max_recv_per_round = 32;
self->max_events_in_queue = OIO_EVTQ_MAXPENDING;
self->procid = getpid();
*out = (struct oio_events_queue_s *) self;
return NULL;
}
示例13: _pool_unmonitor
static void
_pool_unmonitor(struct gridd_client_pool_s *pool, int fd)
{
if (pool->fdmon >= 0)
(void) epoll_ctl(pool->fdmon, EPOLL_CTL_DEL, fd, NULL);
EXTRA_ASSERT(pool->active_count > 0);
-- pool->active_count;
pool->active_clients[fd] = NULL;
}
示例14: meta2_backend_configure_nsinfo
void
meta2_backend_configure_nsinfo(struct meta2_backend_s *m2,
struct namespace_info_s *ni)
{
EXTRA_ASSERT(m2 != NULL);
EXTRA_ASSERT(ni != NULL);
struct namespace_info_s *old = NULL, *copy = NULL;
copy = namespace_info_dup (ni);
g_mutex_lock(&m2->nsinfo_lock);
old = m2->nsinfo;
m2->nsinfo = copy;
g_mutex_unlock(&m2->nsinfo_lock);
if (old)
namespace_info_free (old);
}
示例15: network_server_run
GError *
network_server_run(struct network_server_s *srv)
{
struct endpoint_s **pu, *u;
time_t now, last_update;
GError *err = NULL;
/* Sanity checks */
EXTRA_ASSERT(srv != NULL);
for (pu=srv->endpointv; (u = *pu) ;pu++) {
if (u->fd < 0)
return NEWERROR(EINVAL,
"DESIGN ERROR : some servers are not open");
}
if (!srv->flag_continue)
return NULL;
for (pu=srv->endpointv; srv->flag_continue && (u = *pu) ;pu++)
ARM_ENDPOINT(srv, u, EPOLL_CTL_ADD);
ARM_WAKER(srv, EPOLL_CTL_ADD);
_server_start_one_worker(srv, FALSE);
srv->thread_events = g_thread_new("events", _thread_cb_events, srv);
clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
last_update = network_server_bogonow(srv);
while (srv->flag_continue) {
now = network_server_bogonow(srv);
if (last_update < now) {
_server_update_main_stats(srv);
last_update = now;
}
usleep(_start_necessary_threads(srv) ? 50000 : 500000);
clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
}
network_server_close_servers(srv);
/* Wait for all the workers */
while (srv->workers_total) {
GRID_DEBUG("Waiting for %u workers to die", srv->workers_total);
usleep(200000);
clock_gettime(CLOCK_MONOTONIC_COARSE, &srv->now);
}
srv->thread_first_worker = NULL;
/* wait for the first event thread */
if (srv->thread_events) {
g_thread_join(srv->thread_events);
srv->thread_events = NULL;
}
ARM_WAKER(srv, EPOLL_CTL_DEL);
GRID_DEBUG("Server %p exiting its main loop", srv);
return err;
}