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


C++ NULLFREE函数代码示例

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


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

示例1: logfile_fn

static void logfile_fn(const char *token, char *value, void *UNUSED(setting), FILE *f)
{
	if(value)
	{
		char *saveptr1 = NULL;
		cfg.logtostdout = 0;
		cfg.logtosyslog = 0;
		NULLFREE(cfg.logfile);
		if(strlen(value) > 0)
		{
			char *pch;
			for(pch = strtok_r(value, ";", &saveptr1); pch != NULL; pch = strtok_r(NULL, ";", &saveptr1))
			{
				pch = trim(pch);
				if(!strcmp(pch, "stdout")) { cfg.logtostdout = 1; }
				else if(!strcmp(pch, "syslog")) { cfg.logtosyslog = 1; }
				else
				{
					NULLFREE(cfg.logfile);
					if(!(cfg.logfile = cs_strdup(pch)))
						{ continue; }
				}
			}
		}
		else
		{
			if(!(cfg.logfile = cs_strdup(CS_LOGFILE)))
				{ cfg.logtostdout = 1; }
		}
		return;
	}
	if(cfg.logfile || cfg.logtostdout == 1 || cfg.logtosyslog == 1 || cfg.http_full_cfg)
	{
		value = mk_t_logfile();
		fprintf_conf(f, token, "%s\n", value);
		free_mk_t(value);
	}
}
开发者ID:StbLinux,项目名称:oscam,代码行数:38,代码来源:oscam-config-global.c

示例2: nds_destroy_nhwindow

/*
 * Destroy the window specified and recycle the window slot.
 */
void nds_destroy_nhwindow(winid win)
{
  nds_nhwindow_t *window = windows[win];

  nds_clear_nhwindow(win);

  if (window->img) {
    free_ppm(window->img);
  }

  NULLFREE(window);

  windows[win] = NULL;
}
开发者ID:paulog,项目名称:nethackds,代码行数:17,代码来源:nds_win.c

示例3: config_list_free_values

void config_list_free_values(const struct config_list *clist, void *config_data) {
	const struct config_list *c;
	for (c = clist; c->opt_type != OPT_UNKNOWN; c++) {
		void *var = config_data + c->var_offset;
		if (c->opt_type == OPT_STRING) {
			char **scfg = var;
			NULLFREE(*scfg);
		}
		if (c->free_value && (c->opt_type == OPT_FUNC || c->opt_type == OPT_FUNC_EXTRA)) {
			c->free_value(var);
		}
	}
	return;
}
开发者ID:IgorWallacy,项目名称:oscam-nx111,代码行数:14,代码来源:oscam-conf.c

示例4: kill_all_clients

void kill_all_clients(void)
{
	struct s_client *cl;
	for(cl = first_client->next; cl; cl = cl->next)
	{
		if(cl->typ == 'c' || cl->typ == 'm')
		{
			if(cl->account && cl->account->usr)
				{ cs_log("killing client %s", cl->account->usr); }
			kill_thread(cl);
		}
	}
	NULLFREE(processUsername);
}
开发者ID:EvertYing,项目名称:oscam,代码行数:14,代码来源:oscam-client.c

示例5: cacheex_load_config_file

void cacheex_load_config_file(void)
{
    struct s_cacheex_matcher *entry, *old_list;

    old_list = cfg.cacheex_matcher;
    cfg.cacheex_matcher = cacheex_matcher_read_int();

    while(old_list)
    {
        entry = old_list->next;
        NULLFREE(old_list);
        old_list = entry;
    }
}
开发者ID:BATYD-Turksat,项目名称:oscam,代码行数:14,代码来源:module-cacheex.c

示例6: ICC_Async_Device_Init

int32_t ICC_Async_Device_Init (struct s_reader *reader)
{
	reader->fdmc=-1;
	rdr_debug_mask(reader, D_IFD, "Opening device %s", reader->device);
	reader->written = 0;
	int32_t ret = reader->crdr.reader_init(reader);
	if (ret == OK)
		rdr_debug_mask(reader, D_IFD, "Device %s succesfully opened", reader->device);
	else {
		if(reader->typ != R_SC8in1) NULLFREE(reader->crdr_data);
		rdr_debug_mask(reader, D_IFD, "ERROR: Can't open %s device", reader->device);
	}
	return ret;
}
开发者ID:TELE-TWIN,项目名称:oscam,代码行数:14,代码来源:icc_async.c

示例7: clear_ptab

/* Clears the s_ptab struct provided by setting nfilts and nprids to zero. */
void clear_ptab(struct s_ptab *ptab)
{
	int32_t i;
	ptab->nports = 0;
	for(i = 0; i < CS_MAXPORTS; i++)
	{
		if(ptab->ports[i].ncd)
		{
			ptab->ports[i].ncd->ncd_ftab.nfilts = 0;
			ptab->ports[i].ncd->ncd_ftab.filts[0].nprids = 0;
			NULLFREE(ptab->ports[i].ncd);
			ptab->ports[i].ncd = NULL;
		}
	}
}
开发者ID:FFTEAM,项目名称:oscam,代码行数:16,代码来源:oscam-conf-chk.c

示例8: nds_get_pan_direction

nds_cmd_t nds_get_pan_direction()
{
  winid win;
  menu_item *sel;
  ANY_P ids[4];
  nds_cmd_t cmd;
  int res;

  win = create_nhwindow(NHW_MENU);
  start_menu(win);

  ids[0].a_int = CMD_PAN_UP;
  ids[1].a_int = CMD_PAN_DOWN;
  ids[2].a_int = CMD_PAN_LEFT;
  ids[3].a_int = CMD_PAN_RIGHT;

  add_menu(win, NO_GLYPH, &(ids[0]), 0, 0, 0, "Pan Up", 0);
  add_menu(win, NO_GLYPH, &(ids[1]), 0, 0, 0, "Pan Down", 0);
  add_menu(win, NO_GLYPH, &(ids[2]), 0, 0, 0, "Pan Left", 0);
  add_menu(win, NO_GLYPH, &(ids[3]), 0, 0, 0, "Pan Right", 0);

  end_menu(win, "What Direction?");
  res = select_menu(win, PICK_ONE, &sel);
  destroy_nhwindow(win);

  if (res <= 0) {
    cmd.f_char = -1;
    cmd.name = NULL;
  } else {
    cmd.f_char = sel->item.a_int;

    if (cmd.f_char == CMD_PAN_UP) {
      cmd.name = "Pan Up";
    } else if (cmd.f_char == CMD_PAN_DOWN) {
      cmd.name = "Pan Down";
    } else if (cmd.f_char == CMD_PAN_LEFT) {
      cmd.name = "Pan Left";
    } else if (cmd.f_char == CMD_PAN_RIGHT) {
      cmd.name = "Pan Right";
    }
  }

  NULLFREE(sel);

  return cmd;
}
开发者ID:fancypantalons,项目名称:nethackds,代码行数:46,代码来源:nds_config.c

示例9: NULLFREE

static struct CRYPTO_dynlock_value *SSL_dyn_create_function(const char *file, int32_t line)
{
	struct CRYPTO_dynlock_value *l;
	if(!cs_malloc(&l, sizeof(struct CRYPTO_dynlock_value)))
		{ return NULL; }

	if(pthread_mutex_init(&l->mutex, NULL))
	{
		// Initialization of mutex failed.
		NULLFREE(l);
		return (NULL);
	}
	pthread_mutex_init(&l->mutex, NULL);
	// just to remove compiler warnings...
	if(file || line) { return l; }
	return l;
}
开发者ID:jackuzzy,项目名称:oscam_private,代码行数:17,代码来源:module-webif-lib.c

示例10: radegast_send_ecm

static int32_t radegast_send_ecm(struct s_client *client, ECM_REQUEST *er, uchar *UNUSED(buf))
{
	int32_t n;
	uchar provid_buf[8];
	uchar header[22] = "\x02\x01\x00\x06\x08\x30\x30\x30\x30\x30\x30\x30\x30\x07\x04\x30\x30\x30\x38\x08\x01\x02";
	uchar *ecmbuf;

	if(!radegast_connect())
		{ return (-1); }

	if(!cs_malloc(&ecmbuf, er->ecmlen + 30))
		{ return -1; }

	ecmbuf[0] = 1;
	ecmbuf[1] = (er->ecmlen + 30 - 2) & 0xff;
	memcpy(ecmbuf + 2, header, sizeof(header));
	for(n = 0; n < 4; n++)
	{
		snprintf((char *)provid_buf + (n * 2), sizeof(provid_buf) - (n * 2), "%02X", ((uchar *)(&er->prid))[4 - 1 - n]);
	}
	ecmbuf[7] = provid_buf[0];
	ecmbuf[8] = provid_buf[1];
	ecmbuf[9] = provid_buf[2];
	ecmbuf[10] = provid_buf[3];
	ecmbuf[11] = provid_buf[4];
	ecmbuf[12] = provid_buf[5];
	ecmbuf[13] = provid_buf[6];
	ecmbuf[14] = provid_buf[7];
	ecmbuf[2 + sizeof(header)] = 0xa;
	ecmbuf[3 + sizeof(header)] = 2;
	ecmbuf[4 + sizeof(header)] = er->caid >> 8;
	ecmbuf[5 + sizeof(header)] = er->caid & 0xff;
	ecmbuf[6 + sizeof(header)] = 3;
	ecmbuf[7 + sizeof(header)] = er->ecmlen & 0xff;
	memcpy(ecmbuf + 8 + sizeof(header), er->ecm, er->ecmlen);
	ecmbuf[4] = er->caid >> 8;

	client->reader->msg_idx = er->idx;
	n = send(client->pfd, ecmbuf, er->ecmlen + 30, 0);

	cs_debug_mask(D_TRACE, "radegast: sending ecm");
	cs_ddump_mask(D_CLIENT, ecmbuf, er->ecmlen + 30, "ecm:");
	NULLFREE(ecmbuf);
	return ((n < 1) ? (-1) : 0);
}
开发者ID:jackuzzy,项目名称:oscam_private,代码行数:45,代码来源:module-radegast.c

示例11: scam_generate_deskey

static void scam_generate_deskey(char *keyString, uint8_t *desKey)
{
	uint8_t iv[8], *tmpKey;
	int32_t i, passLen, alignedPassLen;
	uint32_t key_schedule[32];
	
	memset(iv, 0, 8);
	memset(desKey, 0, 8);
	
	passLen = keyString == NULL ? 0 : strlen(keyString);
	if(passLen > 1024) {
		passLen = 1024;
	}

	alignedPassLen = (passLen + 7) & -8;
	if(alignedPassLen == 0) alignedPassLen = 8;
		
	if(!cs_malloc(&tmpKey, alignedPassLen)) {
		return;
	}

	if(passLen == 0) {
		memset(tmpKey, 0xAA, 8);
		passLen = 8;
	}
	else {
		memcpy(tmpKey, keyString, passLen);
	}
	
	for(i=0; i<alignedPassLen-passLen; i++) {
		tmpKey[passLen+i] = (uint8_t)i;
	}

	xxor(desKey,8,tmpKey,iv);	
	
	for(i=0; i<alignedPassLen; i+=8) {
		des_set_key(&tmpKey[i], key_schedule);
		des(&tmpKey[i], key_schedule, 1);
		xxor(desKey,8,desKey,&tmpKey[i]);
	}
	
	NULLFREE(tmpKey);
}
开发者ID:FFTEAM,项目名称:oscam,代码行数:43,代码来源:module-scam.c

示例12: cacheex_cleanup_hitcache

void cacheex_cleanup_hitcache(bool force)
{
	CACHE_HIT *cachehit;
	node *i,*i_next;
	struct timeb now;
	int64_t gone, gone_max_hitcache_time;
	int32_t timeout = (cfg.max_hitcache_time + (cfg.max_hitcache_time / 2)) * 1000; // 1,5
	int32_t clean_grp = (cfg.max_hitcache_time * 1000);

	SAFE_RWLOCK_WRLOCK(&hitcache_lock);
	i = get_first_node_list(&ll_hitcache);
	while (i)
	{
		i_next = i->next;
		cachehit = get_data_from_node(i);

		if(!cachehit)
		{
			i = i_next;
			continue;
		}

		cs_ftime(&now);
		gone = comp_timeb(&now, &cachehit->time);
		gone_max_hitcache_time = comp_timeb(&now, &cachehit->max_hitcache_time);

		if(force || gone>timeout)
		{
			remove_elem_list(&ll_hitcache, &cachehit->ll_node);
			remove_elem_hash_table(&ht_hitcache, &cachehit->ht_node);
			NULLFREE(cachehit);
		}
		else if(gone_max_hitcache_time >= clean_grp){
			cachehit->grp = cachehit->grp_last_max_hitcache_time;
			cachehit->grp_last_max_hitcache_time = 0;
			cs_ftime(&cachehit->max_hitcache_time);
		}
		i = i_next;
	}
	SAFE_RWLOCK_UNLOCK(&hitcache_lock);
}
开发者ID:nx111,项目名称:oscam-nx111,代码行数:41,代码来源:module-cacheex.c

示例13: chk_cltab

void chk_cltab(char *classasc, CLASSTAB *clstab)
{
	int32_t max_an = 0, max_bn = 0;
	char *ptr1, *saveptr1 = NULL, *classasc_org;
	CLASSTAB newclstab, oldclstab;
	memset(&newclstab, 0, sizeof(newclstab));
	newclstab.an = newclstab.bn = 0;
	
	if(!cs_malloc(&classasc_org, sizeof(char)*strlen(classasc)+1))
		{ return; }
	
	cs_strncpy(classasc_org, classasc, sizeof(char)*strlen(classasc)+1);
	
	for(ptr1 = strtok_r(classasc, ",", &saveptr1); ptr1; ptr1 = strtok_r(NULL, ",", &saveptr1))
	{
		ptr1 = trim(ptr1);
		if(ptr1[0] == '!')
			{ max_bn++; }
		else
			{ max_an++; }
	}

	if(max_an && !cs_malloc(&newclstab.aclass, sizeof(uchar)*max_an))
		{ NULLFREE(classasc_org); return; }	

	if(max_bn && !cs_malloc(&newclstab.bclass, sizeof(uchar)*max_bn))
		{ NULLFREE(newclstab.aclass); NULLFREE(classasc_org); return; }	
	
	classasc = classasc_org;

	for(ptr1 = strtok_r(classasc, ",", &saveptr1); ptr1; ptr1 = strtok_r(NULL, ",", &saveptr1))
	{
		ptr1 = trim(ptr1);
		if(ptr1[0] == '!')
			{ newclstab.bclass[newclstab.bn++] = (uchar)a2i(ptr1 + 1, 2); }
		else
			{ newclstab.aclass[newclstab.an++] = (uchar)a2i(ptr1, 2); }
	}
	
	NULLFREE(classasc_org);
	
	memcpy(&oldclstab, clstab, sizeof(CLASSTAB));
	memcpy(clstab, &newclstab, sizeof(CLASSTAB));
	
	NULLFREE(oldclstab.aclass);
	NULLFREE(oldclstab.bclass);
}
开发者ID:FFTEAM,项目名称:oscam,代码行数:47,代码来源:oscam-conf-chk.c

示例14: check_cacheex_filter

/****  INCOMING FILTER CHECK ***/
uint8_t check_cacheex_filter(struct s_client *cl, ECM_REQUEST *er)
{

	if(check_client(cl) && cl->typ == 'p' && cl->reader && cl->reader->cacheex.mode==2
			&& (!cl->reader->cacheex.drop_csp || checkECMD5(er))                              //cacheex_drop_csp-check
			&& chk_ctab(er->caid, &cl->reader->ctab)  			                              //Caid-check
			&& (!checkECMD5(er) || chk_ident_filter(er->caid, er->prid, &cl->reader->ftab))	  //Ident-check (not for csp: prid=0 always!)
			&& chk_srvid(cl, er) 								                              //Service-check
	  )
		{ return 1; }

	if(check_client(cl) && cl->typ == 'c' && cl->account && cl->account->cacheex.mode==3
			&& (!cl->account->cacheex.drop_csp || checkECMD5(er))                    //cacheex_drop_csp-check
			&& chk_ctab(er->caid, &cl->ctab)                                         //Caid-check
			&& (!checkECMD5(er) || chk_ident_filter(er->caid, er->prid, &cl->ftab))	 //Ident-check (not for csp: prid=0 always!)
			&& chk_srvid(cl, er)                                                     //Service-check
	  )
		{ return 1; }

	NULLFREE(er);
	return 0;
}
开发者ID:berny6969,项目名称:oscam-svn,代码行数:23,代码来源:module-cacheex.c

示例15: cs_write_log_int

static void cs_write_log_int(char *txt)
{
	if(exit_oscam == 1)
	{
		cs_write_log(txt, 1);
	}
	else
	{
		char *newtxt = cs_strdup(txt);
		if(!newtxt)
			{ return; }
		struct s_log *log;
		if(!cs_malloc(&log, sizeof(struct s_log)))
		{
			NULLFREE(newtxt);
			return;
		}
		log->txt = newtxt;
		log->header_len = 0;
		log->direct_log = 1;
		log_list_add(log);
	}
}
开发者ID:jackuzzy,项目名称:oscam_private,代码行数:23,代码来源:oscam-log.c


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