您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GDKfree函数代码示例

51自学网 2021-06-01 20:50:13
  C++
这篇教程C++ GDKfree函数代码示例写得很实用,希望能帮到您。

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

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

示例1: CLKsignal

static voidCLKsignal(int nr){	/* int restype; */	int k = timerTop;	int t;	(void) nr;	if (signal(SIGALRM, CLKsignal) == SIG_ERR) {		GDKsyserror("CLKsignal: call failed/n");	}	if (timerTop == 0) {		return;	}	t = time(0);	while (k-- && t >= timer[k].alarm_time) {		if (timer[k].action) {			/* monet_eval(timer[k].action, &restype); */			GDKfree(timer[k].action);		} else {			MT_sema_up(&timer[k].sema, "CLKsignal");		}		timerTop--;	}	if (timerTop > 0) {		alarm(timer[timerTop - 1].alarm_time - time(0));	}}
开发者ID:jaiminpan,项目名称:Monetdb,代码行数:30,


示例2: MSresetVariables

/* * Determine the variables being used and clear non-used onces. */voidMSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start){	int i;	bit *used = GDKzalloc(mb->vtop * sizeof(bit));	if( used == NULL){		GDKerror("MSresetVariables" MAL_MALLOC_FAIL);		return;	}	for (i = 0; i < start && start < mb->vtop; i++)		used[i] = 1;	if (mb->errors == 0)		for (i = start; i < mb->vtop; i++) {			if (used[i] || !isTmpVar(mb, i)) {				assert(!mb->var[i]->value.vtype || isVarConstant(mb, i));				used[i] = 1;			}			if (glb && !used[i]) {				if (isVarConstant(mb, i))					garbageElement(cntxt, &glb->stk[i]);				/* clean stack entry */				glb->stk[i].vtype = TYPE_int;				glb->stk[i].len = 0;				glb->stk[i].val.pval = 0;			}		}	if (mb->errors == 0)		trimMalVariables_(mb, used, glb);	GDKfree(used);}
开发者ID:f7753,项目名称:monetdb,代码行数:35,


示例3: mal_client_reset

void mal_client_reset(void){	MAL_MAXCLIENTS = 0;	if (mal_clients)		GDKfree(mal_clients);}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:7,


示例4: MDBlifespan

/* * Display routines */strMDBlifespan(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){	Lifespan span;	str modnme;	str fcnnme;	Symbol s = NULL;	(void) cntxt;	if (stk != 0) {		modnme = *getArgReference_str(stk, p, 1);		fcnnme = *getArgReference_str(stk, p, 2);	} else {		modnme = getArgDefault(mb, p, 1);		fcnnme = getArgDefault(mb, p, 2);	}	s = findSymbol(cntxt->nspace, putName(modnme), putName(fcnnme));	if (s == NULL)		throw(MAL, "mdb.inspect", RUNTIME_SIGNATURE_MISSING);	span = setLifespan(s->def);	if( span == NULL)		throw(MAL,"mdb.inspect", MAL_MALLOC_FAIL);	debugLifespan(cntxt, s->def, span);	GDKfree(span);	(void) p;	(void) stk;	return MAL_SUCCEED;}
开发者ID:cswxu,项目名称:monetdb-mcs,代码行数:33,


示例5: mal2str

/* Remote execution of MAL calls for more type/property information to be exchanged */strmal2str(MalBlkPtr mb, int first, int last){	str ps = NULL, *txt;	int i, *len, totlen = 0;	txt = GDKmalloc(sizeof(str) * mb->stop);	len = GDKmalloc(sizeof(int) * mb->stop);	if( txt == NULL || len == NULL){		GDKerror("mal2str: " MAL_MALLOC_FAIL);		if( txt ) GDKfree(txt);		if( len ) GDKfree(len);		return NULL;	}	for (i = first; i < last; i++) {		if( i == 0)			txt[i] = instruction2str(mb, 0, getInstrPtr(mb, i), LIST_MAL_NAME | LIST_MAL_TYPE  | LIST_MAL_PROPS);		else			txt[i] = instruction2str(mb, 0, getInstrPtr(mb, i), LIST_MAL_CALL | LIST_MAL_PROPS | LIST_MAL_REMOTE);#ifdef _DEBUG_LISTING_		mnstr_printf(GDKout,"%s/n",txt[i]);#endif		if ( txt[i])			totlen += len[i] = (int)strlen(txt[i]);	}	ps = GDKmalloc(totlen + mb->stop + 1);	if( ps == NULL)		GDKerror("mal2str: " MAL_MALLOC_FAIL);	totlen = 0;	for (i = first; i < last; i++) {		if( txt[i]){			if( ps){				strncpy(ps + totlen, txt[i], len[i]);				ps[totlen + len[i]] = '/n';				ps[totlen + len[i] + 1] = 0;				totlen += len[i] + 1;			}			GDKfree(txt[i]);		}	}	GDKfree(len);	GDKfree(txt);	return ps;}
开发者ID:f7753,项目名称:monetdb,代码行数:48,


示例6: getAddress

/* Search for occurrence of the function in the library identified by the filename.  */MALfcngetAddress(str fcnname){	void *dl;	MALfcn adr;	int idx=0;	static int prev= -1;	/* First try the last module loaded */	if( prev >= 0){		adr = (MALfcn) dlsym(filesLoaded[prev].handle, fcnname);		if( adr != NULL)			return adr; /* found it */	}	/*	 * Search for occurrence of the function in any library already loaded.	 * This deals with the case that files are linked together to reduce	 * the loading time, while the signatures of the functions are still	 * obtained from the source-file MAL script.	 */	for (idx =0; idx < lastfile; idx++)		if (idx != prev &&		/* skip already searched module */			filesLoaded[idx].handle &&			(idx == 0 || filesLoaded[idx].handle != filesLoaded[0].handle)) {			adr = (MALfcn) dlsym(filesLoaded[idx].handle, fcnname);			if (adr != NULL)  {				prev = idx;				return adr; /* found it */			}		}	if (lastfile)		return NULL;	/*	 * Try the program libraries at large or run through all	 * loaded files and try to resolve the functionname again.	 *	 * the first argument must be the same as the base name of the	 * library that is created in src/tools */	dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL);	if (dl == NULL) 		return NULL;	adr = (MALfcn) dlsym(dl, fcnname);	filesLoaded[lastfile].modname = GDKstrdup("libmonetdb5");	if(filesLoaded[lastfile].modname == NULL) {		dlclose(dl);		return NULL;	}	filesLoaded[lastfile].fullname = GDKstrdup("libmonetdb5");	if(filesLoaded[lastfile].fullname == NULL) {		dlclose(dl);		GDKfree(filesLoaded[lastfile].modname);		return NULL;	}	filesLoaded[lastfile].handle = dl;	lastfile ++;	return adr;}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:60,


示例7: MCpopClientInput

voidMCpopClientInput(Client c){	ClientInput *x = c->bak;	if (c->fdin) {		/* missing protection against closing stdin stream */		(void) bstream_destroy(c->fdin);	}	GDKfree(c->prompt);	c->fdin = x->fdin;	c->yycur = x->yycur;	c->listing = x->listing;	c->prompt = x->prompt;	c->promptlength = strlen(c->prompt);	c->bak = x->next;	GDKfree(x);}
开发者ID:digideskio,项目名称:monetdb,代码行数:17,


示例8: MRcleanCloud

static voidMRcleanCloud(void){	int i;	MT_lock_set(&mal_contextLock, "mapreduce");	for (i = 0; mapnodes[i].uri; i++) {		if (mapnodes[i].uri != NULL)			GDKfree(mapnodes[i].uri);		if (mapnodes[i].user != NULL)			GDKfree(mapnodes[i].user);		if (mapnodes[i].pass != NULL)			GDKfree(mapnodes[i].pass);		mapnodes[i].uri = mapnodes[i].user = mapnodes[i].pass = 0;	}	MT_lock_unset(&mal_contextLock, "mapreduce");}
开发者ID:Clay-Birkett,项目名称:monetdb,代码行数:17,


示例9: JSONfilterInternal

static strJSONfilterInternal(json *ret, json *js, str *expr, str other){	pattern terms[MAXTERMS];	int tidx = 0;	JSON *jt;	str j = *js, msg = MAL_SUCCEED, s;	json result = 0;	size_t l;	(void) other;	if (strNil(j)) {		*ret = GDKstrdup(j);		return MAL_SUCCEED;	}	memset((char *) terms, 0, MAXTERMS * sizeof(pattern));	msg = JSONcompile(*expr, terms);	if (msg)		return msg;	jt = JSONparse(j, FALSE);	CHECK_JSON(jt);	result = s = JSONmatch(jt, 0, terms, tidx);	// process all other PATH expression	for (tidx++; tidx < MAXTERMS && terms[tidx].token; tidx++)		if (terms[tidx].token == END_STEP && tidx + 1 < MAXTERMS && terms[tidx + 1].token) {			s = JSONmatch(jt, 0, terms, ++tidx);			result = JSONglue(result, s, ',');		}	if (result) {		l = strlen(result);		if (result[l - 1] == ',')			result[l - 1] = 0;	} else		l = 3;	s = GDKzalloc(l + 3);	snprintf(s, l + 3, "[%s]", (result ? result : ""));	GDKfree(result);	for (l = 0; terms[l].token; l++)		if (terms[l].name)			GDKfree(terms[l].name);	JSONfree(jt);	*ret = s;	return msg;}
开发者ID:f7753,项目名称:monetdb,代码行数:46,


示例10: GROUPcollect

static AGGRtask*GROUPcollect( Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){	AGGRtask *a;	int i;	BAT *b, *bs, *bh = NULL;	BUN sample;	(void) mb;	(void) cntxt;	a= (AGGRtask *) GDKzalloc(sizeof(*a));	if ( a == NULL)		return NULL;	a->bid = (bat*) GDKzalloc(pci->argc * sizeof(bat));	a->cols = (BAT**) GDKzalloc(pci->argc * sizeof(BAT*));	a->unique = (BUN *) GDKzalloc(pci->argc * sizeof(BUN));	if ( a->cols == NULL || a->bid == NULL || a->unique == NULL){		if(a->cols) GDKfree(a->cols);		if(a->bid) GDKfree(a->bid);		if(a->unique) GDKfree(a->unique);		GDKfree(a);		return NULL;	}	for ( i= pci->retc; i< pci->argc; i++, a->last++) {		a->bid[a->last] = *getArgReference_bat(stk,pci,i);		b = a->cols[a->last]= BATdescriptor(a->bid[a->last]);		if ( a->cols[a->last] == NULL){			for(a->last--; a->last>=0; a->last--)				BBPunfix(a->cols[a->last]->batCacheid);			GDKfree(a->cols);			GDKfree(a->bid);			GDKfree(a->unique);			GDKfree(a);			return NULL;		}		sample = BATcount(b) < 1000 ? BATcount(b): 1000;		bs = BATsample( b, sample);		if (bs) {			bh = BATunique(b, bs);			if (bh) {				a->unique[a->last] = BATcount(bh);				BBPunfix(bh->batCacheid);			}			BBPunfix(bs->batCacheid);		}		if ( b->tsorted)			a->unique[a->last] = 1000; /* sorting helps grouping */		a->size = BATcount(b);	}#ifdef _DEBUG_GROUPBY_	for(i=0; i<a->last; i++)		fprintf(stderr,"#group %d unique "BUNFMT "/n", i, a->unique[i]);#endif	return a;}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:55,


示例11: VALclear

/* Clear V to an empty value (type void, value nil), freeing any * memory allocated for external types.  See VALempty for when V does * not yet contain a value. */voidVALclear(ValPtr v){	if (ATOMextern(v->vtype)) {		if (v->val.pval && v->val.pval != ATOMnilptr(v->vtype))			GDKfree(v->val.pval);	}	VALempty(v);}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:12,


示例12: OPTgroupsImplementation

intOPTgroupsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){	int i, actions=0;	InstrPtr q;	InstrPtr *old, *ref;	int limit,slimit;	(void) cntxt;	(void) stk;	if (varGetProp(mb, getArg(mb->stmt[0], 0), inlineProp) != NULL) {		return 0;	}	/* beware, new variables and instructions are introduced */	ref= (InstrPtr*) GDKzalloc(sizeof(InstrPtr) * mb->vtop); /* to find last assignment */	if ( ref == NULL) {		return 0;	}	old= mb->stmt;	limit= mb->stop;	slimit= mb->ssize;	if ( newMalBlkStmt(mb,mb->ssize) <0) {		GDKfree(ref);		return 0;	}	for (i = 0; i<limit; i++){		p= old[i];		if (getModuleId(p) == groupRef && p->argc == 4 && getFunctionId(p) == subgroupRef ){			setFunctionId(p, multicolumnsRef);			ref[getArg(p,0)] = p;			actions++;			OPTDEBUGgroups {				mnstr_printf(cntxt->fdout,"#new groups instruction/n");				printInstruction(cntxt->fdout,mb, 0, p, LIST_MAL_ALL);			}		}		if (getModuleId(p) == groupRef && p->argc == 5 && getFunctionId(p) == subgroupdoneRef && ref[getArg(p,4)] != NULL){			/*			 * Try to expand its argument list with what we have found so far.			 * This creates a series of derive paths, many of which will be removed during deadcode elimination.			 */			q= copyInstruction(ref[getArg(p,4)]);			q= pushArgument(mb, q, getArg(p,3));			getArg(q,0) = getArg(p,0);			getArg(q,1) = getArg(p,1);			getArg(q,2) = getArg(p,2);			ref[getArg(q,0)] = q;			freeInstruction(p);			p= q;			OPTDEBUGgroups{				mnstr_printf(cntxt->fdout,"#new groups instruction extension/n");				printInstruction(cntxt->fdout,mb, 0, p, LIST_MAL_ALL);			}		} 
开发者ID:Clay-Birkett,项目名称:monetdb,代码行数:57,


示例13: mal_linker_reset

/* * For analysis of memory leaks we should cleanup the libraries before * we exit the server. This does not involve the libraries themselves, * because they may still be in use. */voidmal_linker_reset(void){	int i;	MT_lock_set(&mal_contextLock);	for (i = 0; i < lastfile; i++){		if (filesLoaded[i].fullname) {			/* dlclose(filesLoaded[i].handle);*/			GDKfree(filesLoaded[i].modname);			GDKfree(filesLoaded[i].fullname);		}		filesLoaded[i].modname = NULL;		filesLoaded[i].fullname = NULL;	}	lastfile = 0;	MT_lock_unset(&mal_contextLock);}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:23,


示例14: freeStack

/* * When you add a value to the stack, you should ensure that * there is space left. It should only be used for global * stack frames, because the others are allocated in the * runtime stack. */voidfreeStack(MalStkPtr stk){	if (!stk) {		return;	}	clearStack(stk);	GDKfree(stk);}
开发者ID:cran,项目名称:MonetDBLite,代码行数:15,


示例15: VALclear

voidVALclear(ValPtr v){	if (v->vtype == TYPE_str || ATOMextern(v->vtype)) {		if (v->val.pval && v->val.pval != str_nil)			GDKfree(v->val.pval);	}	VALempty(v);}
开发者ID:Clay-Birkett,项目名称:monetdb,代码行数:9,


示例16: UDFBATreverse_

/* actual implementation */static char *UDFBATreverse_(BAT **ret, BAT *src){	BATiter li;	BAT *bn = NULL;	BUN p = 0, q = 0;	/* assert calling sanity */	assert(ret != NULL);	/* handle NULL pointer */	if (src == NULL)		throw(MAL, "batudf.reverse", RUNTIME_OBJECT_MISSING);	/* check tail type */	if (src->ttype != TYPE_str) {		throw(MAL, "batudf.reverse",		      "tail-type of input BAT must be TYPE_str");	}	/* allocate result BAT */	bn = BATnew(src->htype, TYPE_str, BATcount(src));	if (bn == NULL) {		throw(MAL, "batudf.reverse", MAL_MALLOC_FAIL);	}	BATseqbase(bn, src->hseqbase);	/* create BAT iterator */	li = bat_iterator(src);	/* the core of the algorithm, expensive due to malloc/frees */	BATloop(src, p, q) {		char *tr = NULL, *err = NULL;		/* get original head & tail value */		ptr h = BUNhead(li, p);		const char *t = (const char *) BUNtail(li, p);		/* revert tail value */		err = UDFreverse_(&tr, t);		if (err != MAL_SUCCEED) {			/* error -> bail out */			BBPreleaseref(bn->batCacheid);			return err;		}		/* assert logical sanity */		assert(tr != NULL);		/* insert original head and reversed tail in result BAT */		/* BUNins() takes care of all necessary administration */		BUNins(bn, h, tr, FALSE);		/* free memory allocated in UDFreverse_() */		GDKfree(tr);	}
开发者ID:Clay-Birkett,项目名称:monetdb,代码行数:57,


示例17: stringdiff_impl

strstringdiff_impl(int *res, str *s1, str *s2){	str r = MAL_SUCCEED;	char *S1 = NULL, *S2 = NULL;	r = soundex_impl(&S1, s1);	if( r != MAL_SUCCEED)		return r;	r = soundex_impl(&S2, s2);	if( r != MAL_SUCCEED){		GDKfree(S1);		return r;	}	r = levenshteinbasic_impl(res, &S1, &S2);	GDKfree(S1);	GDKfree(S2);	return r;}
开发者ID:jaiminpan,项目名称:Monetdb,代码行数:19,


示例18: MATsort_bte

static BAT *MATsort_bte( BAT **map, BAT **bats, int len, BUN cnt, int rev ){	BAT *res;	int i;	bte *resT, **batsT, *in;	bte *mapT;	BUN len1, len2;	bte *map_in = NULL;	res = BATnew(TYPE_void, bats[0]->ttype, cnt, TRANSIENT);	*map = BATnew(TYPE_void, TYPE_bte, cnt, TRANSIENT);	if (res == NULL || *map == NULL) {		BBPreclaim(res);		BBPreclaim(*map);		*map = NULL;		return NULL;	}	BATseqbase(res, 0);	BATseqbase(*map, 0);	resT = (bte*)Tloc(res, 0);	mapT = (bte*)Tloc(*map, 0);	batsT = (bte**)GDKmalloc(sizeof(bte*) * len);	for (i=0; i<len; i++)		batsT[i] = (bte*)Tloc(bats[i], 0);	/* merge */	in = batsT[0];	len1 = BATcount(bats[0]);	map_in = NULL;	/* TODO: change into a tree version */	for (i=1; i<len; i++) {		len2 = BATcount(bats[i]);		if (rev) {			MATsortloop_bte_rev( resT+cnt-len1-len2, 					mapT+cnt-len1-len2, 				        in, map_in, len1, 					batsT[i], i, len2);		} else {			MATsortloop_bte_( resT+cnt-len1-len2, 					mapT+cnt-len1-len2, 				        in, map_in, len1, 					batsT[i], i, len2);		}		in = resT+cnt-len1-len2;		map_in = mapT+cnt-len1-len2;		len1 += len2;	}	BATsetcount(res, len1);	BATsetcount(*map, len1);	res->hrevsorted = len1 <= 1;	(*map)->hrevsorted = len1 <= 1;	GDKfree(batsT);	return res;}
开发者ID:jaiminpan,项目名称:Monetdb,代码行数:54,


示例19: QEPfree

static voidQEPfree(QEP qep){	int i;	if( qep == 0)		return;	for(i=0; i< qep->climit; i++)	if( qep->children[i])		QEPfree(qep->children[i]);	GDKfree(qep);}
开发者ID:f7753,项目名称:monetdb,代码行数:11,


示例20: freeClient

/* * When a client needs to be terminated then the file descriptors for * its input/output are simply closed.  This leads to a graceful * degradation, but may take some time when the client is busy.  A more * forcefull method is to kill the client thread, but this may leave * locks and semaphores in an undesirable state. * * The routine freeClient ends a single client session, but through side * effects of sharing IO descriptors, also its children. Conversely, a * child can not close a parent. */voidfreeClient(Client c){	Thread t = c->mythread;	c->mode = FINISHING;#ifdef MAL_CLIENT_DEBUG	printf("# Free client %d/n", c->idx);#endif	MCexitClient(c);	/* scope list and curprg can not be removed, because the client may	 * reside in a quit() command. Therefore the scopelist is re-used.	 */	c->scenario = NULL;	if (c->prompt)		GDKfree(c->prompt);	c->prompt = NULL;	c->promptlength = -1;	if (c->errbuf) {		GDKsetbuf(0);		if (c->father == NULL)			GDKfree(c->errbuf);		c->errbuf = 0;	}	c->father = 0;	c->login = c->lastcmd = 0;	c->qtimeout = 0;	c->stimeout = 0;	if (c->rcc) {		GDKfree(c->rcc);		c->rcc = NULL;	}	c->user = oid_nil;	c->mythread = 0;	c->mode = FREECLIENT;	GDKfree(c->glb);	c->glb = NULL;	if (t)		THRdel(t);  /* you may perform suicide */}
开发者ID:digideskio,项目名称:monetdb,代码行数:52,


示例21: URLfromString

intURLfromString(str src, int *len, str *u){	/* actually parse the message for valid url */	if (*u !=0)		GDKfree(*u);	*len = (int) strlen(src);	*u = GDKstrdup(src);	return *len;}
开发者ID:f7753,项目名称:monetdb,代码行数:12,


示例22: addQueryToCache

voidaddQueryToCache(Client c){	str msg = NULL;	insertSymbol(c->nspace, c->curprg);	msg = optimizeQuery(c);	if (msg != MAL_SUCCEED) {		showScriptException(c->fdout, c->curprg->def, 0, MAL, "%s", msg);		GDKfree(msg);	}}
开发者ID:Mytherin,项目名称:MonetDBLite,代码行数:12,


示例23: create_reader_thread_data

static reader_thread_data *create_reader_thread_data(bam_wrapper * bws, int nr_files, sht nr_threads){	reader_thread_data *d =		(reader_thread_data *) GDKmalloc(nr_threads *						 sizeof(reader_thread_data));	MT_Lock *reader_lock = (MT_Lock *) GDKmalloc(sizeof(MT_Lock));	int *cur_file = (int *) GDKmalloc(sizeof(int));	str reader_lock_ref = "bamReaderLock";	bit *failure = (bit *) GDKmalloc(sizeof(bit));	sht i;	assert(nr_threads > 0);	if (d == NULL || reader_lock == NULL || cur_file == NULL		|| failure == NULL) {		GDKfree(d);		GDKfree(reader_lock);		GDKfree(cur_file);		GDKfree(failure);		return NULL;	}	MT_lock_init(reader_lock, reader_lock_ref);	*cur_file = -1;	*failure = FALSE;	for (i = 0; i < nr_threads; ++i) {		d[i].thread_id = i;		d[i].bws = bws;		d[i].reader_lock = reader_lock;		d[i].reader_lock_ref = reader_lock_ref;		d[i].cur_file = cur_file;		d[i].nr_files = nr_files;		d[i].msg = MAL_SUCCEED;		d[i].failure = failure;	}	return d;}
开发者ID:cswxu,项目名称:monetdb-mcs,代码行数:40,


示例24: OPTjsonImplementation

int OPTjsonImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){	int i, j, limit, slimit;	int bu = 0, br = 0, bj = 0;	str nme;	InstrPtr p,q;	int actions = 0;	InstrPtr *old;	(void) pci;	(void) cntxt;	(void) stk;		/* to fool compilers */	old= mb->stmt;	limit= mb->stop;	slimit = mb->ssize;	if ( newMalBlkStmt(mb,mb->stop) < 0)		return 0;	for (i = 0; i < limit; i++) {		p = old[i];		if( getModuleId(p) == sqlRef  && getFunctionId(p) == affectedRowsRef) {			q = newStmt(mb, jsonRef, resultSetRef);			q = pushArgument(mb, q, bu);			q = pushArgument(mb, q, br);			q = pushArgument(mb, q, bj);			j = getArg(q,0);			p= getInstrPtr(mb,0);			setVarType(mb,getArg(p,0),TYPE_str);			q = newReturnStmt(mb);			getArg(q,0)= getArg(p,0);			pushArgument(mb,q,j);			continue;		}		if( getModuleId(p) == sqlRef  && getFunctionId(p) == rsColumnRef) {			nme = getVarConstant(mb,getArg(p,4)).val.sval;			if (strcmp(nme,"uuid")==0)				bu = getArg(p,7);			if (strcmp(nme,"lng")==0)				br = getArg(p,7);			if (strcmp(nme,"json")==0)				bj = getArg(p,7);			freeInstruction(p);			continue;		}		pushInstruction(mb,p);	} 	for(; i<slimit; i++)		if (old[i]) 			freeInstruction(old[i]);	GDKfree(old);	return actions;}
开发者ID:cswxu,项目名称:monetdb-mcs,代码行数:52,


示例25: BATXMLgroup

strBATXMLgroup(xml *ret, const bat *bid){	BAT *b;	BUN p, q;	const char *t;	size_t len, size = BUFSIZ, offset;	str buf = GDKmalloc(size);	BATiter bi;	const char *err = NULL;	if (buf == NULL)		throw(MAL, "xml.aggr",MAL_MALLOC_FAIL);	if ((b = BATdescriptor(*bid)) == NULL) {		GDKfree(buf);		throw(MAL, "xml.aggr", RUNTIME_OBJECT_MISSING);	}	strcpy(buf, str_nil);	offset = 0;	bi = bat_iterator(b);	BATloop(b, p, q) {		int n;		t = (const char *) BUNtail(bi, p);		if (strNil(t))			continue;		len = strlen(t) + 1;		if (len >= size - offset) {			size += len + 128;			buf = GDKrealloc(buf, size);			if (buf == NULL) {				err= MAL_MALLOC_FAIL;				goto failed;			}		}		if (offset == 0)			n = snprintf(buf, size, "%s", t);		else if (buf[0] != *t) {			err = "incompatible values in group";			goto failed;		} else if (buf[0] == 'A')			n = snprintf(buf + offset, size - offset, " %s", t + 1);		else if (buf[0] == 'C')			n = snprintf(buf + offset, size - offset, "%s", t + 1);		else {			err = "can only group attributes and element content";			goto failed;		}		offset += n;	}
开发者ID:f7753,项目名称:monetdb,代码行数:52,


示例26: str_2_timestamp

strstr_2_timestamp(timestamp *res, const str *val){	ptr p = NULL;	int len = 0;	int e;	char buf[BUFSIZ];	e = ATOMfromstr(TYPE_timestamp, &p, &len, *val);	if (e < 0 || !p || (ATOMcmp(TYPE_timestamp, p, ATOMnilptr(TYPE_timestamp)) == 0 && ATOMcmp(TYPE_str, *val, ATOMnilptr(TYPE_str)) != 0)) {		if (p)			GDKfree(p);		snprintf(buf, BUFSIZ, "conversion of string '%s' failed", *val? *val:"");		throw(SQL, "timestamp", "%s", buf);	}	*res = *(timestamp *) p;	if (!ATOMextern(TYPE_timestamp)) {		if (p)			GDKfree(p);	}	return MAL_SUCCEED;}
开发者ID:f7753,项目名称:monetdb,代码行数:22,


示例27: SABgetLocalConnectionHost

str SABgetLocalConnectionHost(str *ret) {	str tmp, con, p;	rethrow("sabaoth.getLocalConnectionHost", tmp,			SABAOTHgetLocalConnection(&con));	/* this happens if no connection is available */	if (strcmp(con, (str)str_nil) == 0) {		*ret = con;		return(MAL_SUCCEED);	}	/* con looks like mapi:monetdb://hostname:port */	/* do some poor man's parsing */	tmp = con;	if ((p = strchr(con, ':')) == NULL) {		p = createException(MAL, "sabaoth.getLocalConnectionHost",				"invalid local connection string: %s", tmp);		GDKfree(tmp);		return(p);	}	if ((con = strchr(p + 1, ':')) == NULL) {		p = createException(MAL, "sabaoth.getLocalConnectionHost",				"invalid local connection string: %s", tmp);		GDKfree(tmp);		return(p);	}	if ((p = strchr(con + 3, ':')) == NULL) {		p = createException(MAL, "sabaoth.getLocalConnectionHost",				"invalid local connection string: %s", tmp);		GDKfree(tmp);		return(p);	}	*p = '/0';	*ret = GDKstrdup(con + 3);	GDKfree(tmp);	return(MAL_SUCCEED);}
开发者ID:Clay-Birkett,项目名称:monetdb,代码行数:39,


示例28: JSONunfoldContainer

static voidJSONunfoldContainer(JSON *jt, int idx, BAT *bo, BAT *bk, BAT *bv, oid *o){	int i, last;	int cnt = 0;	char *r;	last = jt->elm[idx].tail;	if (jt->elm[idx].kind == JSON_OBJECT)		for (i = jt->elm[idx].next; i; i = jt->elm[i].next) {			r = JSONgetValue(jt, i);			BUNappend(bk, r, FALSE);			GDKfree(r);			r = JSONgetValue(jt, jt->elm[i].child);			BUNappend(bv, r, FALSE);			if (bo)				BUNappend(bo, o, FALSE);			(*o)++;			GDKfree(r);			if (i == last)				break;	} else if (jt->elm[idx].kind == JSON_ARRAY)		for (i = jt->elm[idx].next; i; i = jt->elm[i].next) {			r = GDKstrdup(str_nil);			BUNappend(bk, r, FALSE);			if (jt->elm[i].kind == JSON_VALUE)				r = JSONgetValue(jt, jt->elm[i].child);			else				r = JSONgetValue(jt, i);			BUNappend(bv, r, FALSE);			if (bo)				BUNappend(bo, o, FALSE);			(*o)++;			cnt++;			GDKfree(r);			if (i == last)				break;		}}
开发者ID:f7753,项目名称:monetdb,代码行数:39,


示例29: MCcleanupClients

/* * At the end of the server session all remaining structured are * explicitly released to simplify detection of memory leakage problems. */voidMCcleanupClients(void){	Client c;	for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {		if (c->prompt) {			GDKfree(c->prompt);			c->prompt = NULL;		}		c->user = oid_nil;		assert(c->bak == NULL);		MCexitClient(c);	}}
开发者ID:digideskio,项目名称:monetdb,代码行数:18,


示例30: snprintf

static char *RAPIinstalladdons(void) {	int evalErr;	ParseStatus status;	char rlibs[FILENAME_MAX];	char rapiinclude[BUFSIZ];	SEXP librisexp;	int len;	// r library folder, create if not exists	len = snprintf(rlibs, sizeof(rlibs), "%s%c%s", GDKgetenv("gdk_dbpath"), DIR_SEP, "rapi_packages");	if (len == -1 || len >= FILENAME_MAX)		return "cannot create rapi_packages directory because the path is too large";	if (mkdir(rlibs, S_IRWXU) != 0 && errno != EEXIST) {		return "cannot create rapi_packages directory";	}#ifdef _RAPI_DEBUG_	printf("# R libraries installed in %s/n",rlibs);#endif	PROTECT(librisexp = allocVector(STRSXP, 1));	SET_STRING_ELT(librisexp, 0, mkChar(rlibs));	Rf_defineVar(Rf_install(".rapi.libdir"), librisexp, R_GlobalEnv);	UNPROTECT(1);	// run rapi.R environment setup script	{		char *f = locate_file("rapi", ".R", 0);		snprintf(rapiinclude, sizeof(rapiinclude), "source(/"%s/")", f);		GDKfree(f);	}#if DIR_SEP != '/'	{		char *p;		for (p = rapiinclude; *p; p++)			if (*p == DIR_SEP)				*p = '/';	}#endif	R_tryEvalSilent(		VECTOR_ELT(			R_ParseVector(mkString(rapiinclude), 1, &status,						  R_NilValue), 0), R_GlobalEnv, &evalErr);	// of course the script may contain errors as well	if (evalErr != FALSE) {		return "failure running R setup script";	}	return NULL;}
开发者ID:MonetDB,项目名称:MonetDB,代码行数:50,



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


C++ GDKmalloc函数代码示例
C++ GDK_X11_SCREEN函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。