mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Ho <jonathanho15@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] string lib redundancy and whitespace clarity fixes
Date: Wed, 09 Feb 2005 16:32:29 -0800	[thread overview]
Message-ID: <420AAB9D.6010801@gmail.com> (raw)

Fixed some weird whitespace, solved redundancies (applies to v2.6.10).


Signed-off-by: Jonathan Ho <jonathanho15@gmail.com>


--- lib/string.c    Fri Dec 24 13:35:25 2004
+++ \documents and settings\jonathan\desktop/string.c    Wed Feb 09 
16:21:28 2005
@@ -38,7 +38,7 @@ int strnicmp(const char *s1, const char
     /* Yes, Virginia, it had better be unsigned */
     unsigned char c1, c2;
 
-    c1 = 0;    c2 = 0;
+    c1 = c2 = 0;
     if (len) {
         do {
             c1 = *s1; c2 = *s2;
@@ -253,12 +253,12 @@ EXPORT_SYMBOL(strncmp);
  * @s: The string to be searched
  * @c: The character to search for
  */
-char * strchr(const char * s, int c)
+char *strchr(const char * s, int c)
 {
-    for(; *s != (char) c; ++s)
+    for( ; *s != (char) c; s++)
         if (*s == '\0')
             return NULL;
-    return (char *) s;
+    return (char *)s;
 }
 EXPORT_SYMBOL(strchr);
 #endif
@@ -390,14 +390,14 @@ EXPORT_SYMBOL(strcspn);
  * @cs: The string to be searched
  * @ct: The characters to search for
  */
-char * strpbrk(const char * cs,const char * ct)
+char * strpbrk(const char *cs, const char *ct)
 {
-    const char *sc1,*sc2;
+    const char *sc1, *sc2;
 
-    for( sc1 = cs; *sc1 != '\0'; ++sc1) {
-        for( sc2 = ct; *sc2 != '\0'; ++sc2) {
+    for(sc1 = cs; *sc1 != '\0'; sc1++) {
+        for(sc2 = ct; *sc2 != '\0'; sc2++) {
             if (*sc1 == *sc2)
-                return (char *) sc1;
+                return (char *)sc1;
         }
     }
     return NULL;
@@ -417,7 +417,7 @@ EXPORT_SYMBOL(strpbrk);
  * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
  * Same semantics, slimmer shape. ;)
  */
-char * strsep(char **s, const char *ct)
+char *strsep(char **s, const char *ct)
 {
     char *sbegin = *s, *end;
 
@@ -444,9 +444,9 @@ EXPORT_SYMBOL(strsep);
  *
  * Do not use memset() to access IO space, use memset_io() instead.
  */
-void * memset(void * s,int c,size_t count)
+void *memset(void *s, int c, size_t count)
 {
-    char *xs = (char *) s;
+    char *xs = (char *)s;
 
     while (count--)
         *xs++ = c;
@@ -469,7 +469,7 @@ EXPORT_SYMBOL(memset);
  * You should not use this function to access IO space, use memcpy_toio()
  * or memcpy_fromio() instead.
  */
-void bcopy(const void * srcp, void * destp, size_t count)
+void bcopy(const void *srcp, void *destp, size_t count)
 {
     const char *src = srcp;
     char *dest = destp;
@@ -490,7 +490,7 @@ EXPORT_SYMBOL(bcopy);
  * You should not use this function to access IO space, use memcpy_toio()
  * or memcpy_fromio() instead.
  */
-void * memcpy(void * dest,const void *src,size_t count)
+void *memcpy(void *dest, const void *src, size_t count)
 {
     char *tmp = (char *) dest, *s = (char *) src;
 
@@ -563,17 +563,17 @@ EXPORT_SYMBOL(memcmp);
  * returns the address of the first occurrence of @c, or 1 byte past
  * the area if @c is not found
  */
-void * memscan(void * addr, int c, size_t size)
+void *memscan(void *addr, int c, size_t size)
 {
-    unsigned char * p = (unsigned char *) addr;
+    unsigned char *p = (unsigned char *)addr;
 
     while (size) {
         if (*p == c)
-            return (void *) p;
+            return (void *)p;
         p++;
         size--;
     }
-      return (void *) p;
+      return (void *)p;
 }
 EXPORT_SYMBOL(memscan);
 #endif
@@ -584,18 +584,18 @@ EXPORT_SYMBOL(memscan);
  * @s1: The string to be searched
  * @s2: The string to search for
  */
-char * strstr(const char * s1,const char * s2)
+char *strstr(const char *s1, const char *s2)
 {
     int l1, l2;
 
     l2 = strlen(s2);
     if (!l2)
-        return (char *) s1;
+        return (char *)s1;
     l1 = strlen(s1);
     while (l1 >= l2) {
         l1--;
-        if (!memcmp(s1,s2,l2))
-            return (char *) s1;
+        if (!memcmp(s1, s2, l2))
+            return (char *)s1;
         s1++;
     }
     return NULL;
@@ -618,7 +618,7 @@ void *memchr(const void *s, int c, size_
     const unsigned char *p = s;
     while (n-- != 0) {
             if ((unsigned char)c == *p++) {
-            return (void *)(p-1);
+            return (void *)(p - 1);
         }
     }
     return NULL;


             reply	other threads:[~2005-02-10  0:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-10  0:32 Jonathan Ho [this message]
2005-02-10  0:46 ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=420AAB9D.6010801@gmail.com \
    --to=jonathanho15@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®