本文整理汇总了C++中ISNULL函数的典型用法代码示例。如果您正苦于以下问题:C++ ISNULL函数的具体用法?C++ ISNULL怎么用?C++ ISNULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISNULL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rdbi_col_actW
int rdbi_col_actW(
rdbi_context_def *context,
const wchar_t *owner,
const wchar_t *object_name,
const wchar_t *dbaselink
)
{
int status;
int tran_begun = FALSE;
debug_on2("rdbi_col_actW", "owner='%ls', object='%ls'", ISNULL(owner), ISNULL(object_name));
if (context->rdbi_cnct->autocommit_on) {
rdbi_tran_begin(context, tran_id);
tran_begun = TRUE;
}
status = (*(context->dispatch.col_actW))(context->drvr, owner, object_name, dbaselink);
context->rdbi_last_status = status;
/* ingdr_col_act prefetches all columns so its safe to end the transaction
* here without getting fetch across commit problems.
*/
if ( tran_begun ) {
rdbi_tran_end(context, tran_id);
}
debug_return(NULL, status);
}
示例2: get_refresh
char * get_refresh( char * line )
{
char * ret = NULL;
char * ptr = NULL;
char * tmp = NULL;
if ( ISNULL(line) )
return NULL;
if ( (tmp = ptr = xstrdup(line)) && (ptr = xstrstr( ptr, REFRESH )) )
{
if ( (ptr = xstrstr( ptr, URLTAG )) )
{
if ( (ptr += strlen(URLTAG)) )
{
NEXTFIELD( ptr );
if ( ptr ) TRUNC( ptr, "\"' >\r\n");
if ( !ISNULL(ptr) ) ret = xstrdup( ptr );
}
}
xfree( tmp );
}
return( ret );
}
示例3: rdbi_col_getW
int rdbi_col_getW(
rdbi_context_def *context,
wchar_t *column_name,
wchar_t *type,
int *length,
int *scale,
int *nullable,
int *is_autoincrement,
int *position,
int *eof)
{
int status;
debug_on("rdbi_col_getW");
status = (*(context->dispatch.col_getW))(context->drvr, column_name, type, length, scale, nullable, is_autoincrement,
position, eof);
context->rdbi_last_status = status;
debug_area()
{
if (*eof)
{
debug0("eof=TRUE");
}
else
{
debug6("column='%ls', type='%ls', length=%d, scale=%d, nullable=%s, position=%d",
ISNULL(column_name), ISNULL(type), *length, *scale, ISTRUE(*nullable), *position);
}
}
debug_return(NULL, status);
}
示例4: bst_help_marked
void bst_help_marked(node_t* pred, operation_t* pred_op, node_t* curr/*, node_t* root*/){
//fprintf(stderr, "bst help marked\n");
node_t* new_ref;
if (ISNULL(curr->left)) {
if (ISNULL(curr->right)) {
new_ref = (node_t*)SETNULL(curr);
} else {
new_ref = curr->right;
}
} else {
new_ref = curr->left;
}
// allocate memory
// operation_t* cas_op = new child_cas_op(curr==pred->left, curr, new_ref);
operation_t* cas_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t));
cas_op->child_cas_op.is_left = (curr == pred->left);
cas_op->child_cas_op.expected = curr;
cas_op->child_cas_op.update = new_ref;
// fprintf(stderr, "cas_op address: %p, is_left address: %p, expected addr: %p, update addr: %p\n", (unsigned long)cas_op, &(cas_op->child_cas_op.is_left), &(cas_op->child_cas_op.expected), &(cas_op->child_cas_op.update)
// );
if (CAS_PTR(&(pred->op), pred_op, FLAG(cas_op, STATE_OP_CHILDCAS)) == pred_op) {
bst_help_child_cas(cas_op, pred/*, root*/);
}
}
示例5: contact_update
/**
* @brief Update a user contact entry in the database.
* @param contactnum the numerical id of the contact entry to be modified.
* @param usernum the numerical id of the user to whom the specified contact entry belongs.
* @param cur_folder the numerical id of the parent contact containing the specified contact entry.
* @param target_folder if not 0, sets the new parent contact folder to which the specified contact entry will belong.
* @param name if not NULL, sets the new name of the specified contact entry.
* @return -1 on error, 0 if the specified contact entry was not found in the database, or 1 if the contact entry was successfully updated.
*/
int_t contact_update(uint64_t contactnum, uint64_t usernum, uint64_t cur_folder, uint64_t target_folder, stringer_t *name) {
int64_t affected;
MYSQL_BIND parameters[5];
mm_wipe(parameters, sizeof(parameters));
// Destination Folder
if (target_folder) {
parameters[0].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[0].buffer_length = sizeof(uint64_t);
parameters[0].buffer = &target_folder;
parameters[0].is_unsigned = true;
}
else {
parameters[0].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[0].is_null = ISNULL(true);
}
// Name
if (!st_empty(name)) {
parameters[1].buffer_type = MYSQL_TYPE_STRING;
parameters[1].buffer_length = st_length_get(name);
parameters[1].buffer = st_char_get(name);
}
else {
parameters[1].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[1].is_null = ISNULL(true);
}
// Contact Number
parameters[2].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[2].buffer_length = sizeof(uint64_t);
parameters[2].buffer = &contactnum;
parameters[2].is_unsigned = true;
// User Number
parameters[3].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[3].buffer_length = sizeof(uint64_t);
parameters[3].buffer = &usernum;
parameters[3].is_unsigned = true;
// Current Folder
parameters[4].buffer_type = MYSQL_TYPE_LONGLONG;
parameters[4].buffer_length = sizeof(uint64_t);
parameters[4].buffer = &cur_folder;
parameters[4].is_unsigned = true;
// Since the updated column is always updated this function should only return 0 if the query doesn't match any rows, otherwise 1 to indicate success.
if ((affected = stmt_exec_affected(stmts.update_contact, parameters)) == -1) {
log_pedantic("The contact entry update triggered an error. { usernum = %lu / foldernum = %lu / contact = %lu }", usernum, cur_folder, contactnum);
return -1;
}
log_check(affected > 2);
return (int_t)affected;
}
示例6: bst_remove
bool_t bst_remove(bst_key_t k, node_t* root, int id){
//fprintf(stderr, "bst remove\n");
// node_t* pred;
// node_t* curr;
node_t* replace = NULL;
// operation_t* pred_op;
// operation_t* curr_op;
operation_t* replace_op = NULL;
operation_t* reloc_op = NULL;
bst_search_result_t* my_result;
while(TRUE) {
//root is now a global pointer to a node, not a node
my_result = bst_find(k, /*&pred, &pred_op, &curr, &curr_op,*/ root, root, id);
if (my_result->result != FOUND) {
return FALSE;
}
if (ISNULL(my_result->curr->right) || ISNULL(my_result->curr->left)) { // node has less than two children
if (CAS_PTR(&(my_result->curr->op), my_result->curr_op, FLAG(my_result->curr_op, STATE_OP_MARK)) == my_result->curr_op) {
bst_help_marked(my_result->pred, my_result->pred_op, my_result->curr/*, root*/);
return TRUE;
}
} else { // node has two children
node_t* curr = my_result->curr;
my_search_result[id]->pred = my_result->pred;
my_search_result[id]->pred_op = my_result->pred_op;
my_search_result[id]->curr = replace;
my_search_result[id]->curr_op = replace_op;
// my_result = bst_find(k, &pred, &pred_op, &replace, &replace_op, curr, root, id);
my_result = bst_find(k, curr, root, id);
if ((my_result->result == ABORT) || (my_result->curr->op != my_result->curr_op)) {
continue;
}
//allocate memory
//reloc_op = new RelocateOP(curr, curr_op, k, replace->key);
reloc_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t));
reloc_op->relocate_op.state = STATE_OP_ONGOING;
reloc_op->relocate_op.dest = my_result->curr;
reloc_op->relocate_op.dest_op = my_result->curr_op;
reloc_op->relocate_op.remove_key = k;
reloc_op->relocate_op.replace_key = replace->key;
// fprintf(stderr, "reloc_op address: %p, state address: %p, dest addr: %p, dest_op addr: %p, remove_key addr: %p, replace_key addr: %p \n", (unsigned long)reloc_op, &(reloc_op->relocate_op.state), &(reloc_op->relocate_op.dest), &(reloc_op->relocate_op.dest_op), &(reloc_op->relocate_op.remove_key), &(reloc_op->relocate_op.replace_key)
// );
if (CAS_PTR(&(replace->op), replace_op, FLAG(reloc_op, STATE_OP_RELOCATE)) == replace_op) {
if (bst_help_relocate(reloc_op, my_result->pred, my_result->pred_op, replace/*, root*/)) {
return TRUE;
}
}
}
}
}
示例7: hfsQueueItem
HFS_STATUS
hfsQueueItem(PHFS_QUEUE_PROCESSOR pQueueProcessor,
PHFS_QUEUE_ITEM pQueueItem)
{
HFS_STATUS ret=HFS_STATUS_SUCCESS;
HFS_ENTRY(hfsQueueItem);
if (ISNULL(pQueueItem) || ISNULL(pQueueProcessor)) {
ret = HFS_STATUS_PRE_CONDITION_FAILS;
goto leave;
}
if (!list_empty(&pQueueItem->listHead)) {
HFS_LOG_ERROR("Item %p is alread on some list",
pQueueItem);
ret = HFS_STATUS_PRE_CONDITION_FAILS;
goto leave;
}
if (QUEUE_STATE_STARTED!=hfsQueueGetState(pQueueProcessor)) {
HFS_LOG_ERROR("Queue Not started cannot insert elements now %p",
pQueueProcessor);
ret = HFS_STATUS_QUEUE_NOT_STARTED;
goto leave;
}
//- Lock the Queue -//
ret = hfsMutexLock(&pQueueProcessor->queueLock);
if (!HFS_SUCCESS(ret)) {
ret = HFS_STATUS_LOCKING_ERROR;
goto leave;
}
//- Insert the element -//
list_add_tail(&pQueueItem->listHead, &pQueueProcessor->lstAnchorPendingCmds);
ret = hfsSempost(&pQueueProcessor->semPendingItems);
if (ret) {
HFS_LOG_ERROR("Queue threads cannot be woken up");
ret = HFS_INTERNAL_ERROR;
goto removeItem;
}
ret = HFS_STATUS_SUCCESS;
goto unlock;
//- Cleanups -//
removeItem:
list_del_init(&pQueueItem->listHead);
unlock:
//- Unlock the Queue -//
hfsMutexUnlock(&pQueueProcessor->queueLock);
leave:
HFS_LEAVE(hfsQueueItem);
return ret;
}
示例8: core
Traits *DomainObject::getTraits (Atom a)
{
if (ISNULL(a)) {
return core()->traits.null_itraits;
}
if (a == kSpecialType) {
return core()->traits.void_itraits;
}
switch (a & 7) {
case kObjectType:
return AvmCore::atomToScriptObject(a)->traits();
case kNamespaceType:
return core()->traits.namespace_itraits;
case kStringType:
return core()->traits.string_itraits;
case kBooleanType:
return core()->traits.boolean_itraits;
case kIntegerType:
return core()->traits.int_itraits;
case kDoubleType:
return core()->traits.number_itraits;
}
toplevel()->throwArgumentError(kNotImplementedError, core()->toErrorString("value"));
return core()->traits.void_itraits;
}
示例9: assert
BOOL CNameEvent::Wait()
{
assert(ISNOTNULL(m_hEvent));
if (ISNULL(m_hEvent))
{
DOLOG("can't wait null event handle!");
return FALSE;
}
DWORD retCode = 0;
retCode = WaitForSingleObject(m_hEvent, BLOCKOUTTIMEMSEC);
BOOL isOK = FALSE;
switch (retCode)
{
case WAIT_FAILED:
DOLOG("wait event failed! " + GetLastError());
isOK = FALSE;
break;
case WAIT_OBJECT_0:
isOK = TRUE;
break;
case WAIT_TIMEOUT:
DOLOG(" waitforSingleObject Timeout !");
isOK = FALSE;
default:
DOLOG("waitforSingleObject unknown conidtion ! " + GetLastError());
isOK = FALSE;
};
return isOK;
}
示例10: dump_stager_cfg
/*
* write the stager config to an alternate location and skip verification.
*/
int
dump_stager_cfg(
const stager_cfg_t *cfg, /* cfg to dump */
const char *location) /* location at which to write the file */
{
int err = 0;
Trace(TR_FILES, "dump stager cfg to %s",
location ? location : "NULL");
if (ISNULL(cfg, location)) {
Trace(TR_OPRMSG, "dump stager cfg failed: %s", samerrmsg);
return (-1);
}
if (strcmp(location, STAGE_CFG) == 0) {
samerrno = SE_INVALID_DUMP_LOCATION;
/* Cannot dump the file to %s */
snprintf(samerrmsg, MAX_MSG_LEN,
GetCustMsg(SE_INVALID_DUMP_LOCATION), location);
Trace(TR_OPRMSG, "dump stager cfg failed: %s", samerrmsg);
return (-1);
}
err = write_stager_cmd(location, cfg);
Trace(TR_OPRMSG, "dumped stager cfg");
return (err);
}
示例11: redirect_get_location
/**
** checks for redirect and returns location value
**/
char * redirect_get_location( const char * header )
{
char * ret = NULL ;
char * ptr = NULL ;
char * tmp = NULL ;
if ( ISNULL( header ) )
return NULL;
if ( (tmp = xstrdup( header )) )
ptr = strstr( tmp, "Location: " );
if ( ptr )
{
ptr += strlen( "Location: " );
NEXTFIELD( ptr );
if ( ptr )
{
TRUNC( ptr, " \t\r\n" );
if ( *ptr ) ret = xstrdup(ptr);
}
}
xfree( tmp );
return ret;
}
示例12: url_get_port
unsigned short url_get_port( const char * url )
{
char * tmp = NULL;
char * ptr = NULL;
unsigned short port = 80;
if ( ISNULL(url) )
return port;
if ( (tmp = xstrdup( url )) )
ptr = strstr( tmp, "://" );
if ( ptr )
{
char * slash = NULL;
ptr += strlen( "://" );
if ( ptr )
slash = strchr( ptr, '/' );
if ( slash )
{
char * colon;
*slash = 0;
colon = strchr( ptr, ':' );
if ( colon++ )
{
port = (unsigned short)atoi( colon );
debug( "URL port: %s\n", ptr );
}
}
}
xfree( tmp );
return port;
}
示例13: calling_host
/*
* Function to update the job struct when a host has been called
* asynchronously and did not return an error on the initial call.
* Note: this function is in job_control because it needs access to the
* samrlock mutex.
*/
int
calling_host(char *job_id, char *host, int host_num) {
samrthread_t *ptr;
dispatch_job_t *dj;
if (ISNULL(job_id, host)) {
Trace(TR_ERR, "failed to find the job: %d %s",
samerrno, samerrmsg);
return (-1);
}
Trace(TR_MISC, "updating dispatch job %s with response from %s", job_id,
host);
pthread_mutex_lock(samrlock); /* ++ LOCK samrtlist */
ptr = find_this_activity(job_id);
/* If we didn't find the job, return an error */
if (ptr == NULL) {
pthread_mutex_unlock(samrlock); /* ++ UNLOCK */
samrerr(SE_NO_SUCH_ACTIVITY, job_id);
Trace(TR_ERR, "failed to find the job: %d %s",
samerrno, samerrmsg);
return (-1);
}
if (ptr->type != SAMA_DISPATCH_JOB) {
pthread_mutex_unlock(samrlock); /* ++ UNLOCK */
setsamerr(SE_INVALID_ACTIVITY_TYPE);
Trace(TR_ERR, "failed to find the job: %d %s",
samerrno, samerrmsg);
return (-1);
}
dj = (dispatch_job_t *)ptr->args->db.job;
if (host_num >= dj->host_count) {
pthread_mutex_unlock(samrlock); /* ++ UNLOCK */
setsamerr(SE_INVALID_HOST_ID_IN_RESPONSE);
Trace(TR_ERR, "Host number outside of range");
return (-1);
}
dj->hosts_called++;
/*
* Only upgrade the status if a higher status has not been set.
* Otherwise leave it alone since there is no guarantee that host_called
* will be executed prior to receiving an asychronous response.
*/
if (dj->responses[host_num].status == OP_NOT_YET_CALLED) {
dj->responses[host_num].status = OP_PENDING;
}
if (dj->overall_status == DJ_INITIALIZING) {
dj->overall_status = DJ_PENDING;
}
pthread_mutex_unlock(samrlock); /* ++ UNLOCK */
return (0);
}
示例14: cns_get_public_key
/*
* Get a public key to be used to generate a secret key to
* encrypt passwords for the cns_register rpc call
*
* server_pub_key is a 1024 bit DH public key in a null-terminated hex
* string. The lifecycle of this key is the same as the lifecycle of
* the fsmgmtd. When fsmgmtd is restarted a new key is generated.
*
* signature is a digital signature calculated using the mgmt daemon's
* private signature key. It should be used along with mgmt daemon's
* public signature key by the client to verify that the
* server_pub_key is from the daemon prior to trusting the server_pub_key.
*/
int
cns_get_public_key(
ctx_t *c, /* ARGSUSED */
char **server_pub_key,
crypt_str_t **sig) {
unsigned char *buf;
int buf_len;
int retval;
Trace(TR_MISC, "get public key");
if (ISNULL(server_pub_key, sig)) {
Trace(TR_ERR, "getting public key failed failed %d %s",
samerrno, samerrmsg);
return (-1);
}
*sig = NULL;
if ((retval = get_public_key(server_pub_key, &buf, &buf_len)) != 0) {
set_registration_error(retval);
Trace(TR_ERR, "getting public key failed failed %d %s",
samerrno, samerrmsg);
return (-1);
}
*sig = (crypt_str_t *)mallocer(sizeof (crypt_str_t));
if (*sig == NULL) {
Trace(TR_ERR, "getting public key failed failed %d %s",
samerrno, samerrmsg);
return (-1);
}
(*sig)->str = buf;
(*sig)->str_len = buf_len;
Trace(TR_MISC, "got public key");
return (0);
}
示例15: get_all_rl_fs_directives
/*
* get_all_rl_fs_directives()
* Function to get all file system directive of releaser.cmd.
*/
int
get_all_rl_fs_directives(
ctx_t *ctx, /* ARGSUSED */
sqm_lst_t **rl_fs_directives) /* must be freed by caller */
{
releaser_cfg_t *releaser;
Trace(TR_MISC, "get all releaser's file system directives");
*rl_fs_directives = NULL;
if (ISNULL(rl_fs_directives)) {
Trace(TR_ERR, "%s", samerrmsg);
return (-1);
}
/*
* read releaser.cmd file to get all
* releaser.cmd information.
*/
if (read_releaser_cfg(&releaser) != 0) {
Trace(TR_ERR, "Read of %s failed with error: %s",
releaser_file, samerrmsg);
return (-1);
}
*rl_fs_directives = releaser->rl_fs_dir_list;
releaser->rl_fs_dir_list = NULL;
free_releaser_cfg(releaser);
Trace(TR_MISC, "get all releaser's file system directives success");
return (0);
}