Thread: [Tinyx-devel] [PATCH] LIBC: Fixing warnings and missing semi-colons and adding stddef.h header.
Status: Planning
                
                Brought to you by:
                
                    davidcohen
                    
                
            | 
      
      
      From: David C. <da...@gm...> - 2008-01-10 04:22:30
       | 
| This patch fixes warnings and missing semi-colons and adds stddef.h header,
needed by size_t type, on string.c's functions.
Signed-off-by: David Cohen <da...@gm...>
---
 include/libc/string.h |    6 ++++--
 lib/libc/string.c     |    6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/libc/string.h b/include/libc/string.h
index ce7c7db..c97a83e 100644
--- a/include/libc/string.h
+++ b/include/libc/string.h
@@ -22,8 +22,10 @@
 #ifndef __TINYX_LIBC_STRING_H
 #define __TINYX_LIBC_STRING_H
 
-void *memset(void *mem, int data, size_t count)
-void *memcpy(void *dest, const void *src, size_t count)
+#include <asm/stddef.h>
+
+void *memset(void *mem, int data, size_t count);
+void *memcpy(void *dest, const void *src, size_t count);
 char *strcat(char *str1, const char *str2);
 char *strchr(const char *str, int ch);
 int strcoll(const char *str1, const char *str2);
diff --git a/lib/libc/string.c b/lib/libc/string.c
index 0b9be1c..1a26851 100644
--- a/lib/libc/string.c
+++ b/lib/libc/string.c
@@ -75,7 +75,7 @@ char *strcat(char *str1, const char *str2)
  */
 char *strchr(const char *str, int ch)
 {
-	for (; *str != (char)ch; ++s)
+	for (; *str != (char)ch; ++str)
 		if (*str == '\0')
 			return NULL;
 	return (char *)str;
@@ -123,7 +123,7 @@ char *strcpy(char *str1, const char *str2)
 {
 	char *tmp = str1;
 
-	while ((*str1++ = *str2++) != '\0')
+	while ((*str1++ = *str2++) != '\0');
 
 	return tmp;
 }
@@ -172,7 +172,7 @@ char *strncat(char *str1, const char *str2, size_t count)
  */
 int strncmp(const char *str1, const char *str2, size_t count)
 {
-	signed char ret;
+	signed char ret = 0;
 
 	while (count) {
 		if ((ret = *str1 - *str2++) != 0 || !*str1++)
-- 
1.5.3.7
 | 
| 
      
      
      From: Felipe B. <me...@fe...> - 2008-01-10 12:55:17
       | 
| On Thu, Jan 10, 2008 at 12:21:36AM -0400, David Cohen wrote:
> This patch fixes warnings and missing semi-colons and adds stddef.h header,
> needed by size_t type, on string.c's functions.
> 
> Signed-off-by: David Cohen <da...@gm...>
Acked-by: Felipe Balbi <me...@fe...>
> ---
>  include/libc/string.h |    6 ++++--
>  lib/libc/string.c     |    6 +++---
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/include/libc/string.h b/include/libc/string.h
> index ce7c7db..c97a83e 100644
> --- a/include/libc/string.h
> +++ b/include/libc/string.h
> @@ -22,8 +22,10 @@
>  #ifndef __TINYX_LIBC_STRING_H
>  #define __TINYX_LIBC_STRING_H
>  
> -void *memset(void *mem, int data, size_t count)
> -void *memcpy(void *dest, const void *src, size_t count)
> +#include <asm/stddef.h>
> +
> +void *memset(void *mem, int data, size_t count);
> +void *memcpy(void *dest, const void *src, size_t count);
I can't believe i forgot the semicolon. Shame on me :-p
sorry for that.
>  char *strcat(char *str1, const char *str2);
>  char *strchr(const char *str, int ch);
>  int strcoll(const char *str1, const char *str2);
> diff --git a/lib/libc/string.c b/lib/libc/string.c
> index 0b9be1c..1a26851 100644
> --- a/lib/libc/string.c
> +++ b/lib/libc/string.c
> @@ -75,7 +75,7 @@ char *strcat(char *str1, const char *str2)
>   */
>  char *strchr(const char *str, int ch)
>  {
> -	for (; *str != (char)ch; ++s)
> +	for (; *str != (char)ch; ++str)
>  		if (*str == '\0')
>  			return NULL;
>  	return (char *)str;
> @@ -123,7 +123,7 @@ char *strcpy(char *str1, const char *str2)
>  {
>  	char *tmp = str1;
>  
> -	while ((*str1++ = *str2++) != '\0')
> +	while ((*str1++ = *str2++) != '\0');
>  
>  	return tmp;
>  }
> @@ -172,7 +172,7 @@ char *strncat(char *str1, const char *str2, size_t count)
>   */
>  int strncmp(const char *str1, const char *str2, size_t count)
>  {
> -	signed char ret;
> +	signed char ret = 0;
>  
>  	while (count) {
>  		if ((ret = *str1 - *str2++) != 0 || !*str1++)
> -- 
> 1.5.3.7
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Tinyx-devel mailing list
> Tin...@li...
> https://lists.sourceforge.net/lists/listinfo/tinyx-devel
-- 
Best Regards,
Felipe Balbi
me...@fe...
http://blog.felipebalbi.com
 | 
| 
      
      
      From: David C. <da...@gm...> - 2008-01-10 14:23:07
       | 
| Pushing it.
David
On Jan 10, 2008 8:57 AM, Felipe Balbi <me...@fe...> wrote:
> On Thu, Jan 10, 2008 at 12:21:36AM -0400, David Cohen wrote:
> > This patch fixes warnings and missing semi-colons and adds stddef.h header,
> > needed by size_t type, on string.c's functions.
> >
> > Signed-off-by: David Cohen <da...@gm...>
> Acked-by: Felipe Balbi <me...@fe...>
> > ---
> >  include/libc/string.h |    6 ++++--
> >  lib/libc/string.c     |    6 +++---
> >  2 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/libc/string.h b/include/libc/string.h
> > index ce7c7db..c97a83e 100644
> > --- a/include/libc/string.h
> > +++ b/include/libc/string.h
> > @@ -22,8 +22,10 @@
> >  #ifndef __TINYX_LIBC_STRING_H
> >  #define __TINYX_LIBC_STRING_H
> >
> > -void *memset(void *mem, int data, size_t count)
> > -void *memcpy(void *dest, const void *src, size_t count)
> > +#include <asm/stddef.h>
> > +
> > +void *memset(void *mem, int data, size_t count);
> > +void *memcpy(void *dest, const void *src, size_t count);
>
> I can't believe i forgot the semicolon. Shame on me :-p
>
> sorry for that.
>
>
> >  char *strcat(char *str1, const char *str2);
> >  char *strchr(const char *str, int ch);
> >  int strcoll(const char *str1, const char *str2);
> > diff --git a/lib/libc/string.c b/lib/libc/string.c
> > index 0b9be1c..1a26851 100644
> > --- a/lib/libc/string.c
> > +++ b/lib/libc/string.c
> > @@ -75,7 +75,7 @@ char *strcat(char *str1, const char *str2)
> >   */
> >  char *strchr(const char *str, int ch)
> >  {
> > -     for (; *str != (char)ch; ++s)
> > +     for (; *str != (char)ch; ++str)
> >               if (*str == '\0')
> >                       return NULL;
> >       return (char *)str;
> > @@ -123,7 +123,7 @@ char *strcpy(char *str1, const char *str2)
> >  {
> >       char *tmp = str1;
> >
> > -     while ((*str1++ = *str2++) != '\0')
> > +     while ((*str1++ = *str2++) != '\0');
> >
> >       return tmp;
> >  }
> > @@ -172,7 +172,7 @@ char *strncat(char *str1, const char *str2, size_t count)
> >   */
> >  int strncmp(const char *str1, const char *str2, size_t count)
> >  {
> > -     signed char ret;
> > +     signed char ret = 0;
> >
> >       while (count) {
> >               if ((ret = *str1 - *str2++) != 0 || !*str1++)
> > --
> > 1.5.3.7
> >
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> > _______________________________________________
> > Tinyx-devel mailing list
> > Tin...@li...
> > https://lists.sourceforge.net/lists/listinfo/tinyx-devel
>
> --
> Best Regards,
>
> Felipe Balbi
> me...@fe...
> http://blog.felipebalbi.com
>
 |