本文整理汇总了C++中FREE_OBJ函数的典型用法代码示例。如果您正苦于以下问题:C++ FREE_OBJ函数的具体用法?C++ FREE_OBJ怎么用?C++ FREE_OBJ使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FREE_OBJ函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VRT_DelDirector
void
VRT_DelDirector(VCL_BACKEND *bp)
{
struct vcl *vcl;
struct vcldir *vdir;
VCL_BACKEND d;
TAKE_OBJ_NOTNULL(d, bp, DIRECTOR_MAGIC);
vdir = d->vdir;
CHECK_OBJ_NOTNULL(vdir, VCLDIR_MAGIC);
vcl = vdir->vcl;
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
Lck_Lock(&vcl_mtx);
VTAILQ_REMOVE(&vcl->director_list, vdir, list);
Lck_Unlock(&vcl_mtx);
AZ(errno=pthread_rwlock_rdlock(&vcl->temp_rwl));
if (VCL_WARM(vcl))
VDI_Event(d, VCL_EVENT_COLD);
AZ(errno=pthread_rwlock_unlock(&vcl->temp_rwl));
if(vdir->methods->destroy != NULL)
vdir->methods->destroy(d);
free(vdir->cli_name);
FREE_OBJ(vdir->dir);
FREE_OBJ(vdir);
}
示例2: vex_Free
void
vex_Free(struct vex **pvex)
{
if ((*pvex)->lhs != NULL) {
if ((*pvex)->lhs->tags != NULL)
vbit_destroy((*pvex)->lhs->tags);
if ((*pvex)->lhs->prefix != NULL)
free((*pvex)->lhs->prefix);
FREE_OBJ((*pvex)->lhs);
}
if ((*pvex)->rhs != NULL) {
if ((*pvex)->rhs->val_string)
free((*pvex)->rhs->val_string);
if ((*pvex)->rhs->val_regex)
VRE_free(&(*pvex)->rhs->val_regex);
FREE_OBJ((*pvex)->rhs);
}
if ((*pvex)->a != NULL) {
vex_Free(&(*pvex)->a);
AZ((*pvex)->a);
}
if ((*pvex)->b != NULL) {
vex_Free(&(*pvex)->b);
AZ((*pvex)->b);
}
FREE_OBJ(*pvex);
*pvex = NULL;
}
示例3: vmod_file_system__fini
VCL_VOID
vmod_file_system__fini(struct vmod_fsdirector_file_system **fsp)
{
struct vmod_fsdirector_file_system *fs;
void *res;
// XXX It seems that the destructor is not called yet.
// A little reminder then...
abort();
fs = *fsp;
*fsp = NULL;
CHECK_OBJ_NOTNULL(fs, VMOD_FSDIRECTOR_MAGIC);
AZ(pthread_cancel(fs->tp));
AZ(pthread_join(fs->tp, &res));
assert(res == PTHREAD_CANCELED);
magic_close(fs->magic_cookie);
free(fs->thread_name);
free(fs->ws_name);
free(fs->wrk->aws);
FREE_OBJ(fs->wrk);
FREE_OBJ(fs);
}
示例4: HSH_Cleanup
/*---------------------------------------------------------------------*/
void
HSH_Cleanup(struct worker *wrk)
{
if (wrk->nobjcore != NULL) {
FREE_OBJ(wrk->nobjcore);
wrk->stats->n_objectcore--;
wrk->nobjcore = NULL;
}
if (wrk->nobjhead != NULL) {
Lck_Delete(&wrk->nobjhead->mtx);
FREE_OBJ(wrk->nobjhead);
wrk->nobjhead = NULL;
wrk->stats->n_objecthead--;
}
if (wrk->nwaitinglist != NULL) {
FREE_OBJ(wrk->nwaitinglist);
wrk->nwaitinglist = NULL;
wrk->stats->n_waitinglist--;
}
if (wrk->nhashpriv != NULL) {
/* XXX: If needed, add slinger method for this */
free(wrk->nhashpriv);
wrk->nhashpriv = NULL;
}
}
示例5: CREATE_STRING_ERR
char *popen_fread(char *cmd, char *buf, int len)
{
char *str_tmp = NULL;
char *p = NULL;
FILE *fp = NULL;
if((cmd == NULL) || (buf == NULL))
return NULL;
//str_tmp = malloc(len);
CREATE_STRING_ERR(str_tmp,len,MALLOC_ERR_RET(NULL));
if(str_tmp == NULL)
{
goto err;
}
printf_d("CMD: %s\n", cmd);
fp = popen(cmd, "r");
if(fp)
{
memset(str_tmp, 0, len);
if(fread(str_tmp, 1, len, fp) > 0)
{
if(strlen(str_tmp) < 1)
{
pclose(fp);
goto err;
}
if(str_tmp[strlen(str_tmp)-1] == '\n')
{
str_tmp[strlen(str_tmp)-1] = '\0';
}
else
{
str_tmp[strlen(str_tmp)] = '\0';
}
p = trim(str_tmp);
if(p == NULL)
{
buf[0] = 0;
}
else
strcpy(buf, p);
pclose(fp);
}
else
{
pclose(fp);
goto err;
}
}
else
{
goto err;
}
FREE_OBJ(str_tmp);
return buf;
err:
FREE_OBJ(str_tmp);
return NULL;
}
示例6: vdir_delete
void
vdir_delete(struct vdir **vdp)
{
struct vdir *vd;
TAKE_OBJ_NOTNULL(vd, vdp, VDIR_MAGIC);
free(vd->backend);
free(vd->weight);
AZ(pthread_rwlock_destroy(&vd->mtx));
free(vd->dir->vcl_name);
FREE_OBJ(vd->dir);
vbit_destroy(vd->vbm);
FREE_OBJ(vd);
}
示例7: TestCB_destroy
void
TestCB_destroy(TestCharBuf *self)
{
DECREF(self->wanted);
DECREF(self->got);
FREE_OBJ(self);
}
示例8: ME_DeleteReObject
void ME_DeleteReObject(REOBJECT* reo)
{
if (reo->poleobj) IOleObject_Release(reo->poleobj);
if (reo->pstg) IStorage_Release(reo->pstg);
if (reo->polesite) IOleClientSite_Release(reo->polesite);
FREE_OBJ(reo);
}
示例9: Snapshot_destroy
void
Snapshot_destroy(Snapshot *self)
{
DECREF(self->entries);
DECREF(self->filename);
FREE_OBJ(self);
}
示例10: FREE_OBJ
// Free a memblock object.
void Memblock::free(Memory& mem, Memblock* m)
{
if(m->ownData)
m->data.free(mem);
FREE_OBJ(mem, Memblock, m);
}
示例11: vfp_esi_end
vfp_esi_end(struct sess *sp)
{
struct vsb *vsb;
struct vef_priv *vef;
ssize_t l;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
AN(sp->wrk->vep);
vsb = VEP_Finish(sp);
if (vsb != NULL) {
l = VSB_len(vsb);
assert(l > 0);
/* XXX: This is a huge waste of storage... */
sp->obj->esidata = STV_alloc(sp, l);
XXXAN(sp->obj->esidata);
memcpy(sp->obj->esidata->ptr, VSB_data(vsb), l);
sp->obj->esidata->len = l;
VSB_delete(vsb);
}
if (sp->wrk->vgz_rx != NULL)
VGZ_Destroy(&sp->wrk->vgz_rx);
if (sp->wrk->vef_priv != NULL) {
vef = sp->wrk->vef_priv;
CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
sp->wrk->vef_priv = NULL;
VGZ_UpdateObj(vef->vgz, sp->obj);
VGZ_Destroy(&vef->vgz);
XXXAZ(vef->error);
FREE_OBJ(vef);
}
return (0);
}
示例12: vsmw_delseg
static void
vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg, int fixidx)
{
char *t = NULL;
ssize_t s;
int fd;
CHECK_OBJ_NOTNULL(vsmw, VSMW_MAGIC);
CHECK_OBJ_NOTNULL(seg, VSMWSEG_MAGIC);
VTAILQ_REMOVE(&vsmw->segs, seg, list);
REPLACE(seg->class, NULL);
REPLACE(seg->id, NULL);
FREE_OBJ(seg);
if (fixidx) {
vsmw_mkent(vsmw, vsmw->idx);
REPLACE(t, VSB_data(vsmw->vsb));
AN(t);
fd = openat(vsmw->vdirfd,
t, O_WRONLY|O_CREAT|O_EXCL, vsmw->mode);
assert(fd >= 0);
vsmw_idx_head(vsmw, fd);
VSB_clear(vsmw->vsb);
VTAILQ_FOREACH(seg, &vsmw->segs, list)
vsmw_fmt_index(vsmw, seg);
AZ(VSB_finish(vsmw->vsb));
s = write(fd, VSB_data(vsmw->vsb), VSB_len(vsmw->vsb));
assert(s == VSB_len(vsmw->vsb));
AZ(close(fd));
AZ(renameat(vsmw->vdirfd, t, vsmw->vdirfd, vsmw->idx));
REPLACE(t, NULL);
}
}
示例13: VRT_rel_vcl
void
VRT_rel_vcl(VRT_CTX, struct vclref **refp)
{
struct vcl *vcl;
struct vclref *ref;
AN(refp);
ref = *refp;
*refp = NULL;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ref, VCLREF_MAGIC);
vcl = ctx->vcl;
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
assert(vcl == ref->vcl);
/* NB: A VCL may be released by a VMOD at any time, but it must happen
* after a warmup and before the end of a cooldown. The release may or
* may not happen while the same thread holds the temperature lock, so
* instead we check that all references are gone in VCL_Nuke.
*/
Lck_Lock(&vcl_mtx);
assert(!VTAILQ_EMPTY(&vcl->ref_list));
VTAILQ_REMOVE(&vcl->ref_list, ref, list);
vcl->nrefs--;
/* No garbage collection here, for the same reasons as in VCL_Rel. */
Lck_Unlock(&vcl_mtx);
FREE_OBJ(ref);
}
示例14: ObjIterEnd
void
ObjIterEnd(struct objiter **oi)
{
CHECK_OBJ_NOTNULL((*oi), OBJITER_MAGIC);
FREE_OBJ((*oi));
}
示例15: vbp_wrk_poll_backend
static void *
vbp_wrk_poll_backend(void *priv)
{
struct vbp_target *vt;
THR_SetName("backend poll");
CAST_OBJ_NOTNULL(vt, priv, VBP_TARGET_MAGIC);
while (!vt->stop) {
AN(vt->req);
assert(vt->req_len > 0);
if (!vt->disable) {
vbp_start_poke(vt);
vbp_poke(vt);
vbp_has_poked(vt);
}
if (!vt->stop)
VTIM_sleep(vt->probe.interval);
}
Lck_Delete(&vt->mtx);
VTAILQ_REMOVE(&vbp_list, vt, list);
VBT_Rel(&vt->tcp_pool);
free(vt->req);
FREE_OBJ(vt);
return (NULL);
}