Skip to contentSkip to conversation

fix for strl functions in alsautils

PATCH Khem Raj 2 participants 6 messages Jan 26, 2009 – Feb 12, 2009

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

* These funtions are provided by C libraries like uclibc Declaring them static here causes static not static declaration issues reported by gcc.

---
 packages/alsa/alsa-utils_1.0.18.bb                 |    2 +
 .../files/alsa-utils-strl-funcs-non-static.patch   |   22
++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644

packages/alsa/files/alsa-utils-strl-funcs-non-static.patch

(quoted diff) +0 -0

b/packages/alsa/alsa-utils_1.0.18.bb
index 8f43982..4de9180 100644

packages/alsa/alsa-utils_1.0.18.bb +1 -0
@@ -3,10 +3,12 @@ HOMEPAGE = "http://www.alsa-project.org"
 SECTION = "console/utils"
 LICENSE = "GPL"
 DEPENDS = "alsa-lib ncurses"
+PR = "r1"
 
 SRC_URI =
"ftp://ftp.alsa-project.org/pub/utils/alsa-utils-${PV}.tar.bz2 \
            file://alsa-utils-automake.patch;patch=1 \
           file://alsa-utils-remove-xmlto.patch;patch=1 \
+          file://alsa-utils-strl-funcs-non-static.patch;patch=1 \
          "

inherit autotools

(quoted diff) +0 -0

b/packages/alsa/files/alsa-utils-strl-funcs-non-static.patch new file mode 100644
index 0000000..db6bacf

packages/alsa/files/alsa-utils-strl-funcs-non-static.patch new file +3 -0
@@ -0,0 +1,22 @@
+Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
+===================================================================
+--- alsa-utils-1.0.18.orig/alsactl/init_sysdeps.c      2009-01-25

21:12:40.000000000 -0800
++++ alsa-utils-1.0.18/alsactl/init_sysdeps.c 2009-01-25
21:12:56.000000000 -0800
+@@ -18,7 +18,7 @@
+ */
+
+ #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)
+ {
+ size_t bytes = 0;
+ char *q = dst;
+@@ -37,7 +37,7 @@
+ return bytes;
+ }
+
+-static size_t strlcat(char *dst, const char *src, size_t size) ++size_t strlcat(char *dst, const char *src, size_t size)
+ {
+ size_t bytes = 0;
+ char *q = dst;
--
1.6.0.4

#1 lore raw
Quoted 8 lines · Khem Raj

* 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.

p.

author
#2 lore raw
Quoted 10 lines · Phil Blundell
Quoted 8 lines · Khem Raj

* 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)
+ {

Quoted 3 lines

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

alsactl/init_sysdeps.c +5 -2
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
@@ -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 */
configure.in +1 -1
Index: alsa-utils-1.0.18/configure.in
===================================================================
@@ -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
author
#3 lore raw
In reply to Phil Blundell
Quoted 10 lines · Phil Blundell
Quoted 8 lines · Khem Raj

* 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)
+ {

Quoted 3 lines

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.

Quoted 9 lines

p.

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

alsactl/init_sysdeps.c +5 -2
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
@@ -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 */
configure.in +1 -1
Index: alsa-utils-1.0.18/configure.in
===================================================================
@@ -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
author
#4 lore raw
In reply to Phil Blundell
Quoted 10 lines · Phil Blundell
Quoted 8 lines · Khem Raj

* 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)
+ {

Quoted 3 lines

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.

alsactl/init_sysdeps.c +5 -2
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
@@ -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 */
configure.in +1 -1
Index: alsa-utils-1.0.18/configure.in
===================================================================
@@ -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
author
#5 lore raw
In reply to Phil Blundell
Quoted 10 lines · Phil Blundell
Quoted 8 lines · Khem Raj

* 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)
+ {

Quoted 3 lines

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

alsactl/init_sysdeps.c +5 -2
Index: alsa-utils-1.0.18/alsactl/init_sysdeps.c
===================================================================
@@ -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 */
configure.in +1 -1
Index: alsa-utils-1.0.18/configure.in
===================================================================
@@ -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