Revert of Moved the ringbuffer to be built using C++ (patchset #2 id:20001 of https://codereview.webrtc.org/1851873003/ )

Reason for revert:
This CL is dependent on the  CL https://codereview.webrtc.org/1846903004/ which caused a google3 breakage due to dependencies in Google3.

I will fix that, and reland this CL.

Original issue's description:
> Moved the ringbuffer to be built using C++
>
> BUG=webrtc:5724
>
> Committed: https://crrev.com/677e5774eaf287fa02f75fd5c8ad3f9ded9ed9c4
> Cr-Commit-Position: refs/heads/master@{#12230}

TBR=ivoc@webrtc.org,henrik.lundin@webrtc.org,kwiberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5724

Review URL: https://codereview.webrtc.org/1858873003

Cr-Commit-Position: refs/heads/master@{#12231}
diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn
index 7960368..bf7bdc5 100644
--- a/webrtc/modules/audio_processing/BUILD.gn
+++ b/webrtc/modules/audio_processing/BUILD.gn
@@ -121,7 +121,7 @@
     "utility/delay_estimator_wrapper.h",
     "utility/lapped_transform.cc",
     "utility/lapped_transform.h",
-    "utility/ring_buffer.cc",
+    "utility/ring_buffer.c",
     "utility/ring_buffer.h",
     "vad/common.h",
     "vad/gmm.cc",
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 5af6e5d..4fe635d 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -33,8 +33,8 @@
 #include "webrtc/modules/audio_processing/logging/aec_logging.h"
 extern "C" {
 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
-}
 #include "webrtc/modules/audio_processing/utility/ring_buffer.h"
+}
 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h"
 #include "webrtc/typedefs.h"
 
diff --git a/webrtc/modules/audio_processing/aec/aec_core_internal.h b/webrtc/modules/audio_processing/aec/aec_core_internal.h
index 79af29d..1f4f99b 100644
--- a/webrtc/modules/audio_processing/aec/aec_core_internal.h
+++ b/webrtc/modules/audio_processing/aec/aec_core_internal.h
@@ -15,7 +15,9 @@
 #include "webrtc/modules/audio_processing/aec/aec_common.h"
 #include "webrtc/modules/audio_processing/aec/aec_core.h"
 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h"
+extern "C" {
 #include "webrtc/modules/audio_processing/utility/ring_buffer.h"
+}
 
 #include "webrtc/typedefs.h"
 
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h b/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
index 9779d6f..537ab5d 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation_internal.h
@@ -12,7 +12,9 @@
 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_ECHO_CANCELLATION_INTERNAL_H_
 
 #include "webrtc/modules/audio_processing/aec/aec_core.h"
+extern "C" {
 #include "webrtc/modules/audio_processing/utility/ring_buffer.h"
+}
 
 namespace webrtc {
 
diff --git a/webrtc/modules/audio_processing/audio_processing.gypi b/webrtc/modules/audio_processing/audio_processing.gypi
index 1fa4a85..75da59f 100644
--- a/webrtc/modules/audio_processing/audio_processing.gypi
+++ b/webrtc/modules/audio_processing/audio_processing.gypi
@@ -131,7 +131,7 @@
         'utility/delay_estimator_wrapper.h',
         'utility/lapped_transform.cc',
         'utility/lapped_transform.h',
-        'utility/ring_buffer.cc',
+        'utility/ring_buffer.c',
         'utility/ring_buffer.h',
         'vad/common.h',
         'vad/gmm.cc',
diff --git a/webrtc/modules/audio_processing/utility/ring_buffer.cc b/webrtc/modules/audio_processing/utility/ring_buffer.c
similarity index 88%
rename from webrtc/modules/audio_processing/utility/ring_buffer.cc
rename to webrtc/modules/audio_processing/utility/ring_buffer.c
index e5c86cd..c71bac1 100644
--- a/webrtc/modules/audio_processing/utility/ring_buffer.cc
+++ b/webrtc/modules/audio_processing/utility/ring_buffer.c
@@ -42,6 +42,7 @@
                                    size_t* data_ptr_bytes_1,
                                    void** data_ptr_2,
                                    size_t* data_ptr_bytes_2) {
+
   const size_t readable_elements = WebRtc_available_read(buf);
   const size_t read_elements = (readable_elements < element_count ?
       readable_elements : element_count);
@@ -70,12 +71,12 @@
     return NULL;
   }
 
-  self = static_cast<RingBuffer*>(malloc(sizeof(RingBuffer)));
+  self = malloc(sizeof(RingBuffer));
   if (!self) {
     return NULL;
   }
 
-  self->data = static_cast<char*>(malloc(element_count * element_size));
+  self->data = malloc(element_count * element_size);
   if (!self->data) {
     free(self);
     self = NULL;
@@ -99,7 +100,7 @@
 }
 
 void WebRtc_FreeBuffer(void* handle) {
-  RingBuffer* self = static_cast<RingBuffer*>(handle);
+  RingBuffer* self = (RingBuffer*)handle;
   if (!self) {
     return;
   }
@@ -112,6 +113,7 @@
                          void** data_ptr,
                          void* data,
                          size_t element_count) {
+
   if (self == NULL) {
     return 0;
   }
@@ -135,8 +137,7 @@
       // We have a wrap around when reading the buffer. Copy the buffer data to
       // |data| and point to it.
       memcpy(data, buf_ptr_1, buf_ptr_bytes_1);
-      memcpy(static_cast<char*>(data) + buf_ptr_bytes_1, buf_ptr_2,
-             buf_ptr_bytes_2);
+      memcpy(((char*) data) + buf_ptr_bytes_1, buf_ptr_2, buf_ptr_bytes_2);
       buf_ptr_1 = data;
     } else if (!data_ptr) {
       // No wrap, but a memcpy was requested.
@@ -148,7 +149,7 @@
     }
 
     // Update read position
-    WebRtc_MoveReadPtr(self, static_cast<int>(read_count));
+    WebRtc_MoveReadPtr(self, (int) read_count);
 
     return read_count;
   }
@@ -196,9 +197,9 @@
   {
     // We need to be able to take care of negative changes, hence use "int"
     // instead of "size_t".
-    const int free_elements = static_cast<int>(WebRtc_available_write(self));
-    const int readable_elements = static_cast<int>(WebRtc_available_read(self));
-    int read_pos = static_cast<int>(self->read_pos);
+    const int free_elements = (int) WebRtc_available_write(self);
+    const int readable_elements = (int) WebRtc_available_read(self);
+    int read_pos = (int) self->read_pos;
 
     if (element_count > readable_elements) {
       element_count = readable_elements;
@@ -208,18 +209,18 @@
     }
 
     read_pos += element_count;
-    if (read_pos > static_cast<int>(self->element_count)) {
+    if (read_pos > (int) self->element_count) {
       // Buffer wrap around. Restart read position and wrap indicator.
-      read_pos -= static_cast<int>(self->element_count);
+      read_pos -= (int) self->element_count;
       self->rw_wrap = SAME_WRAP;
     }
     if (read_pos < 0) {
       // Buffer wrap around. Restart read position and wrap indicator.
-      read_pos += static_cast<int>(self->element_count);
+      read_pos += (int) self->element_count;
       self->rw_wrap = DIFF_WRAP;
     }
 
-    self->read_pos = static_cast<size_t>(read_pos);
+    self->read_pos = (size_t) read_pos;
 
     return element_count;
   }