* Re: fix for strl functions in alsautils
2009-01-26 8:24 ` Phil Blundell
@ 2009-02-11 7:29 ` Khem Raj
2009-02-11 19:36 ` Khem Raj
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2009-02-11 7:29 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
On (26/01/09 08:24), Phil Blundell wrote:
> On Sun, 2009-01-25 at 23:49 -0800, Khem Raj wrote:
> > * These funtions are provided by C libraries like uclibc
> > Declaring them static here causes static not static declaration
> > issues reported by gcc.
> > [...]
> > + #ifdef __GLIBC__
> > +-static size_t strlcpy(char *dst, const char *src, size_t size)
> > ++size_t strlcpy(char *dst, const char *src, size_t size)
> > + {
>
> Wouldn't it be better to change that "#ifdef __GLIBC__" to something
> more appropriate? With your change it looks like you will still get
> useless copies of these functions in the resulting binaries.
Phil and all
Attached patch checks for these functions during configure time.
it will also cover the uclibc kconfig time case.
Thx
-Khem
[-- Attachment #2: alsa-utils-autoconf-strl-funcs.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c 2008-10-29 05:42:11.000000000 -0700
+++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2009-02-10 23:17:47.000000000 -0800
@@ -17,7 +17,7 @@
*
*/
-#ifdef __GLIBC__
+#if !HAVE_STRLCPY
static size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -36,7 +36,10 @@
*q = '\0';
return bytes;
}
+#endif /* !HAVE_STRLCPY */
+
+#if !HAVE_STRLCAT
static size_t strlcat(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -60,4 +63,4 @@
*q = '\0';
return bytes;
}
-#endif /* __GLIBC__ */
+#endif /* !HAVE_STRLCAT */
Index: alsa-utils-1.0.18/configure.in
===================================================================
--- alsa-utils-1.0.18.orig/configure.in 2008-10-29 05:48:01.000000000 -0700
+++ alsa-utils-1.0.18/configure.in 2009-02-10 23:02:07.000000000 -0800
@@ -6,7 +6,7 @@
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.15])
-
+AC_CHECK_FUNCS(strlcat strlcpy)
dnl Checks for programs.
dnl try to gues cross-compiler if not set
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: fix for strl functions in alsautils
2009-01-26 8:24 ` Phil Blundell
2009-02-11 7:29 ` Khem Raj
@ 2009-02-11 19:36 ` Khem Raj
2009-02-12 0:40 ` Khem Raj
2009-02-12 5:28 ` Khem Raj
3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2009-02-11 19:36 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
On (26/01/09 08:24), Phil Blundell wrote:
> On Sun, 2009-01-25 at 23:49 -0800, Khem Raj wrote:
> > * These funtions are provided by C libraries like uclibc
> > Declaring them static here causes static not static declaration
> > issues reported by gcc.
> > [...]
> > + #ifdef __GLIBC__
> > +-static size_t strlcpy(char *dst, const char *src, size_t size)
> > ++size_t strlcpy(char *dst, const char *src, size_t size)
> > + {
>
> Wouldn't it be better to change that "#ifdef __GLIBC__" to something
> more appropriate? With your change it looks like you will still get
> useless copies of these functions in the resulting binaries.
Attached patch detects these functions during configure and
includes/excludes them accordingly.
>
> p.
>
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
[-- Attachment #2: alsa-utils-autoconf-strl-funcs.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c 2008-10-29 05:42:11.000000000 -0700
+++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2009-02-10 23:17:47.000000000 -0800
@@ -17,7 +17,7 @@
*
*/
-#ifdef __GLIBC__
+#if !HAVE_STRLCPY
static size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -36,7 +36,10 @@
*q = '\0';
return bytes;
}
+#endif /* !HAVE_STRLCPY */
+
+#if !HAVE_STRLCAT
static size_t strlcat(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -60,4 +63,4 @@
*q = '\0';
return bytes;
}
-#endif /* __GLIBC__ */
+#endif /* !HAVE_STRLCAT */
Index: alsa-utils-1.0.18/configure.in
===================================================================
--- alsa-utils-1.0.18.orig/configure.in 2008-10-29 05:48:01.000000000 -0700
+++ alsa-utils-1.0.18/configure.in 2009-02-10 23:02:07.000000000 -0800
@@ -6,7 +6,7 @@
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.15])
-
+AC_CHECK_FUNCS(strlcat strlcpy)
dnl Checks for programs.
dnl try to gues cross-compiler if not set
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: fix for strl functions in alsautils
2009-01-26 8:24 ` Phil Blundell
2009-02-11 7:29 ` Khem Raj
2009-02-11 19:36 ` Khem Raj
@ 2009-02-12 0:40 ` Khem Raj
2009-02-12 5:28 ` Khem Raj
3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2009-02-12 0:40 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 692 bytes --]
On (26/01/09 08:24), Phil Blundell wrote:
> On Sun, 2009-01-25 at 23:49 -0800, Khem Raj wrote:
> > * These funtions are provided by C libraries like uclibc
> > Declaring them static here causes static not static declaration
> > issues reported by gcc.
> > [...]
> > + #ifdef __GLIBC__
> > +-static size_t strlcpy(char *dst, const char *src, size_t size)
> > ++size_t strlcpy(char *dst, const char *src, size_t size)
> > + {
>
> Wouldn't it be better to change that "#ifdef __GLIBC__" to something
> more appropriate? With your change it looks like you will still get
> useless copies of these functions in the resulting binaries.
here is a different patch.
[-- Attachment #2: alsa-utils-autoconf-strl-funcs.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c 2008-10-29 05:42:11.000000000 -0700
+++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2009-02-10 23:17:47.000000000 -0800
@@ -17,7 +17,7 @@
*
*/
-#ifdef __GLIBC__
+#if !HAVE_STRLCPY
static size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -36,7 +36,10 @@
*q = '\0';
return bytes;
}
+#endif /* !HAVE_STRLCPY */
+
+#if !HAVE_STRLCAT
static size_t strlcat(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -60,4 +63,4 @@
*q = '\0';
return bytes;
}
-#endif /* __GLIBC__ */
+#endif /* !HAVE_STRLCAT */
Index: alsa-utils-1.0.18/configure.in
===================================================================
--- alsa-utils-1.0.18.orig/configure.in 2008-10-29 05:48:01.000000000 -0700
+++ alsa-utils-1.0.18/configure.in 2009-02-10 23:02:07.000000000 -0800
@@ -6,7 +6,7 @@
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.15])
-
+AC_CHECK_FUNCS(strlcat strlcpy)
dnl Checks for programs.
dnl try to gues cross-compiler if not set
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: fix for strl functions in alsautils
2009-01-26 8:24 ` Phil Blundell
` (2 preceding siblings ...)
2009-02-12 0:40 ` Khem Raj
@ 2009-02-12 5:28 ` Khem Raj
3 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2009-02-12 5:28 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 777 bytes --]
On Mon, Jan 26, 2009 at 12:24 AM, Phil Blundell <pb@reciva.com> wrote:
> On Sun, 2009-01-25 at 23:49 -0800, Khem Raj wrote:
>> * These funtions are provided by C libraries like uclibc
>> Declaring them static here causes static not static declaration
>> issues reported by gcc.
>> [...]
>> + #ifdef __GLIBC__
>> +-static size_t strlcpy(char *dst, const char *src, size_t size)
>> ++size_t strlcpy(char *dst, const char *src, size_t size)
>> + {
>
> Wouldn't it be better to change that "#ifdef __GLIBC__" to something
> more appropriate? With your change it looks like you will still get
> useless copies of these functions in the resulting binaries.
Here is alternative patch. Somehow I am having problem sending emails.
Thanks
-Khem
[-- Attachment #2: alsa-utils-autoconf-strl-funcs.patch --]
[-- Type: text/x-patch, Size: 1165 bytes --]
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c 2008-10-29 05:42:11.000000000 -0700
+++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2009-02-10 23:17:47.000000000 -0800
@@ -17,7 +17,7 @@
*
*/
-#ifdef __GLIBC__
+#if !HAVE_STRLCPY
static size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -36,7 +36,10 @@
*q = '\0';
return bytes;
}
+#endif /* !HAVE_STRLCPY */
+
+#if !HAVE_STRLCAT
static size_t strlcat(char *dst, const char *src, size_t size)
{
size_t bytes = 0;
@@ -60,4 +63,4 @@
*q = '\0';
return bytes;
}
-#endif /* __GLIBC__ */
+#endif /* !HAVE_STRLCAT */
Index: alsa-utils-1.0.18/configure.in
===================================================================
--- alsa-utils-1.0.18.orig/configure.in 2008-10-29 05:48:01.000000000 -0700
+++ alsa-utils-1.0.18/configure.in 2009-02-10 23:02:07.000000000 -0800
@@ -6,7 +6,7 @@
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.15])
-
+AC_CHECK_FUNCS(strlcat strlcpy)
dnl Checks for programs.
dnl try to gues cross-compiler if not set
^ permalink raw reply [flat|nested] 6+ messages in thread