• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IS_NULL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IS_NULL函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_NULL函数的具体用法?C++ IS_NULL怎么用?C++ IS_NULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IS_NULL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FunctionList_AddLocalFunction

STATUS FunctionList_AddLocalFunction(FunctionList fl, const char *func_name, const unsigned int address)
{
	FunctionList f ;
	FunctionList tmp = fl;

	if(IS_NULL(func_name) || (strlen(func_name) == 0))
	{
		LOG_ERROR("local function name is NULL");
		return STATUS_FAILURE;
	}
	while(tmp->next != NULL)
	{
		if(!IS_NULL(tmp->func_name) && strcasecmp(tmp->func_name, func_name) == 0)
		{
			LOG_ERROR("function name '%s' already exists", func_name);
			return STATUS_FAILURE;
		}
		tmp = tmp->next;
	}

	f = FunctionList_Create();
	if(!IS_NULL(f))
	{
		f->func_name = (char*)Malloc(strlen(func_name)+1);
		strcpy(f->func_name, func_name);
		f->type = FUNCTION_TYPE_LOCAL;
		f->u.address = address;
		tmp->next = f;
		return STATUS_SUCCESS;
	}
	LOG_ERROR("FunctionList_Create() failed");
	return STATUS_FAILURE;
}
开发者ID:kiransj,项目名称:m-programming-language,代码行数:33,代码来源:function.c


示例2: init_link_slot_tab

/**
 *	init_link_slot_tab - 初始化LINK槽表
 *
 *	@nr_links:		总的连接数
 *
 *	return
 *		0			成功
 *		!0			失败
 */
static int
init_link_slot_tab(IN unsigned short nr_links)
{
	int						i;
	size_t					size;
	struct link_slot_tab	*obj = lnktable_object();
	struct link_slot		*slot;
	struct link_buff		*buff;

	memset(obj, 0, sizeof(struct link_slot_tab));
	obj->nr_links = nr_links;

	size = nr_links * sizeof(struct link_slot);
	obj->slot = zmalloc(size);
	if(IS_NULL(obj->slot))
		return gen_errno(0, GCENOMEM);
	else
		slot = obj->slot;

	size = nr_links * 2 * sizeof(struct link_buff);
	obj->buff = zmalloc(size);
	if(IS_NULL(obj->buff))
		return gen_errno(0, GCENOMEM);
	else
		buff = obj->buff;

	for(i = 0; i < nr_links*2; i++)
		init_link_buff(buff++);
	
	for(i = 0; i < nr_links; i++)
		init_link_slot(slot++);

	return 0;
}
开发者ID:lufb,项目名称:code,代码行数:43,代码来源:gcs_link.c


示例3: knh__String_substring

static METHOD knh__String_substring(Ctx *ctx, knh_sfp_t *sfp)
{
	knh_bytes_t base = knh_String_tobytes(sfp[0].s);
	knh_bytes_t sub;
	if(knh_String_isASCII(sfp[0].s)) {
		size_t offset = IS_NULL(sfp[1].o) ? 0 : knh_array_index(ctx, sfp[1].ivalue, base.len);
		sub = knh_bytes_last(base, offset);
		if(IS_NOTNULL(sfp[2].o)) {
			size_t len = (size_t)sfp[2].ivalue;
			if(len < sub.len) sub = knh_bytes_first(sub, len);
		}
	}
	else { // multibytes
		size_t mlen = knh_bytes_mlen(base);
		size_t offset = IS_NULL(sfp[1].o) ? 0 : knh_array_index(ctx, sfp[1].ivalue, mlen);
		size_t length = IS_NULL(sfp[2].o) ? (mlen - offset) : (size_t)sfp[2].ivalue;
		sub = knh_bytes_mofflen(base, offset, length);
	}

	String *s;
	if(sub.len == 0) {
		s = TS_EMPTY;
	}
	else if(sub.len == base.len) {
		s = sfp[0].s;
	}
	else {
		s = new_String(ctx, sub, sfp[0].s);
	}
	KNH_RETURN(ctx, sfp, s);
}
开发者ID:matsuu,项目名称:konoha,代码行数:31,代码来源:stringapi.c


示例4: _str_perform_match

static BOOL _str_perform_match(CSTR pattern, CSTR string, BOOL caseSensitive) {

	CHAR	ch;

	if (IS_NULL(pattern) || IS_NULL(string))
		return FALSE;

	for (;;) {
		switch (ch = *pattern++) {

			case '\0':
				return (*string == c_NULL);

			case '?':
				if (*string == c_NULL)
					return FALSE;

				++string;
				break;

			case '*': {

				CSTR	str;

				while (*pattern == '?') {

					/* Skip a character for each '?'. */

					if (*string == c_NULL)
						return FALSE;

					++string;
					++pattern;
				}


				if (*pattern == c_NULL) /* a trailing '*' matches everything else */
					return TRUE;

				str = string;
				while (*str != c_NULL) {

					if ( (caseSensitive ? *str == *pattern : str_char_tolower(*str) == str_char_tolower(*pattern)) &&
						 _str_perform_match(pattern, str, caseSensitive) )
						return TRUE;

					++str;
				}

				break;
			}

			default:
				if (caseSensitive ? *string++ != ch : str_char_tolower(*string++) != str_char_tolower(ch))
					return FALSE;

				break;
		}
	}
}
开发者ID:Essency,项目名称:services,代码行数:60,代码来源:strings.c


示例5: FS_OPENCREATE

int IFSEXPORT
FS_OPENCREATE(
   struct cdfsi far * pcdfsi,
   struct cdfsd far * pcdfsd,
   char far * pszName,
   unsigned short iCurDirEnd,
   struct sffsi far * psffsi,
   struct sffsd far * psffsd,
   unsigned long flOpenMode,
   unsigned short fsOpenFlag,
   unsigned short far * pusAction,
   unsigned short fsAttr,
   PEAOP pEABuf,
   unsigned short far * pfsGenFlag
   )
{
   int rc;
   struct opencreate far * p = &pRequest->data.opencreate;

   if (rc = requestExchangeXS()) return rc;

   pRequest->rq = FSRQ_OPENCREATE;

   COPYPTR(&p->pVolData, queryVPFSD(pcdfsi->cdi_hVPB));
   p->cdfsi = *pcdfsi;
   p->cdfsd = *pcdfsd;

   if (strlen(pszName) >= CCHMAXPATH)
      RELEASE_AND_EXIT(ERROR_INVALID_PARAMETER);
   strcpy(p->szName, pszName);
   p->iCurDirEnd = iCurDirEnd;

   p->sffsi = *psffsi;
   p->flOpenMode = flOpenMode;
   p->fsOpenFlag = fsOpenFlag;
   p->fsAttr = fsAttr;

   if (!IS_NULL(pEABuf)) {
      rc = copyEAOP(pEABuf, CEA_FEAS_TO_BUF, 0);
      if (rc) RELEASE_AND_EXIT(rc);
      p->fHasEAs = 1;
   }
   else p->fHasEAs = 0;

   if (rc = signalDaemonAndWait()) RELEASE_AND_EXIT(rc);

   *psffsi = p->sffsi;
   if (psffsi->sfi_type == STYPE_FILE)
      COPYPTR(psffsd, &p->pOpenFileData);

   *pusAction = p->usAction;
   *pfsGenFlag = p->fsGenFlag;

   if (!IS_NULL(pEABuf)) {
      rc = copyEAOP(pEABuf, CEA_SET_OERROR, p->oError);
      if (rc) RELEASE_AND_EXIT(rc);
   }

   RELEASE_AND_EXIT(pRequest->rc);
}
开发者ID:OS2World,项目名称:DRV-ISOFS_Paul,代码行数:60,代码来源:stubfsd.c


示例6: FunctionList_AddNativeFunction

STATUS FunctionList_AddNativeFunction(FunctionList fl, const char *func_name, NativeFunction func)
{
	FunctionList f ;
	FunctionList tmp = fl;

	if(IS_NULL(func_name) || (strlen(func_name) == 0))
	{
		LOG_ERROR("native function name is NULL");
		return STATUS_FAILURE;
	}
	while(tmp->next != NULL)
	{
		if(!IS_NULL(tmp->func_name) && strcasecmp(tmp->func_name, func_name) == 0)
		{
			LOG_ERROR("function name '%s' already exists", func_name);
			return STATUS_FAILURE;
		}
		tmp = tmp->next;
	}

	f = FunctionList_Create();
	if(!IS_NULL(f))
	{
		f->func_name = (char*)Malloc(strlen(func_name)+1);
		strcpy(f->func_name, func_name);
		f->type = FUNCTION_TYPE_NATIVE;
		f->u.nFunc = func;
		tmp->next = f;
		return STATUS_SUCCESS;
	}
	LOG_ERROR("FunctionList_Create() failed");
	return STATUS_FAILURE;
}
开发者ID:kiransj,项目名称:m-programming-language,代码行数:33,代码来源:function.c


示例7: putGV

int putGV(JNIEnv* env, jint gmask, jint baseIndex, jobject gvdata, const LayoutEngine* engine, int glyphCount) {
    int count = env->GetIntField(gvdata, gvdCountFID);

    jarray glyphArray = (jarray)env->GetObjectField(gvdata, gvdGlyphsFID);
    if (IS_NULL(glyphArray)) {
      JNU_ThrowInternalError(env, "glypharray null");
      return 0;
    }
    jint capacity = env->GetArrayLength(glyphArray);
    if (count + glyphCount > capacity) {
      JNU_ThrowArrayIndexOutOfBoundsException(env, "");
      return 0;
    }

    jarray posArray = (jarray)env->GetObjectField(gvdata, gvdPositionsFID);
    if (IS_NULL(glyphArray)) {
      JNU_ThrowInternalError(env, "positions array null");
      return 0;
    }
    jarray inxArray = (jarray)env->GetObjectField(gvdata, gvdIndicesFID);
    if (IS_NULL(inxArray)) {
      JNU_ThrowInternalError(env, "indices array null");
      return 0;
    }

    int countDelta = 0;

    // le_uint32 is the same size as jint... forever, we hope
    le_uint32* glyphs = (le_uint32*)env->GetPrimitiveArrayCritical(glyphArray, NULL);
    if (glyphs) {
      jfloat* positions = (jfloat*)env->GetPrimitiveArrayCritical(posArray, NULL);
      if (positions) {
        jint* indices = (jint*)env->GetPrimitiveArrayCritical(inxArray, NULL);
        if (indices) {
          LEErrorCode status = (LEErrorCode)0;
          engine->getGlyphs(glyphs + count, gmask, status);
          engine->getGlyphPositions(positions + (count * 2), status);
          engine->getCharIndices((le_int32*)(indices + count), baseIndex, status);

          countDelta = glyphCount;

          // !!! need engine->getFlags to signal positions, indices data
          /* "0" arg used instead of JNI_COMMIT as we want the carray
           * to be freed by any VM that actually passes us a copy.
           */
          env->ReleasePrimitiveArrayCritical(inxArray, indices, 0);
        }
        env->ReleasePrimitiveArrayCritical(posArray, positions, 0);
      }
      env->ReleasePrimitiveArrayCritical(glyphArray, glyphs, 0);
    }

    if (countDelta) {
      count += countDelta;
      env->SetIntField(gvdata, gvdCountFID, count);
    }

  return 1;
}
开发者ID:sakeinntojiu,项目名称:openjdk8-jdk,代码行数:59,代码来源:SunLayoutEngine.cpp


示例8: memq

int memq(SCM key, SCM list) {
    SCM l = list;
    while (!IS_NULL(l)) {
        if (!(IS_PAIR(l) || IS_NULL(l))) wta_error ("memq", 2);
        if EQ(key, CAR(l)) return 1;
        l = CDR(l);
    }
    return 0;
}
开发者ID:kunedo,项目名称:tscheme,代码行数:9,代码来源:misc.c


示例9: _do_insert

void _do_insert(List *L, ListNode *node)
{
    node->next = L->head;
    if (!IS_NULL(L->head))
        L->head->prev = node;
    L->head = node;
    node->prev = NULL;
    ++L->length;
    if (IS_NULL(L->head->next))
        L->tail = node;
}
开发者ID:hoohack,项目名称:KeepCoding,代码行数:11,代码来源:list.c


示例10: free

void *_do_delete(List *L, ListNode *del_node)
{
    void *val = del_node->value;
    if (!IS_NULL(del_node->prev))
        del_node->prev->next = del_node->next;
    else
        L->head = del_node->next;

    if (!IS_NULL(del_node->next))
        del_node->next->prev = del_node->prev;
    free(del_node);
    return val;
}
开发者ID:hoohack,项目名称:KeepCoding,代码行数:13,代码来源:list.c


示例11: str_creationinfo_set

BOOL str_creationinfo_set(CreationInfo *info, CSTR creator, CSTR reason, time_t time_set) {

	if (IS_NULL(info) || IS_NULL(creator) || IS_NULL(reason))
		return FALSE;

	str_creator_set(&(info->creator), creator, time_set);

	if (IS_NOT_NULL(info->reason))
		mem_free(info->reason);

	info->reason = str_duplicate(reason);

	return TRUE;
}
开发者ID:Essency,项目名称:services,代码行数:14,代码来源:strings.c


示例12: test_module_load

void test_module_load(CTX)
{
    module_load(_ctx, (kcontext_t*)_ctx, BUILD_DIR "mod_sample.dylib", "ksample");
    ksampleshare_t *sharemod = (ksampleshare_t*) _ctx->modshare[MOD_SAMPLE];
    assert(sharemod);

    sharemod->h.setup(_ctx, (kmodshare_t*)sharemod);
    ksamplemod_t *mod = (ksamplemod_t*) _ctx->mod[MOD_SAMPLE];

    assert(mod);
    assert(IS_NULL(mod->array) == 0);
    MODGC_gc_invoke(_ctx, 0);
    assert(IS_NULL(mod->array) == 0);
}
开发者ID:OkamotoYuki,项目名称:konoha,代码行数:14,代码来源:test_loader.c


示例13: readdirTest8

/**
 * @brief
 * try to readdir a directory opened by another user. should fail.
 * @return 1 if successful, 0 otherwise
 */
error_t readdirTest8(){
	user_id uid1 = 1, uid2 = 2;
	NANDFS_DIR* ds;
	uint8_t *dir = "/";

	SET_CURRENT_USER(uid1);
	ds = opendir(dir);
	VERIFY(!IS_NULL(ds));

	SET_CURRENT_USER(uid2);
	VERIFY(IS_NULL(readdir(ds)));

	return 1;
}
开发者ID:aviadzuc,项目名称:NANDFS,代码行数:19,代码来源:readdirTests.c


示例14: do_service_release_process

static RIOTC_RTN do_service_release_process(RIOTC_MASTER_CTX * ctx)
{
    if (IS_NULL(ctx))
        return RIOTC_RTN_FAIL_IS_NULL;

    if (!IS_NULL(ctx->evhr))
        riotc_event_handler_release(ctx->evhr);

    if (!IS_NULL(ctx->scm))
        riotc_master_scm_release(ctx->scm);

    free(ctx);

    return RIOTC_RTN_SUCCESS;
}
开发者ID:yenpai,项目名称:RIOTC,代码行数:15,代码来源:riotc_master_service.c


示例15: check_nargs

int check_nargs(char *fname, SCM args, int min, int max) {
    if (!(IS_PAIR(args) || IS_NULL(args)))
        error0("wrong arguments");

    int i;
    for (i = 0; IS_PAIR(args); i++)
        args = CDR(args);

    if (!IS_NULL(args))
        error0("wrong arguments");
    if (!((min <= i) && (i <= max)))
        wna_error(fname, i);

    return i;
}
开发者ID:kunedo,项目名称:tscheme,代码行数:15,代码来源:error.c


示例16: GameEnd

int GameEnd(int amPlayers)
{
    int iwinner;
    int iPairs = 0;
    for (int i = 0; i < amPlayers; i++)
        if (pairs[i] > iPairs)
        {
            iwinner = i;
            iPairs = pairs[iwinner];
        }

    int i = 0;
    while (!IS_NULL(objects[i++]));
    i--;

    char c[100];

    char *c2 = (char *)malloc(sizeof(char));
    sprintf(c2, "%d", iPairs);
    concat("The Winner with ", c2);
    if (iPairs == 1)
        concat(c, " pair is Player ");
    else
        concat(c, " pairs is Player ");

    sprintf(c2, "%d", iwinner);
    concat(c, c2);

    objects[i] = O_New_Label(objects[i], c, 300, 300);

    i++;
    objects[i] = O_New_Button(objects[i], "Continue", BContinue, 300, 400);
}
开发者ID:GURKE,项目名称:Memory,代码行数:33,代码来源:Game.c


示例17: init_linkno_pool

/**
 *	init_linkno_pool - 初始化LINKNO池
 *
 *	@nr_links:		总的LINKNO数
 *
 *	return
 *		0			成功
 *		!0			失败
 */
static int
init_linkno_pool(IN unsigned short nr_links)
{
	int						i;
	size_t					size;
	struct linkno_s_pool	*obj = lnk_pool_object();
	struct linkno_s			*ptr;

	memset(obj, 0, sizeof(struct linkno_s_pool));

	obj->cur_using	= 0;
	INIT_LIST_HEAD(&(obj->free_head));
	pthread_mutex_init(&(obj->lock), NULL);
	obj->nr_links = nr_links;
	memset(obj->bitmap, 0, sizeof(obj->bitmap));

	size = nr_links * sizeof(struct linkno_s);
	obj->base = zmalloc(size);
	if(IS_NULL(obj->base))
		return gen_errno(0, GCENOMEM);
	
	ptr = obj->base;
	for(i = 0; i < nr_links; i++, ptr++)
		list_add_tail(&(ptr->list), &(obj->free_head));

	return 0;
}
开发者ID:lufb,项目名称:code,代码行数:36,代码来源:gcs_link.c


示例18: IS_NULL

void DataTableColumnType::createDefaultCell()
{
	std::string value;

	IS_NULL(m_defaultCell);

	// If mangleValue does not update the input value string,
	//   then the default cell will have a value of 0 for floats and ints
	//     and a value of empty string for strings.
	IGNORE_RETURN(mangleValue(value));

	switch(m_basicType)
	{
	case DT_Int:
		m_defaultCell = new DataTableCell(static_cast<int>(strtol(value.c_str(), NULL, 0)));
		break;
	case DT_Float:
		m_defaultCell = new DataTableCell(static_cast<float>(atof(value.c_str())));
		break;
	case DT_String:
	case DT_Comment:
	case DT_Unknown:
	default:
		m_defaultCell = new DataTableCell(value.c_str());
		break;
	}
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:27,代码来源:DataTableColumnType.cpp


示例19: sdt_loop_A

/* Read from STDIN and base32 encode the data as A records */
void
sdt_loop_A(SDT_STATE *ss)
{
    ssize_t n = 0;
    char *buf = NULL;

    int flags = 0;

    flags = fcntl(ss->fd_in, F_GETFL, 0);
    flags |= O_NONBLOCK;
    (void)fcntl(ss->fd_in, F_SETFL, flags);

    IS_NULL(buf = calloc(ss->bufsz, 1));

    while ( (n = sdt_read(ss, buf, ss->bufsz)) > 0) {
        VERBOSE(3, "Sending A record: %d of %u bytes\n", (int32_t)n, (u_int32_t)ss->bufsz);
        sdt_send_A(ss, buf, n);
        ss->sum_up += n;
        if (woken != 0)
            break;
        VERBOSE(3, "A record: res timeout = %d, sleep = %f seconds\n",
                ss->backoff, (float)(ss->sleep * ss->backoff)/1000000);
        usleep(ss->sleep);
    }

    free(buf);
    VERBOSE (1, "*** Exiting from A record read loop\n");
}
开发者ID:srclib,项目名称:sods,代码行数:29,代码来源:sdt.c


示例20: readdirTest7

/**
 * @brief
 * try to read from an illegal dirstream. should fail
 * @return 1 if successful, 0 otherwise
 */
error_t readdirTest7(){
	NANDFS_DIR* ds = NULL;

	VERIFY(IS_NULL(readdir(ds)));

	return 1;
}
开发者ID:aviadzuc,项目名称:NANDFS,代码行数:12,代码来源:readdirTests.c



注:本文中的IS_NULL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IS_PATH_SEP函数代码示例发布时间:2022-05-30
下一篇:
C++ IS_NPC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap