[pulseaudio-discuss] [PATCH 04/10] Use pa_* instead of generic functions to improve portability
Colin Guthrie
gmane at colin.guthr.ie
Thu Jan 6 06:43:47 PST 2011
'Twas brillig, and Maarten Bosmans at 06/01/11 01:39 did gyre and gimble:
> ---
> src/pulse/context.c | 2 +-
> src/pulse/thread-mainloop.c | 2 +-
> src/pulsecore/inet_ntop.c | 3 ++-
> src/pulsecore/inet_pton.c | 4 +++-
> src/tests/asyncq-test.c | 2 +-
> src/tests/rtstutter.c | 3 ++-
> 6 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/src/pulse/context.c b/src/pulse/context.c
> index ca81650..7ede8a2 100644
> --- a/src/pulse/context.c
> +++ b/src/pulse/context.c
> @@ -578,7 +578,7 @@ static char *get_old_legacy_runtime_dir(void) {
> if (!pa_get_user_name(u, sizeof(u)))
> return NULL;
>
> - p = pa_sprintf_malloc("/tmp/pulse-%s", u);
> + p = pa_sprintf_malloc("%s/pulse-%s", pa_get_temp_dir(), u);
I'm not sure this is correct. pa_get_temp_dir() might return $HOME/tmp
(it does here) so this path is not correct (it is the old legacy runtime
dir after all). There was some talk to disable this anyway so it may be
worth just dropping the code.... (there is a configure switch for it
already IIRC). That can be in another patch tho' (after discussion), so
possibly just remove this hunk for now.
> diff --git a/src/pulsecore/inet_ntop.c b/src/pulsecore/inet_ntop.c
> index 1948f0f..a83c177 100644
> --- a/src/pulsecore/inet_ntop.c
> +++ b/src/pulsecore/inet_ntop.c
> @@ -38,7 +39,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) {
> struct in6_addr *in6 = (struct in6_addr*)src;
> #endif
>
> - assert(src && dst);
> + pa_assert(src && dst);
It would make sense to make these two separate asserts so we know which
one fails if it is ever triggered.... but that's not directly your fault :)
> diff --git a/src/pulsecore/inet_pton.c b/src/pulsecore/inet_pton.c
> index 041902a..9f48a3a 100644
> --- a/src/pulsecore/inet_pton.c
> +++ b/src/pulsecore/inet_pton.c
> @@ -37,7 +39,7 @@ int inet_pton(int af, const char *src, void *dst) {
> struct in6_addr *in6 = (struct in6_addr*)dst;
> #endif
>
> - assert(src && dst);
> + pa_assert(src && dst);
ditto
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mageia Contributor [http://www.mageia.org/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
More information about the pulseaudio-discuss
mailing list