aboutsummaryrefslogtreecommitdiff
path: root/src/glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glue.c')
-rw-r--r--src/glue.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/glue.c b/src/glue.c
index 6821d3e..70b0bf5 100644
--- a/src/glue.c
+++ b/src/glue.c
@@ -1,4 +1,4 @@
-/*
+/*
* glue: glue two lists together (use [list append] instead)
*
* (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem)
@@ -7,12 +7,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -22,8 +22,7 @@
static t_class *glue_class;
-typedef struct _zglue
-{
+typedef struct _zglue {
t_object x_obj;
t_atom *ap2, *ap;
@@ -32,17 +31,21 @@ typedef struct _zglue
t_int changed;
} t_glue;
-static void glue_lst2(t_glue *x, t_symbol* UNUSED(s), int argc, t_atom *argv)
+static void glue_lst2(t_glue *x, t_symbol* UNUSED(s), int argc,
+ t_atom *argv)
{
x->changed = 1;
if (x->n2 != argc) {
freebytes(x->ap2, x->n2 * sizeof(t_atom));
x->n2 = argc;
x->ap2 = copybytes(argv, argc * sizeof(t_atom));
- } else memcpy(x->ap2, argv, argc * sizeof(t_atom));
+ } else {
+ memcpy(x->ap2, argv, argc * sizeof(t_atom));
+ }
}
-static void glue_lst(t_glue *x, t_symbol* UNUSED(s), int argc, t_atom *argv)
+static void glue_lst(t_glue *x, t_symbol* UNUSED(s), int argc,
+ t_atom *argv)
{
if (x->n != x->n2+argc) {
freebytes(x->ap, x->n * sizeof(t_atom));
@@ -50,7 +53,9 @@ static void glue_lst(t_glue *x, t_symbol* UNUSED(s), int argc, t_atom *argv)
x->n = x->n1+x->n2;
x->ap = (t_atom *)getbytes(sizeof(t_atom)*x->n);
memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
- } else if ((x->n1 != argc)||x->changed)memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
+ } else if ((x->n1 != argc)||x->changed) {
+ memcpy(x->ap+argc, x->ap2, x->n2*sizeof(t_atom));
+ }
x->n1 = argc;
memcpy(x->ap, argv, x->n1*sizeof(t_atom));
@@ -63,7 +68,7 @@ static void glue_lst(t_glue *x, t_symbol* UNUSED(s), int argc, t_atom *argv)
static void glue_bang(t_glue *x)
{
if (x->changed) {
- if (x->n1+x->n2 != x->n){
+ if (x->n1+x->n2 != x->n) {
t_atom *ap = (t_atom*)getbytes(sizeof(t_atom)*(x->n1+x->n2));
memcpy(ap, x->ap, x->n1*sizeof(t_atom));
freebytes(x->ap, sizeof(t_atom)*x->n);
@@ -93,7 +98,9 @@ static void *glue_new(t_symbol* UNUSED(s), int argc, t_atom *argv)
x->ap=x->ap2 = 0;
x->changed = 0;
- if (argc)glue_lst2(x, gensym("list"), argc, argv);
+ if (argc) {
+ glue_lst2(x, gensym("list"), argc, argv);
+ }
return (x);
}
@@ -105,8 +112,8 @@ static void glue_help(t_glue*x)
void glue_setup(void)
{
- glue_class = class_new(gensym("glue"), (t_newmethod)glue_new,
- (t_method)glue_free, sizeof(t_glue), 0, A_GIMME, 0);
+ glue_class = class_new(gensym("glue"), (t_newmethod)glue_new,
+ (t_method)glue_free, sizeof(t_glue), 0, A_GIMME, 0);
class_addlist(glue_class, glue_lst);
class_addmethod (glue_class, (t_method)glue_lst2, gensym(""), A_GIMME, 0);
class_addbang(glue_class, glue_bang);