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


C++ MFREE函数代码示例

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


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

示例1: mpolunit

void mpolunit(MPOL *p, MINT *coef, MPOL *q)
{ 
  register i;
  MINT *resco,rem;
  MPOL res;


  if (p->nterms==0) {
	mpolfree(q);
	mset(0,coef);
	return;
  };
  
  MINIT(&rem);
  MFREE(coef);
  MCOPY(&(p->coefs[0]),coef);
  for (i=1;i<p->nterms;i++)
	mgcd(coef,&(p->coefs[i]),coef);

  MPOLINIT(&res);

  res.nterms = p->nterms;
  POL_ALLOC(&res,p->nterms); 
  resco = res.coefs;
  for (i=0;i<p->nterms;i++){
	MINIT(resco);
	mdiv(&(p->coefs[i]),coef,(resco++),&rem);
	expocopy(MEXPO(p,i),MEXPO(&res,i));
  }
  mpolfree(q);
  MPOLMOVEFREE(&res,q);
  MFREE(&rem);
}
开发者ID:8l,项目名称:csolve,代码行数:33,代码来源:MPolUnit.c

示例2: si_gpio_handler_unregister

void
si_gpio_handler_unregister(si_t *sih, void *gpioh)
{
	si_info_t *sii;
	gpioh_item_t *p, *n;

	sii = SI_INFO(sih);
	if (sih->ccrev < 11)
		return;

	ASSERT(sii->gpioh_head != NULL);
	if ((void*)sii->gpioh_head == gpioh) {
		sii->gpioh_head = sii->gpioh_head->next;
		MFREE(sii->osh, gpioh, sizeof(gpioh_item_t));
		return;
	} else {
		p = sii->gpioh_head;
		n = p->next;
		while (n) {
			if ((void*)n == gpioh) {
				p->next = n->next;
				MFREE(sii->osh, gpioh, sizeof(gpioh_item_t));
				return;
			}
			p = n;
			n = n->next;
		}
	}

	ASSERT(0); /* Not found in list */
}
开发者ID:AKToronto,项目名称:htc-kernel-msm7227,代码行数:31,代码来源:siutils.c

示例3: osl_timer

static void
osl_timer(ulong data)
{
	osl_timer_t *t;

	t = (osl_timer_t *)data;

	ASSERT(t->set);

	if (t->periodic) {
#if defined(BCMJTAG) || defined(BCMSLTGT)
		t->timer.expires = jiffies + t->ms*HZ/1000*htclkratio;
#else
		t->timer.expires = jiffies + t->ms*HZ/1000;
#endif /* defined(BCMJTAG) || defined(BCMSLTGT) */
		add_timer(&t->timer);
		t->set = TRUE;
		t->fn(t->arg);
	} else {
		t->set = FALSE;
		t->fn(t->arg);
#ifdef BCMDBG
		if (t->name) {
			MFREE(NULL, t->name, strlen(t->name) + 1);
		}
#endif
		MFREE(NULL, t, sizeof(osl_timer_t));
	}

	return;
}
开发者ID:hello--world,项目名称:hiwifi-openwrt-HC5661-HC5761,代码行数:31,代码来源:osl_linux.c

示例4: BCMATTACHFN

/*
 * bcm_mpm_deinit() - de-initialize the whole memory pool system. This should only
 *                    be called after all memory pooled have been deleted.
 *
 * Parameters:
 *    mgr:     INPUT  Pointer to pool manager handle.
 *
 * Returns:
 *    BCME_OK  Memory pool manager successfully de-initialized.
 *    other    Indicated error occured during de-initialization.
 */
int BCMATTACHFN(bcm_mpm_deinit)(bcm_mpm_mgr_h *mgrp)
{
	bcm_mpm_mgr_h mgr;
	osl_t         *osh;

	/* Check parameters */
	if ((mgrp == NULL) || (*mgrp == NULL)) {
		return (BCME_BADARG);
	}

	mgr = *mgrp;
	osh = mgr->osh;

	/* Verify that all memory pools have been deleted. */
	if (mgr->npools != 0) {
		MPOOL_ERROR(("ERROR: %s: memory leak - npools(%d)\n",
		             __FUNCTION__, mgr->npools));

		return (BCME_BUSY);
	}

	/* Free the pre-allocated pool meta-data (bcm_mp_pool structs). */
	MFREE(osh, mgr->pool_objs, mgr->max_pools * sizeof(bcm_mp_pool_t));


	/* Free memory pool manager object. */
	MFREE(osh, mgr, sizeof(*mgr));

	*mgrp = NULL;
	return (BCME_OK);
}
开发者ID:jameshilliard,项目名称:broadcom-hnd,代码行数:42,代码来源:bcm_mpool.c

示例5: si_detach

/* may be called with core in reset */
void
si_detach(si_t *sih)
{
	si_info_t *sii;
	uint idx;

	sii = SI_INFO(sih);

	if (sii == NULL)
		return;

	if (BUSTYPE(sih->bustype) == SI_BUS)
		for (idx = 0; idx < SI_MAXCORES; idx++)
			if (sii->common_info->regs[idx]) {
				REG_UNMAP(sii->common_info->regs[idx]);
				sii->common_info->regs[idx] = NULL;
			}


	if (1 == sii->common_info->attach_count--) {
		MFREE(sii->osh, sii->common_info, sizeof(si_common_info_t));
		common_info_alloced = NULL;
	}

#if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS)
	if (sii != &ksii)
#endif	/* !BCMBUSTYPE || (BCMBUSTYPE == SI_BUS) */
		MFREE(sii->osh, sii, sizeof(si_info_t));
}
开发者ID:AKToronto,项目名称:htc-kernel-msm7227,代码行数:30,代码来源:siutils.c

示例6: emf_module_init

/*
 * Description: This function is called during module load time. It
 *              opens communication channel to configure and start EMF.
 */
static int32 __init
emf_module_init(void)
{
	EMF_DEBUG("Loading EMF\n");

	/* Allocate EMF global data object */
	emf = MALLOC(NULL, sizeof(emf_struct_t));
	if (emf == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_info\n");
		return (FAILURE);
	}

	memset(emf, 0, sizeof(emf_struct_t));

	/* Create a Netlink socket in kernel-space */
#define NETLINK_EMFC 17
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, 0, emf_netlink_sock_cb,
	                                   NULL, THIS_MODULE);
#else
	emf->nl_sk = netlink_kernel_create(NETLINK_EMFC, emf_netlink_sock_cb);
#endif

	if (emf->nl_sk == NULL)
	{
		EMF_ERROR("Netlink kernel socket create failed\n");
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	emf->lock = OSL_LOCK_CREATE("EMF Instance List");

	if (emf->lock == NULL)
	{
		EMF_ERROR("EMF instance list lock create failed\n");
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
		sock_release(emf->nl_sk->sk_socket);
#else
		sock_release(emf->nl_sk->socket);
#endif
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	/* Call the common code global init function */
	if (emfc_module_init() != SUCCESS)
	{
		OSL_LOCK_DESTROY(emf->lock);
		MFREE(NULL, emf, sizeof(emf_struct_t));
		return (FAILURE);
	}

	EMF_DEBUG("EMF Init done\n");

	return (SUCCESS);
}
开发者ID:BackupGGCode,项目名称:wl500g,代码行数:61,代码来源:emf_linux.c

示例7: emf_stats_get

/*
 * EMFL Packet Counters/Statistics
 */
static int32
emf_stats_get(char *buf, char **start, off_t offset, int32 size,
              int32 *eof, void *data)
{
	emf_info_t *emfi = (emf_info_t *)data;
	emf_cfg_request_t *cfg;
	emf_stats_t *emfs;
	struct bcmstrbuf b;

	ASSERT(emfi);

	cfg = MALLOC(emfi->osh, sizeof(emf_cfg_request_t));
	if (cfg == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_cfg_request\n");
		return (FAILURE);
	}

	cfg->command_id = EMFCFG_CMD_EMF_STATS;
	cfg->oper_type = EMFCFG_OPER_TYPE_GET;
	cfg->size = sizeof(emf_stats_t);
	emfs = (emf_stats_t *)cfg->arg;

	emfc_cfg_request_process(emfi->emfci, cfg);
	if (cfg->status != EMFCFG_STATUS_SUCCESS)
	{
		EMF_ERROR("Unable to get the EMF stats\n");
		MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "McastDataPkts   McastDataFwd    McastFlooded    "
		    "McastDataSentUp McastDataDropped\n");
	bcm_bprintf(&b, "%-15d %-15d %-15d %-15d %d\n",
	            emfs->mcast_data_frames, emfs->mcast_data_fwd,
	            emfs->mcast_data_flooded, emfs->mcast_data_sentup,
	            emfs->mcast_data_dropped);
	bcm_bprintf(&b, "IgmpPkts        IgmpPktsFwd     "
		    "IgmpPktsSentUp  MFDBCacheHits   MFDBCacheMisses\n");
	bcm_bprintf(&b, "%-15d %-15d %-15d %-15d %d\n",
	            emfs->igmp_frames, emfs->igmp_frames_fwd,
	            emfs->igmp_frames_sentup, emfs->mfdb_cache_hits,
	            emfs->mfdb_cache_misses);
	MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));

	if (b.size == 0)
	{
		EMF_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:57,代码来源:emf_linux.c

示例8: igs_sdb_list

static int32
igs_sdb_list(char *buf, char **start, off_t offset, int32 size,
             int32 *eof, void *data)
{
	igs_info_t *igs_info = (igs_info_t *)data;
	igs_cfg_request_t *cfg;
	igs_cfg_sdb_list_t *list;
	int32 i;
	struct bcmstrbuf b;

	ASSERT(igs_info);

	cfg = MALLOC(igs_info->osh, sizeof(igs_cfg_request_t));
	if (cfg == NULL)
	{
		IGS_ERROR("Out of memory allocating igs_cfg_request\n");
		return (FAILURE);
	}

	strcpy(cfg->inst_id, igs_info->inst_id);
	cfg->command_id = IGSCFG_CMD_IGSDB_LIST;
	cfg->oper_type = IGSCFG_OPER_TYPE_GET;
	cfg->size = sizeof(cfg->arg);
	list = (igs_cfg_sdb_list_t *)cfg->arg;

	igsc_cfg_request_process(igs_info->igsc_info, cfg);
	if (cfg->status != IGSCFG_STATUS_SUCCESS)
	{
		IGS_ERROR("Unable to get the IGSDB list\n");
		MFREE(igs_info->osh, cfg, sizeof(igs_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "Group           Members         Interface\n");

	for (i = 0; i < list->num_entries; i++)
	{
		bcm_bprintf(&b, "%08x        ", list->sdb_entry[i].mgrp_ip);
		bcm_bprintf(&b, "%08x        ", list->sdb_entry[i].mh_ip);
		bcm_bprintf(&b, "%s\n", list->sdb_entry[i].if_name);
	}
	MFREE(igs_info->osh, cfg, sizeof(igs_cfg_request_t));

	if (b.size == 0)
	{
		IGS_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:52,代码来源:igs_linux.c

示例9: emf_mfdb_list

static int32
emf_mfdb_list(char *buf, char **start, off_t offset, int32 size,
              int32 *eof, void *data)
{
	emf_info_t *emfi = (emf_info_t *)data;
	emf_cfg_request_t *cfg;
	struct bcmstrbuf b;
	emf_cfg_mfdb_list_t *list;
	int32 i;

	ASSERT(emfi);

	cfg = MALLOC(emfi->osh, sizeof(emf_cfg_request_t));
	if (cfg == NULL)
	{
		EMF_ERROR("Out of memory allocating emf_cfg_request\n");
		return (FAILURE);
	}

	cfg->command_id = EMFCFG_CMD_MFDB_LIST;
	cfg->oper_type = EMFCFG_OPER_TYPE_GET;
	cfg->size = sizeof(cfg->arg);
	list = (emf_cfg_mfdb_list_t *)cfg->arg;

	emfc_cfg_request_process(emfi->emfci, cfg);
	if (cfg->status != EMFCFG_STATUS_SUCCESS)
	{
		EMF_ERROR("Unable to get the MFDB list\n");
		MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));
		return (FAILURE);
	}

	bcm_binit(&b, buf, size);
	bcm_bprintf(&b, "Group           Interface      Pkts\n");

	for (i = 0; i < list->num_entries; i++)
	{
		bcm_bprintf(&b, "%08x        ", list->mfdb_entry[i].mgrp_ip);
		bcm_bprintf(&b, "%-15s", list->mfdb_entry[i].if_name);
		bcm_bprintf(&b, "%d\n", list->mfdb_entry[i].pkts_fwd);
	}
	MFREE(emfi->osh, cfg, sizeof(emf_cfg_request_t));

	if (b.size == 0)
	{
		EMF_ERROR("Input buffer overflow\n");
		return (FAILURE);
	}

	return (b.buf - b.origbuf);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:51,代码来源:emf_linux.c

示例10: free_read_info

void free_read_info(struct read_info** ri, int numseq)
{
	int i;
	
	for(i = 0; i < numseq;i++){
		if(ri[i]->cigar){
			MFREE(ri[i]->cigar);
		}
		
		if(ri[i]->md){
			MFREE(ri[i]->md);
		}
		
		if(ri[i]->labels){
			MFREE(ri[i]->labels);
		}
		if(ri[i]->name){
			MFREE(ri[i]->name);
		}
		
		if(ri[i]->seq){
			MFREE(ri[i]->seq);
		}
		if(ri[i]->qual){
			MFREE(ri[i]->qual );
		}
		
		MFREE(ri[i]);
	}
	MFREE(ri);
}
开发者ID:genetique,项目名称:samstat,代码行数:31,代码来源:io.c

示例11: bcmcache_destroy

/* Destroy all the objs in a cache, and release the mem back to the system.
 */
void
bcmcache_destroy(bcmcache_t *cachep)
{
	struct buffer *nextp;
	struct buffer *head;

	head = cachep->head;
	while (head) {
		nextp = head;
		head = head->next;
		MFREE(cachep->osh, nextp, sizeof(struct buffer) + cachep->obj_size);
	}

	MFREE(cachep->osh, cachep, sizeof(bcmcache_t));
}
开发者ID:ariavie,项目名称:bcm,代码行数:17,代码来源:bcmallocache.c

示例12: bcmsdh_probe

void* bcmsdh_probe(osl_t *osh, void *dev, void *sdioh, void *adapter_info, uint bus_type,
	uint bus_num, uint slot_num)
{
	uint32 regs;
	bcmsdh_info_t *bcmsdh;
	uint32 vendevid;
	bcmsdh_os_info_t *bcmsdh_osinfo = NULL;

	bcmsdh = bcmsdh_attach(osh, sdioh, &regs);
	if (bcmsdh == NULL) {
		SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
		goto err;
	}
	bcmsdh_osinfo = MALLOC(osh, sizeof(bcmsdh_os_info_t));
	if (bcmsdh_osinfo == NULL) {
		SDLX_MSG(("%s: failed to allocate bcmsdh_os_info_t\n", __FUNCTION__));
		goto err;
	}
	bzero((char *)bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
	bcmsdh->os_cxt = bcmsdh_osinfo;
	bcmsdh_osinfo->sdioh = sdioh;
	bcmsdh_osinfo->dev = dev;
	osl_set_bus_handle(osh, bcmsdh);

#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))
	if (dev && device_init_wakeup(dev, true) == 0)
		bcmsdh_osinfo->dev_wake_enabled = TRUE;
#endif /* !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)) */

#if defined(OOB_INTR_ONLY)
	spin_lock_init(&bcmsdh_osinfo->oob_irq_spinlock);
	/* Get customer specific OOB IRQ parametres: IRQ number as IRQ type */
	bcmsdh_osinfo->oob_irq_num = wifi_platform_get_irq_number(adapter_info,
		&bcmsdh_osinfo->oob_irq_flags);
	if  (bcmsdh_osinfo->oob_irq_num < 0) {
		SDLX_MSG(("%s: Host OOB irq is not defined\n", __FUNCTION__));
		goto err;
	}
#endif /* defined(BCMLXSDMMC) */

	/* Read the vendor/device ID from the CIS */
	vendevid = bcmsdh_query_device(bcmsdh);
	/* try to attach to the target device */
	bcmsdh_osinfo->context = drvinfo.probe((vendevid >> 16), (vendevid & 0xFFFF), bus_num,
		slot_num, 0, bus_type, (void *)regs, osh, bcmsdh);
	if (bcmsdh_osinfo->context == NULL) {
		SDLX_MSG(("%s: device attach failed\n", __FUNCTION__));
		goto err;
	}

	return bcmsdh;

	/* error handling */
err:
	if (bcmsdh != NULL)
		bcmsdh_detach(osh, bcmsdh);
	if (bcmsdh_osinfo != NULL)
		MFREE(osh, bcmsdh_osinfo, sizeof(bcmsdh_os_info_t));
	return NULL;
}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:60,代码来源:bcmsdh_linux.c

示例13: initvars_flash_sb

/*
 * Initialize nonvolatile variable table from flash.
 * Return 0 on success, nonzero on error.
 */
static int
initvars_flash_sb(void *sbh, char **vars, uint *count)
{
	osl_t *osh = sb_osh(sbh);
	char devpath[SB_DEVPATH_BUFSZ];
	char *vp, *base;
	int err;

	ASSERT(vars);
	ASSERT(count);

	if ((err = sb_devpath(sbh, devpath, sizeof(devpath))))
		return err;

	base = vp = MALLOC(osh, VARS_MAX);
	ASSERT(vp);
	if (!vp)
		return BCME_NOMEM;

	if ((err = initvars_flash(osh, &vp, VARS_MAX, devpath)))
		goto err;

	err = initvars_table(osh, base, vp, vars, count);

err:	MFREE(osh, base, VARS_MAX);
	return err;
}
开发者ID:anchowee,项目名称:linino,代码行数:31,代码来源:bcmsrom.c

示例14: rpc_osl_detach

void
rpc_osl_detach(rpc_osl_t *rpc_osh)
{
	if (rpc_osh) {
		MFREE(rpc_osh->osh, rpc_osh, sizeof(rpc_osl_t));
	}
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:7,代码来源:linux_rpc_osl.c

示例15: testcrc32

void testcrc32(void)
{
	uint j,k,l;
	uint8 *buf;
	uint len[CNBUFS];
	uint32 crcr;
	uint32 crc32tv[CNBUFS] =
		{0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};

	ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL);

	/* step through all possible alignments */
	for (l=0;l<=4;l++) {
		for (j=0; j<CNBUFS; j++) {
			len[j] = CLEN;
			for (k=0; k<len[j]; k++)
				*(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff;
		}

		for (j=0; j<CNBUFS; j++) {
			crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE);
			ASSERT(crcr == crc32tv[j]);
		}
	}

	MFREE(buf, CBUFSIZ*CNBUFS);
	return;
}
开发者ID:12019,项目名称:hg556a_source,代码行数:28,代码来源:bcmutils.c


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