当前位置: 首页>>代码示例>>C++>>正文


C++ IS_NULL函数代码示例

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


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


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