History

Make use of C99 bool type

evpobr committed 6 years ago

Commit 4ff9f4a1 parent ece92456 files · +13 −5Browse files

Unified · Split

6 files
  1. CMakeLists.txt +1 −0
  2. config.h.in +3 −0
  3. configure.ac +1 −0
  4. src/common.h +3 −0
  5. src/src_linear.c +2 −2
  6. src/src_zoh.c +3 −3
CMakeLists.txt+1−0
@@ -92,6 +92,7 @@ clip_mode() · 91 unmodified lines
9292 check_function_exists(alarm HAVE_ALARM)
9393 check_function_exists(signal HAVE_SIGNAL)
9494
95+check_include_file(stdbool.h HAVE_STDBOOL_H)
9596 check_include_file(sys/times.h HAVE_SYS_TIMES_H)
9697 check_include_file(unistd.h HAVE_UNISTD_H)
9798
config.h.in+3−0
@@ -48,6 +48,9 @@ · 47 unmodified lines
4848 /* Set to 1 if you have libsndfile. */
4949 #cmakedefine01 HAVE_SNDFILE
5050
51+/* Define to 1 if you have the <stdbool.h> header file. */
52+#cmakedefine HAVE_STDBOOL_H
53+
5154 /* Define to 1 if you have the <stdint.h> header file. */
5255 #cmakedefine01 HAVE_STDINT_H
5356
configure.ac+1−0
@@ -87,6 +87,7 @@ AS_IF([test "x${build_os}${host_os}" = "xmingw32mingw32"], [ · 86 unmodified lines
8787 ])
8888
8989 AC_HEADER_STDC
90+AC_HEADER_STDBOOL
9091
9192 AC_CHECK_HEADERS([stdint.h sys/times.h])
9293
src/common.h+3−0
@@ -10,6 +10,9 @@ · 9 unmodified lines
1010 #define COMMON_H_INCLUDED
1111
1212 #include <stdint.h>
13+#ifdef HAVE_STDBOOL_H
14+#include <stdbool.h>
15+#endif
1316
1417 #include <math.h>
1518
src/src_linear.c+2−2
@@ -55,7 +55,7 @@ linear_vari_process (SRC_STATE *state, SRC_DATA *data) · 54 unmodified lines
5555 { /* If we have just been reset, set the last_value data. */
5656 for (ch = 0 ; ch < priv->channels ; ch++)
5757 priv->last_value [ch] = data->data_in [ch] ;
58− priv->dirty = 1 ;
58+ priv->dirty = true ;
5959 } ;
6060
6161 priv->in_count = data->input_frames * priv->channels ;
@@ -203,7 +203,7 @@ linear_reset (SRC_STATE *state) · 141 unmodified lines
203203 return ;
204204
205205 priv->channels = state->channels ;
206− priv->dirty = 0 ;
206+ priv->dirty = false ;
207207 memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
208208
209209 return ;
src/src_zoh.c+3−3
@@ -26,7 +26,7 @@ static int zoh_copy (SRC_STATE *from, SRC_STATE *to) ; · 25 unmodified lines
2626 typedef struct
2727 { int zoh_magic_marker ;
2828 int channels ;
29− int dirty ;
29+ bool dirty ;
3030 long in_count, in_used ;
3131 long out_count, out_gen ;
3232 float last_value [] ;
@@ -53,7 +53,7 @@ zoh_vari_process (SRC_STATE *state, SRC_DATA *data) · 20 unmodified lines
5353 { /* If we have just been reset, set the last_value data. */
5454 for (ch = 0 ; ch < priv->channels ; ch++)
5555 priv->last_value [ch] = data->data_in [ch] ;
56− priv->dirty = 1 ;
56+ priv->dirty = true ;
5757 } ;
5858
5959 priv->in_count = data->input_frames * priv->channels ;
@@ -194,7 +194,7 @@ zoh_reset (SRC_STATE *state) · 134 unmodified lines
194194 return ;
195195
196196 priv->channels = state->channels ;
197− priv->dirty = 0 ;
197+ priv->dirty = false ;
198198 memset (priv->last_value, 0, sizeof (priv->last_value [0]) * priv->channels) ;
199199
200200 return ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t