shithub: sox

Download patch

ref: dbb82f1e4d35b3737201508c04a867619f79891b
parent: 55d494351ed2a9e02fd4db726f689e5d9654cc5d
author: rrt <rrt>
date: Tue Jan 16 21:26:13 EST 2007

Make static functions not have the skel_ prefix or skeleff_ prefix,
which leaves less to change when reusing the code.

--- a/src/skeleff.c
+++ b/src/skeleff.c
@@ -34,7 +34,7 @@
  * Don't do initialization now.
  * The 'info' fields are not yet filled in.
  */
-static int skeleff_getopts(eff_t effp, int n, char **argv)
+static int getopts(eff_t effp, int n, char **argv)
 {
   skeleff_t skeleff = (skeleff_t)effp->priv;
 
@@ -51,7 +51,7 @@
  * Do all initializations.
  * If there's nothing to do, use st_effect_nothing instead.
  */
-static int skeleff_start(eff_t effp)
+static int start(eff_t effp)
 {
   if (effp->outinfo.channels == 1) {
     st_fail("Can't run skeleff on mono data.");
@@ -65,7 +65,7 @@
  * Processed signed long samples from ibuf to obuf.
  * Return number of samples processed.
  */
-static int skeleff_flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 
+static int flow(eff_t effp, const st_sample_t *ibuf, st_sample_t *obuf, 
                            st_size_t *isamp, st_size_t *osamp)
 {
   skeleff_t skeleff = (skeleff_t)effp->priv;
@@ -99,7 +99,7 @@
  * Drain out remaining samples if the effect generates any.
  * If there's nothing to do, use st_effect_nothing_drain instead.
  */
-static int skeleff_drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
+static int drain(eff_t effp, st_sample_t *obuf, st_size_t *osamp)
 {
   *osamp = 0;
   /* Help out application and return ST_EOF when drain
@@ -113,7 +113,7 @@
  * Do anything required when you stop reading samples.  
  * If there's nothing to do, use st_effect_nothing instead.
  */
-static int skeleff_stop(eff_t effp)
+static int stop(eff_t effp)
 {
   return ST_SUCCESS;
 }
@@ -123,7 +123,7 @@
  *      (free allocated memory, etc.)
  * If there's nothing to do, use st_effect_nothing instead.
  */
-static int skeleff_delete(eff_t effp)
+static int delete(eff_t effp)
 {
   return ST_SUCCESS;
 }
@@ -138,12 +138,12 @@
   "skel",
   "Usage: skel [option]",
   ST_EFF_MCHAN,
-  skeleff_getopts,
-  skeleff_start,
-  skeleff_flow,
-  skeleff_drain,
-  skeleff_stop,
-  skeleff_delete,
+  getopts,
+  start,
+  flow,
+  drain,
+  stop,
+  delete,
 };
 
 /*
--- a/src/skelform.c
+++ b/src/skelform.c
@@ -41,7 +41,7 @@
  *      size and encoding of samples,
  *      mono/stereo/quad.
  */
-static int skel_startread(ft_t ft)
+static int startread(ft_t ft)
 {
   skelform_t sk = (skelform_t)ft->priv;
   st_size_t samples_in_file;
@@ -84,7 +84,7 @@
  * Read up to len samples of type st_sample_t from file into buf[].
  * Return number of samples read.
  */
-static st_size_t skel_read(ft_t ft, st_sample_t *buf, st_size_t len)
+static st_size_t read(ft_t ft, st_sample_t *buf, st_size_t len)
 {
   skelform_t sk = (skelform_t)ft->priv;
   st_size_t done;
@@ -105,12 +105,12 @@
         *buf++ = ST_UNSIGNED_BYTE_TO_SAMPLE(sample,);
         break;
       default:
-        st_fail("Undetected sample encoding in skel_read!");
+        st_fail("Undetected sample encoding in read!");
         exit(2);
       }
       break;
     default:
-      st_fail("Undetected bad sample size in skel_read!");
+      st_fail("Undetected bad sample size in read!");
       exit(2);
     }
   }
@@ -122,12 +122,12 @@
  * Do anything required when you stop reading samples.
  * Don't close input file!
  */
-static int skel_stopread(ft_t ft)
+static int stopread(ft_t ft)
 {
   return ST_SUCCESS;
 }
 
-static int skel_startwrite(ft_t ft)
+static int startwrite(ft_t ft)
 {
   skelform_t sk = (skelform_t)ft->priv;
 
@@ -163,7 +163,7 @@
  * Write len samples of type st_sample_t from buf[] to file.
  * Return number of samples written.
  */
-static st_size_t skel_write(ft_t ft, const st_sample_t *buf, st_size_t len)
+static st_size_t write(ft_t ft, const st_sample_t *buf, st_size_t len)
 {
   skelform_t sk = (skelform_t)ft->priv;
 
@@ -178,12 +178,12 @@
       }
       break;
     default:
-      st_fail("Undetected bad sample encoding in skel_read!");
+      st_fail("Undetected bad sample encoding in write!");
       exit(2);
     }
     break;
   default:
-    st_fail("Undetected bad sample size in skel_read!");
+    st_fail("Undetected bad sample size in write!");
     exit(2);
   }
 
@@ -190,7 +190,7 @@
   return len;
 }
 
-static int skel_stopwrite(ft_t ft)
+static int stopwrite(ft_t ft)
 {
   /* All samples are already written out. */
   /* If file header needs fixing up, for example it needs the number
@@ -198,7 +198,7 @@
   return ST_SUCCESS;
 }
 
-static int skel_seek(ft_t ft, st_size_t offset)
+static int seek(ft_t ft, st_size_t offset)
 {
   /* Seek relative to current position. */
   return ST_SUCCESS;
@@ -205,7 +205,7 @@
 }
 
 /* Format file suffixes */
-static const char *skel_names[] = {
+static const char *names[] = {
   "skel",
   NULL
 };
@@ -212,16 +212,16 @@
 
 /* Format descriptor */
 static st_format_t st_skel_format = {
-  skel_names,
+  names,
   NULL,
   ST_FILE_SEEK,
-  skel_startread,
-  skel_read,
-  skel_stopread,
-  skel_startwrite,
-  skel_write,
-  skel_stopwrite,
-  skel_seek
+  startread,
+  read,
+  stopread,
+  startwrite,
+  write,
+  stopwrite,
+  seek
 };
 
 const st_format_t *st_skel_format_fn(void)