本文整理汇总了C++中rfree函数的典型用法代码示例。如果您正苦于以下问题:C++ rfree函数的具体用法?C++ rfree怎么用?C++ rfree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rfree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rfree
void rfree(void* x) {
if ((x != NIL) &&
(x != TRUE) &&
(x != FALSE) &&
(x != NULL)) {
switch(type(x)) {
case SPECIAL:
/* can't be freed */
return;
case FUNCTION:
/* TODO */
return;
case INT:
/* no members to free */
break;
case SYMBOL:
free(SVAL(x));
break;
case CONS:
rfree(CAR(x));
rfree(CDR(x));
break;
}
free(x);
}
}
开发者ID:jondistad,项目名称:uberlisp,代码行数:26,代码来源:types.c
示例2: SpaceNotStable
const Choice*
Space::choice(void) {
if (!stable())
throw SpaceNotStable("Space::choice");
if (failed() || (b_status == Brancher::cast(&bl))) {
// There are no more choices to be generated
// Delete all branchers
Brancher* b = Brancher::cast(bl.next());
while (b != Brancher::cast(&bl)) {
Brancher* d = b;
b = Brancher::cast(b->next());
rfree(d,d->dispose(*this));
}
bl.init();
b_status = b_commit = Brancher::cast(&bl);
return NULL;
}
/*
* The call to choice() says that no older choices
* can be used. Hence, all branchers that are exhausted can be deleted.
*/
Brancher* b = Brancher::cast(bl.next());
while (b != b_status) {
Brancher* d = b;
b = Brancher::cast(b->next());
d->unlink();
rfree(d,d->dispose(*this));
}
// Make sure that b_commit does not point to a deleted brancher!
b_commit = b_status;
return b_status->choice(*this);
}
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:32,代码来源:core.cpp
示例3: selector_free
/**
* \brief Frees selector component.
* \param[in,out] dev Selector base component device.
*/
static void selector_free(struct comp_dev *dev)
{
struct comp_data *cd = comp_get_drvdata(dev);
trace_selector("selector_free()");
rfree(cd);
rfree(dev);
}
开发者ID:tlauda,项目名称:sof,代码行数:13,代码来源:selector.c
示例4: test_keyword_free
static void test_keyword_free(struct comp_dev *dev)
{
struct comp_data *cd = comp_get_drvdata(dev);
trace_keyword("test_keyword_free()");
free_mem_load(cd);
rfree(cd);
rfree(dev);
}
开发者ID:tlauda,项目名称:sof,代码行数:10,代码来源:detect_test.c
示例5: rpmfcAttrFree
static rpmfcAttr rpmfcAttrFree(rpmfcAttr attr)
{
if (attr) {
ruleFree(&attr->incl);
ruleFree(&attr->excl);
rfree(attr->name);
rfree(attr);
}
return NULL;
}
开发者ID:OlegGirko,项目名称:rpm,代码行数:10,代码来源:rpmfc.c
示例6: DialogProc
BOOL DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
{
SelectObject(g_hdc, g_hbmpOld);
DeleteObject(g_hbmp);
DeleteDC(g_hdc);
EndDialog(hDlg, 0);
break;
}
case WM_INITDIALOG:
{
int i;
t_region *region, *rgnExclude = NULL, *rgnNew;
g_hdc = CreateCompatibleDC(NULL);
g_hbmp = CreateCompatibleBitmap(GetDC(NULL), 640, 480);
g_hbmpOld = SelectObject(g_hdc, g_hbmp);
region = create_rect_region(g_rcInclude.left, g_rcInclude.top, g_rcInclude.right, g_rcInclude.bottom);
for (i=0;i<EXCLUDES;i++)
rgnExclude = append_regions(rgnExclude, create_rect_region(g_rcExclude[i].left, g_rcExclude[i].top, g_rcExclude[i].right, g_rcExclude[i].bottom));
rgnNew = difference_regions(region, rgnExclude);
rfree(®ion);
rfree(&rgnExclude);
region = rgnNew;
while (region)
{
Rectangle(g_hdc, region->rcRegion.left, region->rcRegion.top, region->rcRegion.right, region->rcRegion.bottom);
region = region->next;
}
rfree(&rgnNew);
SendMessage(hDlg, WM_SETTEXT, 0, (LPARAM)"Region Test");
break;
}
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hDlg, &ps);
BitBlt(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, g_hdc, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
EndPaint(hDlg, &ps);
break;
}
default:
return FALSE;
}
return TRUE;
}
开发者ID:dizuo,项目名称:read_books,代码行数:54,代码来源:rect_overlap_main.c
示例7: ferite_classic_free
void ferite_classic_free( void *targetptr, char *file, int line, FeriteScript *script )
{
#ifdef FERITE_MEM_DEBUG
struct ferite_memory_block *ptr, *temp_ptr;
if( targetptr == NULL )
printf( "Trying to free NULL ptr on %s:%d\n", file, line );
LOCK_MEMORY;
for( ptr = mem_rootblk; ptr->next != NULL; ptr = ptr->next )
{
if( ptr->next->data == targetptr )
{
# ifdef SUPER_VERBOSE
FUD(("INFO: Found memory block (%p). Freeing.\n", ptr->next->data));
# endif
ferite_classic_free_count++;
temp_ptr = ptr->next;
ptr->next = temp_ptr->next;
# ifdef SUPER_VERBOSE
FUD(("INFO: Freeing %p\n", temp_ptr->data ));
# endif
rfree( temp_ptr->data );
# ifdef SUPER_VERBOSE
FUD((" * Free'd data\n"));
# endif
free( temp_ptr->file );
# ifdef SUPER_VERBOSE
FUD((" * Free'd filename\n"));
# endif
free( temp_ptr );
# ifdef SUPER_VERBOSE
FUD((" * Free'd memory block\n"));
# endif
UNLOCK_MEMORY;
return;
}
}
FUD(("* URGH. Can't find block(%p) in memory list. Freeing Anyways.\n", targetptr));
free( targetptr );
UNLOCK_MEMORY;
#else
LOCK_MEMORY;
if( targetptr == NULL )
printf( "Trying to free null in %s at %d\n", file, line );
else
ferite_classic_free_count++;
rfree( targetptr );
UNLOCK_MEMORY;
#endif
}
开发者ID:cention-nazri,项目名称:ferite-1.1.18,代码行数:53,代码来源:ferite_mem_classic.c
示例8: trace_selector
/**
* \brief Creates selector component.
* \param[in,out] data Selector base component device.
* \return Pointer to selector base component device.
*/
static struct comp_dev *selector_new(struct sof_ipc_comp *comp)
{
struct sof_ipc_comp_process *ipc_process =
(struct sof_ipc_comp_process *)comp;
size_t bs = ipc_process->size;
struct comp_dev *dev;
struct comp_data *cd;
int ret;
trace_selector("selector_new()");
if (IPC_IS_SIZE_INVALID(ipc_process->config)) {
IPC_SIZE_ERROR_TRACE(TRACE_CLASS_SELECTOR, ipc_process->config);
return NULL;
}
dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_process));
if (!dev)
return NULL;
assert(!memcpy_s(&dev->comp, sizeof(struct sof_ipc_comp_process), comp,
sizeof(struct sof_ipc_comp_process)));
cd = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*cd));
if (!cd) {
rfree(dev);
return NULL;
}
comp_set_drvdata(dev, cd);
assert(!memcpy_s(&cd->config, sizeof(cd->config), ipc_process->data,
bs));
/* verification of initial parameters */
ret = sel_set_channel_values(cd, cd->config.in_channels_count,
cd->config.out_channels_count,
cd->config.sel_channel);
if (ret < 0) {
rfree(cd);
rfree(dev);
return NULL;
}
dev->state = COMP_STATE_READY;
return dev;
}
开发者ID:tlauda,项目名称:sof,代码行数:53,代码来源:selector.c
示例9: chsnbrg_simtr
/**
@brief 密行列AをHessenberg型行列Bに相似変換する.
@param[in] n 正方行列A,Bのサイズ
@param[in] A 行列
@param[in] LDA Aの第1次元
@param[out] B 相似変換により得られたHessenberg型行列
@param[in] LDB Bの第1次元
*/
void chsnbrg_simtr(int n, cmulti **B, int LDB, cmulti **A, int LDA)
{
int i,prec=53;
rmulti *alpha=NULL;
cmulti **h=NULL;
// allocate
prec=cmat_get_prec_max(n,n,B,LDB);
alpha=rallocate_prec(prec);
h=cvec_allocate_prec(n,prec);
// copy
cmat_copy(n,n,B,LDB,A,LDA);
// compute
for(i=0; i<n-2; i++){
// Householder vector
chouseholder_vec(n,i+1,h,alpha,&COL(B,i,LDB));
// similarity transformation
chouseholder_right(n,n,B,LDB,B,LDB,i+1,h,alpha);
chouseholder_left(n,n,B,LDB,B,LDB,i+1,h,alpha);
// set lower part as zeros
cvec_set_zeros(n-2-i,&MAT(B,i+2,i,LDB));
}
// done
alpha=rfree(alpha);
h=cvec_free(n,h);
}
开发者ID:wenxuegege,项目名称:libis,代码行数:33,代码来源:chsnbrg.c
示例10: bgp_close
/**
* bgp_close - close a BGP instance
* @p: BGP instance
* @apply_md5: 0 to disable unsetting MD5 auth
*
* This function frees and deconfigures shared BGP resources.
* @apply_md5 is set to 0 when bgp_close is called as a cleanup
* from failed bgp_open().
*/
static void
bgp_close(struct bgp_proto *p, int apply_md5)
{
ASSERT(bgp_counter);
bgp_counter--;
if (p->cf->password && apply_md5)
sk_set_md5_auth(bgp_listen_sk, p->cf->remote_ip, p->cf->iface, NULL);
if (!bgp_counter)
{
rfree(bgp_listen_sk);
bgp_listen_sk = NULL;
rfree(bgp_linpool);
bgp_linpool = NULL;
}
}
开发者ID:rogerhu,项目名称:dd-wrt,代码行数:26,代码来源:bgp.c
示例11: rhouseholder_vec
/**
@brief ハウスホルダー・ベクトルへの変換.
@details h[0]=0; ...; h[k-1]=0; h[k]=-s*xi; h[k+1]=x[k+1]; ...; h[n-1]=x[n-1];
@param[in] h 初期化済みのベクトル.サイズはn.
@param[in] x 初期化済みのベクトル.サイズはn.
@param[in] n ベクトルのサイズ.
@param[in] k 第k要素が基準.
@param[out] h ハウスホルダー・ベクトル.
*/
void rhouseholder_vec(int n, int k, rmulti **h, rmulti *alpha, rmulti **x)
{
int p0,p1,prec;
rmulti *eta=NULL,*zeta=NULL,*xi=NULL,*axk=NULL;
// allocate
p0=rget_prec(alpha);
p1=rvec_get_prec_max(n,h);
prec=MAX2(p0,p1);
eta=rallocate_prec(prec);
zeta=rallocate_prec(prec);
xi=rallocate_prec(prec);
axk=rallocate_prec(prec);
//----------- norm
rvec_sum_pow2(xi,n-k-1,&x[k+1]); // xi=sum(abs(x((k+1):end)).^2);
rmul(axk,x[k],x[k]); // axk=|x[k]|^2
radd(eta,axk,xi); // eta=|x[k]|^2+...
rsqrt(axk,axk); // axk=|x[k]|
rsqrt(eta,eta); // eta=sqrt(|x[k]|^2+...)
if(req_d(eta,0)){rsub(xi,eta,axk);} // xi=eta-|x(k)|
else{ // xi=xi/(|x(k)|+eta)
radd(zeta,axk,eta);
rdiv(xi,xi,zeta);
}
//----------- h
rvec_set_zeros(k,h);
rvec_copy(n-k-1,&h[k+1],&x[k+1]); // h((k+1):end)=x((k+1):end);
if(ris_zero(x[k])){
rcopy(h[k],xi); rneg(h[k],h[k]); // h[k]=-xi
}else{
rdiv(zeta,xi,axk); rneg(zeta,zeta); // zeta=-xi/axk;
rmul(h[k],x[k],zeta); // h[k]=zeta*x[k];
}
//----------- alpha
if(req_d(xi,0) || req_d(eta,0)){
rset_d(alpha,0);
}else{
rmul(alpha,xi,eta); // alpha=1/(xi*eta)
rinv(alpha,alpha);
}
// free
eta=rfree(eta);
zeta=rfree(zeta);
xi=rfree(xi);
axk=rfree(axk);
}
开发者ID:wenxuegege,项目名称:libis,代码行数:54,代码来源:rhshldr.c
示例12: bgp_close_conn
/**
* bgp_close_conn - close a BGP connection
* @conn: connection to close
*
* This function takes a connection described by the &bgp_conn structure,
* closes its socket and frees all resources associated with it.
*/
void
bgp_close_conn(struct bgp_conn *conn)
{
// struct bgp_proto *p = conn->bgp;
DBG("BGP: Closing connection\n");
conn->packets_to_send = 0;
rfree(conn->connect_retry_timer);
conn->connect_retry_timer = NULL;
rfree(conn->keepalive_timer);
conn->keepalive_timer = NULL;
rfree(conn->hold_timer);
conn->hold_timer = NULL;
rfree(conn->sk);
conn->sk = NULL;
rfree(conn->tx_ev);
conn->tx_ev = NULL;
}
开发者ID:rogerhu,项目名称:dd-wrt,代码行数:25,代码来源:bgp.c
示例13: TestSingleMatch
static int TestSingleMatch()
{
regex* re = regex_create("a", NULL);
program* prog = &(re->prog);
mu_assert("program length", prog->size == 2);
mu_assert("first inst is rule", prog->code[0].op == I_CHAR);
mu_assert("second inst is match", prog->code[1].op == I_MATCH);
rfree(re);
return 1;
}
开发者ID:lukesandberg,项目名称:Regex,代码行数:10,代码来源:compiler_tests.c
示例14: EvalCcRqGETFONTSIZES
void EvalCcRqGETFONTSIZES (CrossCallInfo *pcci) // textptr; no result.
{
HDC hdc;
hdc = GetDC (ghMainWindow);
EnumFontFamilies (hdc, (char *) pcci->p1, (FONTENUMPROC) EnumFontSizeProc, 0);
ReleaseDC (ghMainWindow, hdc);
rfree ((char *) pcci->p1);
MakeReturn0Cci (pcci);
}
开发者ID:ygmpkk,项目名称:house,代码行数:10,代码来源:cCrossCallFont_121.c
示例15: TestConcat
static int TestConcat()
{
regex* re = regex_create("ab", NULL);
program* prog = &(re->prog);
mu_assert("program length", prog->size == 3);
mu_assert("first inst is split", prog->code[0].op == I_CHAR);
mu_assert("second inst is rule", prog->code[1].op == I_CHAR);
mu_assert("third inst is match", prog->code[2].op == I_MATCH);
rfree(re);
return 1;
}
开发者ID:lukesandberg,项目名称:Regex,代码行数:11,代码来源:compiler_tests.c
示例16: free_mem_load
static void free_mem_load(struct comp_data *cd)
{
if (!cd) {
trace_keyword_error("free_mem_load() error: invalid cd");
return;
}
if (cd->load_memory) {
rfree(cd->load_memory);
cd->load_memory = NULL;
}
}
开发者ID:tlauda,项目名称:sof,代码行数:12,代码来源:detect_test.c
示例17: bgp_incoming_connection
/**
* bgp_incoming_connection - handle an incoming connection
* @sk: TCP socket
* @dummy: unused
*
* This function serves as a socket hook for accepting of new BGP
* connections. It searches a BGP instance corresponding to the peer
* which has connected and if such an instance exists, it creates a
* &bgp_conn structure, attaches it to the instance and either sends
* an Open message or (if there already is an active connection) it
* closes the new connection by sending a Notification message.
*/
static int
bgp_incoming_connection(sock *sk, int dummy UNUSED)
{
struct proto_config *pc;
DBG("BGP: Incoming connection from %I port %d\n", sk->daddr, sk->dport);
WALK_LIST(pc, config->protos)
if (pc->protocol == &proto_bgp && pc->proto)
{
struct bgp_proto *p = (struct bgp_proto *) pc->proto;
if (ipa_equal(p->cf->remote_ip, sk->daddr) &&
(!ipa_has_link_scope(sk->daddr) || (p->cf->iface == sk->iface)))
{
/* We are in proper state and there is no other incoming connection */
int acc = (p->p.proto_state == PS_START || p->p.proto_state == PS_UP) &&
(p->start_state >= BSS_CONNECT) && (!p->incoming_conn.sk);
if (p->conn && (p->conn->state == BS_ESTABLISHED) && p->gr_ready)
{
bgp_store_error(p, NULL, BE_MISC, BEM_GRACEFUL_RESTART);
bgp_handle_graceful_restart(p);
bgp_conn_enter_idle_state(p->conn);
acc = 1;
}
BGP_TRACE(D_EVENTS, "Incoming connection from %I%J (port %d) %s",
sk->daddr, ipa_has_link_scope(sk->daddr) ? sk->iface : NULL,
sk->dport, acc ? "accepted" : "rejected");
if (!acc)
goto reject;
int hops = p->cf->multihop ? : 1;
if (sk_set_ttl(sk, p->cf->ttl_security ? 255 : hops) < 0)
goto err;
if (p->cf->ttl_security)
if (sk_set_min_ttl(sk, 256 - hops) < 0)
goto err;
bgp_setup_conn(p, &p->incoming_conn);
bgp_setup_sk(&p->incoming_conn, sk);
bgp_send_open(&p->incoming_conn);
return 0;
err:
sk_log_error(sk, p->p.name);
log(L_ERR "%s: Incoming connection aborted", p->p.name);
rfree(sk);
return 0;
}
}
开发者ID:deepfield,项目名称:bird,代码行数:65,代码来源:bgp.c
示例18: solveSudoku
void solveSudoku(vector<vector<char> > &board) {
vector<vector<bool> >rfree(9, vector<bool>(9, true));
vector<vector<bool> >cfree(9, vector<bool>(9, true));
vector<vector<bool> >sfree(9, vector<bool>(9, true));
vector<int> ei;
vector<int> ej;
// init
init(board, rfree, cfree, sfree, ei, ej);
int size = ei.size();
helper(board, rfree, cfree, sfree, ei, ej, 0, size-1);
}
开发者ID:elsucai,项目名称:LC,代码行数:12,代码来源:sudoku-solver.cpp
示例19: TestStar
static int TestStar()
{
regex* re = regex_create("a*", NULL);
program* prog = &(re->prog);
mu_assert("program length", prog->size == 4);
mu_assert("first inst is split", prog->code[0].op == I_SPLIT);
mu_assert("second inst is rule", prog->code[1].op == I_CHAR);
mu_assert("third inst is jmp", prog->code[2].op == I_JMP);
mu_assert("final inst is match", prog->code[3].op == I_MATCH);
rfree(re);
return 1;
}
开发者ID:lukesandberg,项目名称:Regex,代码行数:12,代码来源:compiler_tests.c
示例20: processVerDef
static void processVerDef(Elf_Scn *scn, GElf_Shdr *shdr, elfInfo *ei)
{
Elf_Data *data = NULL;
unsigned int offset, auxoffset;
char *soname = NULL;
while ((data = elf_getdata(scn, data)) != NULL) {
offset = 0;
for (int i = shdr->sh_info; --i >= 0; ) {
GElf_Verdef def_mem, *def;
def = gelf_getverdef (data, offset, &def_mem);
if (def == NULL)
break;
auxoffset = offset + def->vd_aux;
offset += def->vd_next;
for (int j = def->vd_cnt; --j >= 0; ) {
GElf_Verdaux aux_mem, * aux;
const char *s;
aux = gelf_getverdaux (data, auxoffset, &aux_mem);
if (aux == NULL)
break;
s = elf_strptr(ei->elf, shdr->sh_link, aux->vda_name);
if (s == NULL)
break;
if (def->vd_flags & VER_FLG_BASE) {
rfree(soname);
soname = rstrdup(s);
auxoffset += aux->vda_next;
continue;
} else if (soname && !soname_only && !skipPrivate(s)) {
addDep(&ei->provides, soname, s, ei->marker);
}
}
}
}
rfree(soname);
}
开发者ID:Distrotech,项目名称:rpm,代码行数:40,代码来源:elfdeps.c
注:本文中的rfree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论