[babl] babl: strip out some internal length returning code



commit afc68fb90192c25510f30d0ca60c484509b2202d
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun Jan 7 00:42:33 2018 +0100

    babl: strip out some internal length returning code

 babl/babl-conversion.c     |    4 +--
 babl/babl-fish-path.c      |   53 ++++++++++++++++++++------------------------
 babl/babl-fish-reference.c |   14 ++++++-----
 babl/babl-internal.h       |    4 +-
 4 files changed, 35 insertions(+), 40 deletions(-)
---
diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c
index 17dccf8..b9df9af 100644
--- a/babl/babl-conversion.c
+++ b/babl/babl-conversion.c
@@ -359,7 +359,7 @@ babl_conversion_planar_process (BablConversion *conversion,
                                       conversion->data);
 }
 
-long
+void
 babl_conversion_process (const Babl *babl,
                          const char *source,
                          char       *destination,
@@ -436,13 +436,11 @@ babl_conversion_process (const Babl *babl,
         babl_log ("args=(%s, %p, %p, %li) unhandled conversion type: %s",
                   conversion->instance.name, source, destination, n,
                   babl_class_name (conversion->instance.class_type));
-        return 0;
         break;
     }
 
   conversion->processings++;
   conversion->pixels += n;
-  return n;
 }
 
 long
diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c
index 7878c1c..2d8bd9e 100644
--- a/babl/babl-fish-path.c
+++ b/babl/babl-fish-path.c
@@ -74,7 +74,7 @@ get_path_instrumentation (FishPathInstrumentation *fpi,
                           double                  *path_error);
 
 
-static long
+static void
 process_conversion_path (BablList   *path,
                          const void *source_buffer,
                          int         source_bpp,
@@ -607,7 +607,7 @@ babl_fish_path (const Babl *source,
   return babl_fish_path2 (source, destination, 0.0);
 }
 
-static long
+static void
 babl_fish_path_process (const Babl *babl,
                         const void *source,
                         void       *destination,
@@ -642,41 +642,38 @@ babl_fish_path_process (const Babl *babl,
          babl_log ("-eeek{%i}\n", babl_dest->instance.class_type - BABL_MAGIC);
      }
 
-  return process_conversion_path (babl->fish_path.conversion_list,
-                                  source,
-                                  source_bpp,
-                                  destination,
-                                  dest_bpp,
-                                  n);
+  process_conversion_path (babl->fish_path.conversion_list,
+                           source,
+                           source_bpp,
+                           destination,
+                           dest_bpp,
+                           n);
 }
 
-static long
+static void
 _babl_fish_process (const Babl *babl,
                     const void *source,
                     void       *destination,
                     long        n)
 {
-  long ret = 0;
-
   switch (babl->class_type)
     {
       case BABL_FISH_REFERENCE:
         if (babl->fish.source == babl->fish.destination)
           { /* XXX: we're assuming linear buffers */
             memcpy (destination, source, n * babl->fish.source->format.bytes_per_pixel);
-            ret = n;
           }
         else
           {
-            ret = babl_fish_reference_process (babl, source, destination, n);
+            babl_fish_reference_process (babl, source, destination, n);
           }
         break;
 
       case BABL_FISH_SIMPLE:
         if (BABL (babl->fish_simple.conversion)->class_type == BABL_CONVERSION_LINEAR)
           {
-            ret = babl_conversion_process (BABL (babl->fish_simple.conversion),
-                                           source, destination, n);
+            babl_conversion_process (BABL (babl->fish_simple.conversion),
+                                     source, destination, n);
           }
         else
           {
@@ -685,30 +682,28 @@ _babl_fish_process (const Babl *babl,
         break;
 
       case BABL_FISH_PATH:
-        ret = babl_fish_path_process (babl, source, destination, n);
+        babl_fish_path_process (babl, source, destination, n);
         break;
 
       default:
         babl_log ("NYI");
-        ret = -1;
         break;
     }
-  return ret;
 }
 
-long
+void
 babl_fish_process (const Babl *babl,
                    const void *source,
                    void       *destination,
                    long        n);
 
-long
+void
 babl_fish_process (const Babl *babl,
                    const void *source,
                    void       *destination,
                    long        n)
 {
-  return _babl_fish_process (babl, source, destination, n);
+  _babl_fish_process (babl, source, destination, n);
 }
 
 long
@@ -718,10 +713,9 @@ babl_process (const Babl *cbabl,
               long        n)
 {
   Babl *babl = (Babl*)cbabl;
-  babl_assert (babl);
+  babl_assert (babl && BABL_IS_BABL (babl));
   babl_assert (source);
   babl_assert (destination);
-  babl_assert (BABL_IS_BABL (babl));
   if (n == 0)
     return 0;
   babl_assert (n > 0);
@@ -731,15 +725,18 @@ babl_process (const Babl *cbabl,
       babl->class_type <= BABL_FISH_PATH)
     {
       babl->fish.processings++;
-      babl->fish.pixels +=
-             _babl_fish_process (babl, source, destination, n);
+      babl->fish.pixels += n;
+      _babl_fish_process (babl, source, destination, n);
       return n;
     }
 
   /* matches all conversion classes */
   if (babl->class_type >= BABL_CONVERSION &&
       babl->class_type <= BABL_CONVERSION_PLANAR)
-    return babl_conversion_process (babl, source, destination, n);
+  {
+    babl_conversion_process (babl, source, destination, n);
+    return n;
+  }
 
   babl_fatal ("eek");
   return -1;
@@ -755,7 +752,7 @@ static void inline *align_16 (unsigned char *ret)
   return ret;
 }
 
-static long
+static void
 process_conversion_path (BablList   *path,
                          const void *source_buffer,
                          int         source_bpp,
@@ -823,8 +820,6 @@ process_conversion_path (BablList   *path,
                                    c);
         }
   }
-
-  return n;
 }
 
 static void
diff --git a/babl/babl-fish-reference.c b/babl/babl-fish-reference.c
index 96be9ac..a018566 100644
--- a/babl/babl-fish-reference.c
+++ b/babl/babl-fish-reference.c
@@ -388,7 +388,7 @@ process_to_n_component (const Babl  *babl,
   return 0;
 }
 
-static int
+static void
 process_same_model (const Babl  *babl,
                     const char *source,
                     char       *destination,
@@ -438,10 +438,9 @@ process_same_model (const Babl  *babl,
       );
     }
   babl_free (double_buf);
-  return 0;
 }
 
-long
+void
 babl_fish_reference_process (const Babl *babl,
                              const char *source,
                              char       *destination,
@@ -459,11 +458,15 @@ babl_fish_reference_process (const Babl *babl,
       (BABL (babl->fish.source)->format.space ==
        BABL (babl->fish.destination)->format.space)
       )
-    return process_same_model (babl, source, destination, n);
+  {
+    process_same_model (babl, source, destination, n);
+    return;
+  }
 
   if (babl_format_is_format_n (BABL (babl->fish.destination)))
   {
-    return process_to_n_component (babl, source, destination, n);
+    process_to_n_component (babl, source, destination, n);
+    return;
   }
 
   source_double_buf = babl_malloc (sizeof (double) * n *
@@ -561,5 +564,4 @@ babl_fish_reference_process (const Babl *babl,
   babl_free (destination_double_buf);
   babl_free (rgba_double_buf);
   babl_free (source_double_buf);
-  return n;
 }
diff --git a/babl/babl-internal.h b/babl/babl-internal.h
index 3362563..f7d001f 100644
--- a/babl/babl-internal.h
+++ b/babl/babl-internal.h
@@ -66,7 +66,7 @@ Babl *   babl_conversion_find           (const void     *source,
                                          const void     *destination);
 double   babl_conversion_error          (BablConversion *conversion);
 long     babl_conversion_cost           (BablConversion *conversion);
-long     babl_conversion_process        (const Babl     *conversion,
+void     babl_conversion_process        (const Babl     *conversion,
                                          const char     *source,
                                          char           *destination,
                                          long            n);
@@ -79,7 +79,7 @@ void     babl_set_extender              (Babl           *new_extender);
 Babl   * babl_extension_quiet_log       (void);
 void     babl_extension_deinit          (void);
 
-long     babl_fish_reference_process    (const Babl *babl,
+void     babl_fish_reference_process    (const Babl *babl,
                                          const char *source,
                                          char       *destination,
                                          long        n);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]