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

C++ NULLFREE函数代码示例

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

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



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


示例16: cardreader_do_checkhealth

int32_t cardreader_do_checkhealth(struct s_reader *reader)
{
	struct s_client *cl = reader->client;
	if(reader_card_inserted(reader))
	{
		if(reader->card_status == NO_CARD || reader->card_status == UNKNOWN)
		{
			rdr_log(reader, "card detected");
			led_status_card_detected();
			reader->card_status = CARD_NEED_INIT;
			add_job(cl, ACTION_READER_RESET, NULL, 0);
		}
	}
	else
	{
		rdr_log_dbg(reader, D_READER, "%s: !reader_card_inserted", __func__);
		if(reader->card_status == CARD_INSERTED || reader->card_status == CARD_NEED_INIT)
		{
			rdr_log(reader, "card ejected");
			reader_nullcard(reader);
			if(reader->csystem && reader->csystem->card_done)
				reader->csystem->card_done(reader);
			NULLFREE(reader->csystem_data);
			if(cl)
			{
				cl->lastemm = 0;
				cl->lastecm = 0;
			}
			led_status_card_ejected();
		}
		reader->card_status = NO_CARD;
	}
	rdr_log_dbg(reader, D_READER, "%s: reader->card_status = %d, ret = %d", __func__,
				   reader->card_status, reader->card_status == CARD_INSERTED);
	return reader->card_status == CARD_INSERTED;
}
开发者ID:FFTEAM,项目名称:oscam,代码行数:36,代码来源:reader-common.c


示例17: cacheex_cwcheck_tab_fn

void cacheex_cwcheck_tab_fn(const char *token, char *value, void *setting, FILE *f)
{
	CWCHECKTAB *cacheex_value_table = setting;
	if(value)
	{
		if(strlen(value) == 0)
		{
			cacheex_value_table->cwchecknum = 0;
			NULLFREE(cacheex_value_table->cwcheckdata);
		}
		else
		{
			chk_cacheex_cwcheck_valuetab(value, cacheex_value_table);
		}
		return;
	}

	if(cacheex_value_table->cwchecknum || cfg.http_full_cfg)
	{
		value = mk_t_cacheex_cwcheck_valuetab(cacheex_value_table);
		fprintf_conf(f, token, "%s\n", value);
		free_mk_t(value);
	}
}
开发者ID:Uukrull,项目名称:OSCam,代码行数:24,代码来源:oscam-config-global.c


示例18: config_list_parse

int config_list_parse(const struct config_list *clist, const char *token, char *value, void *config_data)
{
	const struct config_list *c;
	for(c = clist; c->opt_type != OPT_UNKNOWN; c++)
	{
		if(c->opt_type == OPT_SAVE_FUNC || c->opt_type == OPT_FIXUP_FUNC)
			{ continue; }
		if(strcasecmp(token, c->config_name) != 0)
			{ continue; }
		void *var = config_data + c->var_offset;
		switch(c->opt_type)
		{
		case OPT_INT8:
		{
			*(int8_t *)var = (int8_t)strToIntVal(value, c->def.d_int8);
			return 1;
		}
		case OPT_UINT8:
		{
			uint32_t tmp = strToUIntVal(value, c->def.d_uint8);
			*(uint8_t *)var = (uint8_t)(tmp <= 0xff ? tmp : 0xff);
			return 1;
		}
		case OPT_INT32:
		{
			int32_t tmp = strToIntVal(value, c->def.d_int32);
			memcpy(var, &tmp, sizeof(int32_t));
			return 1;
		}
		case OPT_UINT32:
		{
			uint32_t tmp = strToUIntVal(value, c->def.d_uint32);
			memcpy(var, &tmp, sizeof(uint32_t));
			return 1;
		}
		case OPT_STRING:
		{
			char **scfg = var;
			if(c->def.d_char && strlen(value) == 0)  // Set default
				{ value = c->def.d_char; }
			NULLFREE(*scfg);
			if(strlen(value))
				{ *scfg = cs_strdup(value); }
			return 1;
		}
		case OPT_SSTRING:
		{
			char *scfg = var;
			if(c->def.d_char && strlen(value) == 0)  // Set default
				{ value = c->def.d_char; }
			scfg[0] = '\0';
			unsigned int len = strlen(value);
			if(len)
			{
				strncpy(scfg, value, c->str_size - 1);
				if(len > c->str_size)
				{
					fprintf(stderr, "WARNING: Config value for '%s' (%s, len=%u) exceeds max length: %d (%s)\n",
							token, value, len, c->str_size - 1, scfg);
				}
			}
			return 1;
		}
		case OPT_HEX_ARRAY:
		{
			uint8_t *hex_array = var;
			if(!strlen(value))
				{ memset(hex_array, 0, c->def.array_size); }
			else if(key_atob_l(value, hex_array, c->def.array_size * 2))
			{
				memset(hex_array, 0, c->def.array_size);
				fprintf(stderr, "WARNING: Config value for '%s' (%s, len=%zu) requires %d chars.\n",
						token, value, strlen(value), c->def.array_size * 2);
			}
			return 1;
		}
		case OPT_FUNC:
		{
			c->ops.process_fn(token, value, var, NULL);
			return 1;
		}
		case OPT_FUNC_EXTRA:
		{
			c->ops.process_fn_extra(token, value, var, c->def.d_extra, NULL);
			return 1;
		}
		case OPT_FIXUP_FUNC:
		case OPT_SAVE_FUNC:
			return 1;
		case OPT_UNKNOWN:
		{
			fprintf(stderr, "Unknown config type (%s = %s).", token, value);
			break;
		}
		}
	}
	return 0;
}
开发者ID:FFTEAM,项目名称:oscam-modern,代码行数:98,代码来源:oscam-conf.c


示例19: set_thread_name

static void *chkcache_process(void)
{
    set_thread_name(__func__);

    time_t timeout;
    struct ecm_request_t *er, *ecm;
#ifdef CS_CACHEEX
    uint8_t add_hitcache_er;
    struct s_reader *cl_rdr;
    struct s_reader *rdr;
    struct s_ecm_answer *ea;
    struct s_client *cex_src=NULL;
#endif
    struct s_write_from_cache *wfc=NULL;

    while(1)
    {
        cs_readlock(&ecmcache_lock);
        for(er = ecmcwcache; er; er = er->next)
        {
            timeout = time(NULL)-((cfg.ctimeout+500)/1000+1);
            if(er->tps.time < timeout)
            {
                break;
            }

            if(er->rc<E_UNHANDLED || er->readers_timeout_check)  //already answered
            {
                continue;
            }

            //********  CHECK IF FOUND ECM IN CACHE
            ecm = check_cache(er, er->client);
            if(ecm)     //found in cache
            {

#ifdef CS_CACHEEX
                //check for add_hitcache
                if(ecm->cacheex_src)   //cw from cacheex
                {
                    if((er->cacheex_wait_time && !er->cacheex_wait_time_expired) || !er->cacheex_wait_time)   //only when no wait_time expires (or not wait_time)
                    {

                        //add_hitcache already called, but we check if we have to call it for these (er) caid|prid|srvid
                        if(ecm->prid!=er->prid || ecm->srvid!=er->srvid)
                        {
                            cex_src = ecm->cacheex_src && is_valid_client(ecm->cacheex_src) && !ecm->cacheex_src->kill ?  ecm->cacheex_src : NULL; //here we should be sure cex client has not been freed!
                            if(cex_src) { //add_hitcache only if client is really active
                                add_hitcache_er=1;
                                cl_rdr = cex_src->reader;
                                if(cl_rdr && cl_rdr->cacheex.mode == 2)
                                {
                                    for(ea = er->matching_rdr; ea; ea = ea->next)
                                    {
                                        rdr = ea->reader;
                                        if(cl_rdr == rdr && ((ea->status & REQUEST_ANSWERED) == REQUEST_ANSWERED))
                                        {
                                            cs_debug_mask(D_CACHEEX|D_CSP|D_LB,"{client %s, caid %04X, prid %06X, srvid %04X} [CACHEEX] skip ADD self request!", (check_client(er->client)?er->client->account->usr:"-"),er->caid, er->prid, er->srvid);
                                            add_hitcache_er=0; //don't add hit cache, reader requested self
                                        }
                                    }
                                }

                                if(add_hitcache_er)
                                {
                                    add_hitcache(cex_src, er);    //USE cacheex client (to get correct group) and ecm from requesting client (to get correct caid|prid|srvid)!!!
                                }
                            }
                        }

                    }
                    else
                    {
                        //add_hitcache already called, but we have to remove it because cacheex not coming before wait_time
                        if(ecm->prid==er->prid && ecm->srvid==er->srvid)
                        {
                            del_hitcache(ecm);
                        }
                    }
                }
                //END check for add_hitcache
#endif

                if(check_client(er->client))
                {

                    wfc=NULL;
                    if(!cs_malloc(&wfc, sizeof(struct s_write_from_cache)))
                    {
                        NULLFREE(ecm);
                        continue;
                    }

                    wfc->er_new=er;
                    wfc->er_cache=ecm;

                    if(!add_job(er->client, ACTION_ECM_ANSWER_CACHE, wfc, sizeof(struct s_write_from_cache)))   //write_ecm_answer_fromcache
                    {
                        NULLFREE(ecm);
                        continue;
//.........这里部分代码省略.........
开发者ID:BATYD-Turksat,项目名称:oscam,代码行数:101,代码来源:module-cacheex.c


示例20: dvbapi_load_channel_cache

void dvbapi_load_channel_cache(void)
{
	if (USE_OPENXCAS) // Why?
		return;

	char fname[256];
	char line[1024];
	FILE *file;
	struct s_channel_cache *c;

	get_config_filename(fname, sizeof(fname), "oscam.ccache");
	file = fopen(fname, "r");
	if(!file)
	{
		cs_log("dvbapi channelcache can't read from file %s", fname);
		return;
	}

	int32_t i = 1;
	int32_t valid = 0;
	char *ptr, *saveptr1 = NULL;
	char *split[6];

	memset(line, 0, sizeof(line));
	while(fgets(line, sizeof(line), file))
	{
		if(!line[0] || line[0] == '#' || line[0] == ';')
			{ continue; }

		for(i = 0, ptr = strtok_r(line, ",", &saveptr1); ptr && i < 6 ; ptr = strtok_r(NULL, ",", &saveptr1), i++)
		{
			split[i] = ptr;
		}

		valid = (i == 5);
		if(valid)
		{
			if(!cs_malloc(&c, sizeof(struct s_channel_cache)))
			{ continue; }
			c->caid = a2i(split[0], 4);
			c->prid = a2i(split[1], 6);
			c->srvid = a2i(split[2], 4);
			c->pid = a2i(split[3], 4);
			c->chid = a2i(split[4], 6);

			if(valid && c->caid != 0)
			{
				if(!channel_cache)
				{
					channel_cache = ll_create("channel cache");
				}

				ll_append(channel_cache, c);
			}
			else
			{
				NULLFREE(c);
			}
		}
	}
	fclose(file);
	cs_log("dvbapi channelcache loaded from %s", fname);
}
开发者ID:FFTEAM,项目名称:oscam-modern,代码行数:63,代码来源:module-dvbapi-chancache.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NULLP函数代码示例发布时间:2022-05-30
下一篇:
C++ NT_SUCCESS函数代码示例发布时间: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