本文整理汇总了C++中pd_free函数的典型用法代码示例。如果您正苦于以下问题:C++ pd_free函数的具体用法?C++ pd_free怎么用?C++ pd_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pd_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hammerfile_free
void hammerfile_free(t_hammerfile *f)
{
t_hammerfile *prev, *next;
hammereditor_close(f, 0);
if (f->f_embedfn)
/* just in case of missing 'restore' */
hammerembed_gc(f->f_master, ps__C, 0);
if (f->f_savepanel)
{
pd_unbind((t_pd *)f->f_savepanel, f->f_savepanel->f_bindname);
pd_free((t_pd *)f->f_savepanel);
}
if (f->f_bindname) pd_unbind((t_pd *)f, f->f_bindname);
if (f->f_panelclock) clock_free(f->f_panelclock);
if (f->f_editorclock) clock_free(f->f_editorclock);
for (prev = 0, next = hammerfile_proxies;
next; prev = next, next = next->f_next)
if (next == f)
break;
if (prev)
prev->f_next = f->f_next;
else if (f == hammerfile_proxies)
hammerfile_proxies = f->f_next;
pd_free((t_pd *)f);
}
示例2: pd_string_free
void pd_string_free(t_pdstring *str)
{
if (!str) return;
if (str->strData)
{
pd_free(str->strData);
}
pd_free(str);
}
示例3: pando_buffer_delete
void FUNCTION_ATTRIBUTE pando_buffer_delete(struct pando_buffer *pdbuf)
{
if (pdbuf == NULL)
{
return;
}
if (pdbuf->buffer != NULL)
{
pd_free(pdbuf->buffer);
}
pd_free(pdbuf);
}
示例4: delete_device_package
void FUNCTION_ATTRIBUTE delete_device_package(struct sub_device_buffer *device_buffer)
{
if (device_buffer != NULL)
{
if (device_buffer->buffer != NULL)
{
pd_free(device_buffer->buffer);
device_buffer->buffer = NULL;
}
}
pd_free(device_buffer);
device_buffer = NULL;
}
示例5: sic_makecostable
static void *cycle_new(t_symbol *s, int ac, t_atom *av)
{
t_cycle *x = (t_cycle *)pd_new(cycle_class);
int i = (ac && av->a_type == A_FLOAT ? 1 : 0);
int tabsize = CYCLE_TABSIZE;
x->x_costable = sic_makecostable(&tabsize);
if (tabsize != CYCLE_TABSIZE)
{
loudbug_bug("cycle_new");
pd_free((t_pd *)x);
return (0);
}
if (ac && av->a_type == A_FLOAT)
{
sic_inlet((t_sic *)x, 0, 0, 0, ac, av);
ac--, av++;
}
sic_newinlet((t_sic *)x, 0);
outlet_new((t_object *)x, &s_signal);
x->x_offset = 0;
if (ac && av->a_type == A_SYMBOL)
{
x->x_name = av->a_w.w_symbol;
ac--, av++;
if (ac && av->a_type == A_FLOAT)
if ((x->x_offset = (int)av->a_w.w_float) < 0)
x->x_offset = 0;
}
else x->x_name = 0;
x->x_table = 0;
x->x_phase = 0.;
x->x_conv = 0.;
return (x);
}
示例6: multireceive_free
static void multireceive_free(t_multireceive *x)
{
multireceive_clear(x);
pd_free((t_pd *)x->x_proxy);
outlet_free(x->x_out);
x->x_out=NULL;
}
示例7: dict_unbind
/* adapted pd_unbind() from m_pd.c */
void dict_unbind(t_dict *x, t_pd *obj, t_symbol *s)
{
#ifdef DICT_DEBUG
post("unbind %x from \"%s\" at %x", (int)obj, s->s_name, (int)s);
#endif
if (s->s_thing == obj) s->s_thing = 0;
else if (s->s_thing && *s->s_thing == x->d_bindlist_class)
{
/* bindlists always have at least two elements... if the number
goes down to one, get rid of the bindlist and bind the symbol
straight to the remaining element. */
t_dict_bindlist *b = (t_dict_bindlist *)s->s_thing;
t_dict_bindelem *e, *e2;
if ((e = b->b_list)->e_who == obj)
{
b->b_list = e->e_next;
freebytes(e, sizeof(t_dict_bindelem));
}
else for (e = b->b_list; e2 = e->e_next; e = e2)
if (e2->e_who == obj)
{
e->e_next = e2->e_next;
freebytes(e2, sizeof(t_dict_bindelem));
break;
}
if (!b->b_list->e_next)
{
s->s_thing = b->b_list->e_who;
freebytes(b->b_list, sizeof(t_dict_bindelem));
pd_free(&b->b_pd);
}
}
else pd_error(obj, "%s: couldn't unbind", s->s_name);
}
示例8: pd_alloc
packet_data* pd_alloc(uint16_t size, uint16_t block_size)
{
packet_data* pd = NULL;
packet_data* next = NULL;
while(size)
{
uint16_t alloc_size = size > block_size ? block_size : size;
if (next == NULL)
{
pd = bget(align_size(sizeof(packet_data) + alloc_size));
next = pd;
} else
{
next->next = bget(align_size(sizeof(packet_data) + alloc_size));
next = next->next;
}
if (next == NULL)
{
pd_free(pd);
return NULL;
}
pd->data = (uint8_t*)pd + sizeof(packet_data);
pd->next = NULL;
pd->size = alloc_size;
pd->total_size = size;
pd->refs_count = 1;
size -= alloc_size;
}
return pd;
}
示例9: bindlist_cleanup
static void bindlist_cleanup(t_bindlist *x)
{
//fprintf(stderr,"bindlist_cleanup\n");
t_bindelem *e, *e2;
if (x->b_list->e_who == NULL)
{
e = x->b_list;
x->b_list = e->e_next;
freebytes(e, sizeof(t_bindelem));
//fprintf(stderr,"success B1a\n");
}
for (e = x->b_list; e2 = e->e_next; e = e2)
if (e2->e_who == NULL)
{
e->e_next = e2->e_next;
freebytes(e2, sizeof(t_bindelem));
//fprintf(stderr,"success B1b\n");
break;
}
if (!x->b_list->e_next)
{
freebytes(x->b_list, sizeof(t_bindelem));
pd_free(&x->b_pd);
//fprintf(stderr,"success B2\n");
}
}
示例10: calloc
struct pt_directive *pd_alloc(size_t n)
{
struct pt_directive *pd;
pd = calloc(1, sizeof(*pd));
if (!pd)
return NULL;
pd->name = malloc(n);
if (!pd->name)
goto error;
pd->payload = malloc(n);
if (!pd->payload)
goto error;
pd->nlen = n;
pd->plen = n;
return pd;
error:
pd_free(pd);
return NULL;
}
示例11: add_next_property
/* malloc a new block to save old buffer and new property, and update the package length */
int FUNCTION_ATTRIBUTE add_next_property(struct sub_device_buffer *data_package, uint16_t property_num, struct TLVs *next_data_params)
{
uint8_t *old_buffer = NULL;
uint8_t *position = NULL;
uint16_t old_len = 0;
uint16_t subdevice_id;
if (data_package == NULL)
{
return -1;
}
old_buffer = data_package->buffer;
old_len = data_package->buffer_length;
/* append payload length */
data_package->buffer_length += (sizeof(struct pando_property)
+ current_tlv_block_size - sizeof(struct TLVs));
data_package->buffer = (uint8_t *)pd_malloc(data_package->buffer_length);
pd_memset(data_package->buffer, 0, data_package->buffer_length);
/* copy old content and new property */
position = copy_return_next(data_package->buffer, old_buffer, old_len);
subdevice_id = 0;
position = copy_return_next(position, &subdevice_id, sizeof(subdevice_id));
property_num = host16_to_net(property_num);
position = copy_return_next(position, &property_num, sizeof(property_num));
pd_memcpy(position, next_data_params, current_tlv_block_size);
pd_free(old_buffer);
return 0;
}
示例12: pd_unbind
void pd_unbind(t_pd *x, t_symbol *s)
{
if (s->s_thing == x) s->s_thing = 0;
else if (s->s_thing && *s->s_thing == bindlist_class)
{
/* bindlists always have at least two elements... if the number
goes down to one, get rid of the bindlist and bind the symbol
straight to the remaining element. */
t_bindlist *b = (t_bindlist *)s->s_thing;
t_bindelem *e, *e2;
if ((e = b->b_list)->e_who == x)
{
b->b_list = e->e_next;
freebytes(e, sizeof(t_bindelem));
}
else for (e = b->b_list; e2 = e->e_next; e = e2)
if (e2->e_who == x)
{
e->e_next = e2->e_next;
freebytes(e2, sizeof(t_bindelem));
break;
}
if (!b->b_list->e_next)
{
s->s_thing = b->b_list->e_who;
freebytes(b->b_list, sizeof(t_bindelem));
pd_free(&b->b_pd);
}
}
else pd_error(x, "%s: couldn't unbind", s->s_name);
}
示例13: delete_pando_objects_iterator
void FUNCTION_ATTRIBUTE
delete_pando_objects_iterator(pando_objects_iterator* it)
{
if(it)
{
pd_free(it);
}
}
示例14: delete_params_block
void delete_params_block(struct TLVs *params_block)
{
if (params_block != NULL)
{
pd_free(params_block);
params_block = NULL;
}
}
示例15: delete_params_block
void FUNCTION_ATTRIBUTE delete_params_block(struct TLVs *params_block)
{
if (params_block != NULL)
{
pd_free(params_block);
params_block = NULL;
}
}