Skip to contentSkip to conversation

alsa-lib: Add sys/types.h to include list

PATCH In review David Henningsson 3 participants 5 messages Feb 12, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa-lib: Add sys/types.h to include list

This is needed by snd_pcm_format_silence* functions which return u_int*_t. It was discovered while trying to compile ALSA programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
Adam Conrad for this fix.

---
 include/asoundlib-head.h |    1 +
 1 file changed, 1 insertion(+)
include/asoundlib-head.h +1 -0
index 20c8a68..6edbab0 100644
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <string.h>
 #include <fcntl.h>
 #include <assert.h>
Signature · 1 line
1.7.9.5
#1 lore raw

At Tue, 12 Feb 2013 10:06:11 +0100,

Quoted 11 lines · David Henningsson

This is needed by snd_pcm_format_silence* functions which return u_int*_t. It was discovered while trying to compile ALSA programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
Adam Conrad for this fix.

For u_int_* types, wouldn't it better to include stdint.h?

Takashi

Quoted 19 lines
---
 include/asoundlib-head.h |    1 +
 1 file changed, 1 insertion(+)
include/asoundlib-head.h +1 -0
index 20c8a68..6edbab0 100644
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
 #include <string.h>
 #include <fcntl.h>
 #include <assert.h>
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 7 lines · Takashi Iwai

At Tue, 12 Feb 2013 10:06:11 +0100,

Quoted 5 lines · David Henningsson

This is needed by snd_pcm_format_silence* functions which return u_int*_t. It was discovered while trying to compile ALSA programs with eglibc 2.17.

Quoted 8 lines
Quoted 6 lines

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
Adam Conrad for this fix.

For u_int_* types, wouldn't it better to include stdint.h?

Hmm, it looks like stdint.h declares uint_* whereas sys/types.h declares u_int_* (notice the _ between "u" and "int"). Do you think we should change snd_pcm_format_silence* from u_int to uint?

Quoted 24 lines

Takashi

Quoted 19 lines
---
  include/asoundlib-head.h |    1 +
  1 file changed, 1 insertion(+)
include/asoundlib-head.h +1 -1
index 20c8a68..6edbab0 100644
@@ -31,6 +31,7 @@
  #include <unistd.h>
  #include <stdio.h>
  #include <stdlib.h>
+#include <sys/types.h>
  #include <string.h>
  #include <fcntl.h>
  #include <assert.h>
--

1.7.9.5

Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
#3 lore raw

At Tue, 12 Feb 2013 10:16:13 +0100,

Quoted 16 lines · David Henningsson
Quoted 14 lines · Takashi Iwai

At Tue, 12 Feb 2013 10:06:11 +0100,

Quoted 11 lines · David Henningsson

This is needed by snd_pcm_format_silence* functions which return u_int*_t. It was discovered while trying to compile ALSA programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
Adam Conrad for this fix.

Quoted 5 lines
Quoted 1 line

For u_int_* types, wouldn't it better to include stdint.h?

Hmm, it looks like stdint.h declares uint_* whereas sys/types.h declares u_int_* (notice the _ between "u" and "int"). Do you think we should change snd_pcm_format_silence* from u_int to uint?

Ah, OK, then sys/types.h is the right inclusion.

Maybe conversion to uint_*_t would be more universal, but I don't think it's worth, as these types are used in many places in the public API already.

I'll take your patch as is now.

thanks,

Takashi

#4 lore raw
In reply to David Henningsson
Quoted 19 lines · David Henningsson

This is needed by snd_pcm_format_silence* functions which return u_int*_t. It was discovered while trying to compile ALSA programs with eglibc 2.17.

Credits to Richard Shaw, Gary Buhrmaster, Matthieu Baerts and
Adam Conrad for this fix.

---
 include/asoundlib-head.h |    1 +
 1 file changed, 1 insertion(+)
include/asoundlib-head.h +0 -0
index 20c8a68..6edbab0 100644

include/asoundlib-head.h line 34

Quoted 4 lines
include/asoundlib-head.h +1 -0
@@ -31,6 +31,7 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>

int*_t and uint*_t (not u_int*_t) are standard in C99, and they are available in stdint.h or inttypes.h (both work, inttypes.h contains also the PRI* constants for the corresponding printf() format specifiers). Perhaps it would be better to use one of those headers instead? That would require converting u_int*_t usage to uint*_t, though, so it would take some extra work...

Signature · 1 line
Tanu