Lennart:

[Regarding fixes to src/Makefile.am]
This has already been fixed properly in the latest release (0.7).

http://git.0pointer.de/?p=libcanberra.git;a=commitdiff;h=0f3825b0c40ca379e6b5d2e3e862130c8ccb65f5

Great.  I've tested with the latest code in Makefile.am and it works
great.  No need to further patch things.

However, I notice the 0.6 version is the latest version at the
download website:

 http://0pointer.de/public

Is the 0.7 version not released yet?

- In order for var-args stuff to build on Solaris, it is necessary to
  add "#include <varargs.h>" to src/common.h

I am a bit surprised that this is sufficient. Source files like
proplist.c use va_ functions, but don't include either src/common.h
nor varags.h themselves.

varargs.h is considered "legacy" by Single UNIX/POSIX. Are you sure
that Solaris doesn't have stdargs.h like every other ANSI C89
implementation? If so, could you please fix this patch to include
stdargs.h instead of varargs.h?


According to the Solaris manpage for "var_start", "va_end" and other
related interfaces, it claims you need to include:

     #include <sys/varargs.h>

So, I've updated the patch so that if building on Solaris, it will
add this.  Does this seem reasonable?

- Solaris doesn't have strndup, so the attached patch adds it to
  src/sound-theme-spec.c if it isn't already defined.

Could you please move this to malloc.[ch]? The reason we have
malloc.[ch] is explicitly to allow implementation of ca_strndup() as a
macro where strndup is supported and as function where it is not. I'd
prefer not to pollute unrelated code with implementations with strndup
if we don't have to.

I think the attached version of the patch addresses the issues you
raise.

Can these two patches go upstream?

Thanks,

Brian
--- libcanberra-0.6/src/malloc.c-orig	2008-08-21 00:32:28.025248000 -0500
+++ libcanberra-0.6/src/malloc.c	2008-08-21 00:31:54.646231000 -0500
@@ -58,3 +58,30 @@ char *ca_sprintf_malloc(const char *form
             size *= 2;
     }
 }
+
+#ifndef strndup
+char *strndup (const char *s, size_t n)
+{
+    size_t length;
+    char *ret;
+
+    if (!s)
+        return NULL;
+
+    length = strnlen (s, n) + 1;
+    if (length >= n+1)
+       length = n+1;
+
+    ret = malloc (length * sizeof (char));
+    if (ret == NULL)
+       return ret;
+
+    ret = memcpy (ret, s, length);
+    if (ret == NULL)
+       return ret;
+
+    ret[length-1] = '\0';
+    return ret;
+}
+#endif
+
--- libcanberra-0.6/src/common.h-orig	2008-08-21 00:21:50.594788000 -0500
+++ libcanberra-0.6/src/common.h	2008-08-21 00:22:25.218467000 -0500
@@ -21,6 +21,10 @@
   <http://www.gnu.org/licenses/>.
 ***/
 
+#ifdef __sun
+#include <sys/varargs.h>
+#endif
+
 #include "canberra.h"
 #include "macro.h"
 #include "mutex.h"
_______________________________________________
libcanberra-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/libcanberra-discuss

Reply via email to