Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21347
Modified Files: Tag: desiredata kernel.c builtins.c Log Message: replace freebytes by free.
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -C2 -d -r1.1.2.31 -r1.1.2.32 *** kernel.c 5 Jan 2007 01:54:19 -0000 1.1.2.31 --- kernel.c 9 Jan 2007 15:03:38 -0000 1.1.2.32 *************** *** 89,93 **** /* get original memory location */ void *ori = *(void **)((unsigned char *)ptr-sizeof(void *)); ! freebytes(ori,nbytes+(VECTORALIGNMENT/8-1)+sizeof(void *)); }
--- 89,93 ---- /* get original memory location */ void *ori = *(void **)((unsigned char *)ptr-sizeof(void *)); ! free(ori); }
*************** *** 332,336 **** if (y->ob_binbuf) binbuf_free(y->ob_binbuf); } ! if (c->size) t_freebytes(x, c->size); }
--- 332,336 ---- if (y->ob_binbuf) binbuf_free(y->ob_binbuf); } ! if (c->size) free(x); }
*************** *** 400,412 **** if ((e = b->b_list)->who == x) { b->b_list = e->next; ! freebytes(e, sizeof(t_bindelem)); } else for (e = b->b_list; (e2=e->next); e = e2) if (e2->who == x) { e->next = e2->next; ! freebytes(e2, sizeof(t_bindelem)); break; } if (!b->b_list->next) { s->thing = b->b_list->who; ! freebytes(b->b_list, sizeof(t_bindelem)); pd_free(&b->b_pd); } --- 400,412 ---- if ((e = b->b_list)->who == x) { b->b_list = e->next; ! free(e); } else for (e = b->b_list; (e2=e->next); e = e2) if (e2->who == x) { e->next = e2->next; ! free(e2); break; } if (!b->b_list->next) { s->thing = b->b_list->who; ! free(b->b_list); pd_free(&b->b_pd); } *************** *** 465,469 **** s__X.thing = headwas->g_what; gstack_head = headwas->g_next; ! t_freebytes(headwas, sizeof(*headwas)); lastpopped = x; } --- 465,469 ---- s__X.thing = headwas->g_what; gstack_head = headwas->g_next; ! free(headwas); lastpopped = x; } *************** *** 764,768 **** break; } ! t_freebytes(x, sizeof(*x)); }
--- 764,768 ---- break; } ! free(x); }
*************** *** 1350,1356 **** classname++; } ! if(count>0)return altname; ! /* seems like the given classname is fine as can be */ ! freebytes(altname, sizeof(char)*MAXPDSTRING); return 0; } --- 1350,1355 ---- classname++; } ! if(count>0) return altname; ! free(altname); return 0; } *************** *** 1657,1664 **** }
! void binbuf_free(t_binbuf *x) { ! t_freebytes(x->vec, x->n * sizeof(*x->vec)); ! t_freebytes(x, sizeof(*x)); ! }
t_binbuf *binbuf_duplicate(t_binbuf *y) { --- 1656,1660 ---- }
! void binbuf_free(t_binbuf *x) {free(x->vec); free(x);}
t_binbuf *binbuf_duplicate(t_binbuf *y) { *************** *** 2209,2218 **** error("read (%d %ld) -> %d; %s: %s\n", fd, length, readret, namebuf, strerror(errno)); close(fd); ! t_freebytes(buf, length); return 1; } if (flags&1) for (int i=0; i<length; i++) if (buf[i]=='\n') buf[i] = ';'; if (flags&2) pd_eval_text(buf,length); else binbuf_text(b, buf, length); ! t_freebytes(buf, length); close(fd); return 0; --- 2205,2214 ---- error("read (%d %ld) -> %d; %s: %s\n", fd, length, readret, namebuf, strerror(errno)); close(fd); ! free(buf); return 1; } if (flags&1) for (int i=0; i<length; i++) if (buf[i]=='\n') buf[i] = ';'; if (flags&2) pd_eval_text(buf,length); else binbuf_text(b, buf, length); ! free(buf); close(fd); return 0;
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -C2 -d -r1.1.2.9 -r1.1.2.10 *** builtins.c 4 Jan 2007 21:45:29 -0000 1.1.2.9 --- builtins.c 9 Jan 2007 15:03:38 -0000 1.1.2.10 *************** *** 322,326 **** } } ! t_freebytes(buf, length); binbuf_free(b); } --- 322,326 ---- } } ! free(buf); binbuf_free(b); } *************** *** 685,691 **** (x).l_vec = (t_listelem *)((n) < LIST_NGETBYTE ? \ alloca((n) * sizeof(t_listelem)) : getbytes((n) * sizeof(t_listelem)))) \ ! #define LIST_FREEA(x) ( \ ! ((x).n < LIST_NGETBYTE || ! (freebytes((x).l_vec, (x).n * sizeof(t_listelem)), 0)))
#else --- 685,689 ---- (x).l_vec = (t_listelem *)((n) < LIST_NGETBYTE ? \ alloca((n) * sizeof(t_listelem)) : getbytes((n) * sizeof(t_listelem)))) \ ! #define LIST_FREEA(x) (((x).n < LIST_NGETBYTE || (free((x).l_vec), 0)))
#else *************** *** 693,697 **** (x).n = (n), \ (x).l_vec = (t_listelem *)getbytes((n) * sizeof(t_listelem))) ! #define LIST_FREEA(x) (freebytes((x).l_vec, (x).n * sizeof(t_listelem))) #endif #endif --- 691,695 ---- (x).n = (n), \ (x).l_vec = (t_listelem *)getbytes((n) * sizeof(t_listelem))) ! #define LIST_FREEA(x) (free((x).l_vec)) #endif #endif *************** *** 701,708 **** alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) #define ATOMS_FREEA(x, n) ( \ ! ((n) < LIST_NGETBYTE || (freebytes((x), (n) * sizeof(t_atom)), 0))) #else #define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) ! #define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) #endif
--- 699,706 ---- alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) #define ATOMS_FREEA(x, n) ( \ ! ((n) < LIST_NGETBYTE || (free((x)), 0))) #else #define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) ! #define ATOMS_FREEA(x, n) (free((x))) #endif
*************** *** 721,725 **** for (int i = 0; i < x->n; i++) if (x->l_vec[i].a.a_type == A_POINTER) gpointer_unset(x->l_vec[i].a.a_w.w_gpointer); ! if (x->l_vec) freebytes(x->l_vec, x->n * sizeof(*x->l_vec)); } static void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv) { --- 719,723 ---- for (int i = 0; i < x->n; i++) if (x->l_vec[i].a.a_type == A_POINTER) gpointer_unset(x->l_vec[i].a.a_w.w_gpointer); ! if (x->l_vec) free(x->l_vec); } static void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv) { *************** *** 1521,1527 **** outlet_symbol(x->rejectout, s); } ! static void sel2_free(t_sel2 *x) { ! freebytes(x->vec, x->nelement * sizeof(*x->vec)); ! } static void *select_new(t_symbol *s, int argc, t_atom *argv) { t_atom a; --- 1519,1523 ---- outlet_symbol(x->rejectout, s); } ! static void sel2_free(t_sel2 *x) {free(x->vec);} static void *select_new(t_symbol *s, int argc, t_atom *argv) { t_atom a; *************** *** 1625,1630 **** for (int n = x->n; n--; e++) { if (e->e_w.w_symbol == &s_list) { ! if (argc > 0 && argv[0].a_type == A_SYMBOL) ! outlet_anything(e->e_outlet, argv[0].a_w.w_symbol, argc-1, argv+1); else outlet_list(e->e_outlet, 0, argc, argv); return; --- 1621,1625 ---- for (int n = x->n; n--; e++) { if (e->e_w.w_symbol == &s_list) { ! if (argv[0].a_type==A_SYMBOL) outlet_anything(e->e_outlet, argv[0].a_w.w_symbol, argc-1, argv+1); else outlet_list(e->e_outlet, 0, argc, argv); return; *************** *** 1660,1664 **** }
! static void route_free(t_route *x) {freebytes(x->vec, x->n * sizeof(*x->vec));} static void *route_new(t_symbol *s, int argc, t_atom *argv) { t_route *x = (t_route *)pd_new(route_class); --- 1655,1659 ---- }
! static void route_free(t_route *x) {free(x->vec);} static void *route_new(t_symbol *s, int argc, t_atom *argv) { t_route *x = (t_route *)pd_new(route_class); *************** *** 1761,1765 **** memcpy(outvec, x->vec, size); outlet_list(x->outlet, &s_list, x->n, outvec); ! if (reentered) t_freebytes(outvec, size); else x->outvec = outvec; }
--- 1756,1760 ---- memcpy(outvec, x->vec, size); outlet_list(x->outlet, &s_list, x->n, outvec); ! if (reentered) free(outvec); else x->outvec = outvec; }
*************** *** 1790,1801 **** SETSYMBOL(av2, s); obj_list(x, 0, ac+1, av2); ! freebytes(av2, (ac + 1) * sizeof(t_atom)); } static void pack_free(t_pack *x) { t_gpointer *gp=x->gpointer; for (int i = x->nptr; i--; gp++) gpointer_unset(gp); ! freebytes(x->vec, x->n * sizeof(*x->vec)); ! freebytes(x->outvec, x->n * sizeof(*x->outvec)); ! freebytes(x->gpointer, x->nptr * sizeof(*x->gpointer)); } static void pack_setup() { --- 1785,1796 ---- SETSYMBOL(av2, s); obj_list(x, 0, ac+1, av2); ! free(av2); } static void pack_free(t_pack *x) { t_gpointer *gp=x->gpointer; for (int i = x->nptr; i--; gp++) gpointer_unset(gp); ! free(x->vec); ! free(x->outvec); ! free(x->gpointer); } static void pack_setup() { *************** *** 1843,1848 **** u->outlet = outlet_new(x, &s_pointer); } else { ! if (c != 'f') pd_error(x, "unpack: %s: bad type", ! ap->a_w.w_symbol->name); u->type = A_FLOAT; u->outlet = outlet_new(x, &s_float); --- 1838,1842 ---- u->outlet = outlet_new(x, &s_pointer); } else { ! if (c != 'f') pd_error(x, "unpack: %s: bad type", ap->a_w.w_symbol->name); u->type = A_FLOAT; u->outlet = outlet_new(x, &s_float); *************** *** 1872,1878 **** SETSYMBOL(av2, s); unpack_list(x, 0, ac+1, av2); ! freebytes(av2, (ac + 1) * sizeof(t_atom)); } ! static void unpack_free(t_unpack *x) {freebytes(x->vec, x->n * sizeof(*x->vec));} static void unpack_setup() { unpack_class = class_new2("unpack",unpack_new,unpack_free,sizeof(t_unpack),0,"*"); --- 1866,1872 ---- SETSYMBOL(av2, s); unpack_list(x, 0, ac+1, av2); ! free(av2); } ! static void unpack_free(t_unpack *x) {free(x->vec);} static void unpack_setup() { unpack_class = class_new2("unpack",unpack_new,unpack_free,sizeof(t_unpack),0,"*"); *************** *** 1955,1959 **** static void trigger_symbol(t_trigger *x, t_symbol *s) { t_atom at; SETSYMBOL(&at, s); trigger_list(x, 0, 1, &at);} ! static void trigger_free(t_trigger *x) {freebytes(x->vec, x->n * sizeof(*x->vec));} static void trigger_setup() { trigger_class = class_new2("trigger",trigger_new,trigger_free,sizeof(t_trigger),0,"*"); --- 1949,1953 ---- static void trigger_symbol(t_trigger *x, t_symbol *s) { t_atom at; SETSYMBOL(&at, s); trigger_list(x, 0, 1, &at);} ! static void trigger_free(t_trigger *x) {free(x->vec);} static void trigger_setup() { trigger_class = class_new2("trigger",trigger_new,trigger_free,sizeof(t_trigger),0,"*"); *************** *** 2703,2707 **** } clock_free(hang->clock); ! freebytes(hang, sizeof(*hang)); } static void makenote_float(t_makenote *x, t_float f) { --- 2697,2701 ---- } clock_free(hang->clock); ! free(hang); } static void makenote_float(t_makenote *x, t_float f) { *************** *** 2725,2729 **** x->hang = hang->next; clock_free(hang->clock); ! freebytes(hang, sizeof(*hang)); } } --- 2719,2723 ---- x->hang = hang->next; clock_free(hang->clock); ! free(hang); } } *************** *** 2733,2737 **** x->hang = hang->next; clock_free(hang->clock); ! freebytes(hang, sizeof(*hang)); } } --- 2727,2731 ---- x->hang = hang->next; clock_free(hang->clock); ! free(hang); } } *************** *** 2855,2859 **** for (int i = x->n; i--; v++) v->used = v->serial = 0; } ! static void poly_free(t_poly *x) {freebytes(x->vec, x->n * sizeof (*x->vec));} static void poly_setup() { poly_class = class_new2("poly",poly_new,poly_free,sizeof(t_poly),0,"FF"); --- 2849,2853 ---- for (int i = x->n; i--; v++) v->used = v->serial = 0; } ! static void poly_free(t_poly *x) {free(x->vec);} static void poly_setup() { poly_class = class_new2("poly",poly_new,poly_free,sizeof(t_poly),0,"FF"); *************** *** 2896,2905 **** bagelem = x->first; x->first = x->first->next; ! freebytes(bagelem, sizeof(*bagelem)); return; } for (e2 = x->first; (e3 = e2->next); e2 = e3) if (e3->value == f) { e2->next = e3->next; ! freebytes(e3, sizeof(*e3)); return; } --- 2890,2899 ---- bagelem = x->first; x->first = x->first->next; ! free(bagelem); return; } for (e2 = x->first; (e3 = e2->next); e2 = e3) if (e3->value == f) { e2->next = e3->next; ! free(e3); return; } *************** *** 2911,2915 **** outlet_float(x->outlet, bagelem->value); x->first = bagelem->next; ! freebytes(bagelem, sizeof(*bagelem)); } } --- 2905,2909 ---- outlet_float(x->outlet, bagelem->value); x->first = bagelem->next; ! free(bagelem); } } *************** *** 2918,2922 **** while ((bagelem = x->first)) { x->first = bagelem->next; ! freebytes(bagelem, sizeof(*bagelem)); } } --- 2912,2916 ---- while ((bagelem = x->first)) { x->first = bagelem->next; ! free(bagelem); } } *************** *** 3190,3196 **** t_gpointer *gp = h->h_gp; for (int i = x->nptr; i--; gp++) gpointer_unset(gp); ! freebytes(h->h_gp, x->nptr * sizeof(*h->h_gp)); clock_free(h->h_clock); ! freebytes(h, sizeof(*h) + (x->n - 1) * sizeof(*h->h_vec)); } static void hang_tick(t_hang2 *h) { --- 3184,3190 ---- t_gpointer *gp = h->h_gp; for (int i = x->nptr; i--; gp++) gpointer_unset(gp); ! free(h->h_gp); clock_free(h->h_clock); ! free(h); } static void hang_tick(t_hang2 *h) {