Page MenuHomeFreeBSD

D26353.diff
No OneTemporary

D26353.diff

Index: lib/libc/string/strchr.c
===================================================================
--- lib/libc/string/strchr.c
+++ lib/libc/string/strchr.c
@@ -29,7 +29,8 @@
char *__strchrnul(const char *, int);
-char *strchr(const char *s, int c)
+char *
+strchr(const char *s, int c)
{
char *r = __strchrnul(s, c);
return *(unsigned char *)r == (unsigned char)c ? r : 0;
Index: lib/libc/string/strchrnul.c
===================================================================
--- lib/libc/string/strchrnul.c
+++ lib/libc/string/strchrnul.c
@@ -25,29 +25,34 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <string.h>
-#include <stdint.h>
#include <limits.h>
+#include <stdint.h>
+#include <string.h>
#define ALIGN (sizeof(size_t))
-#define ONES ((size_t)-1/UCHAR_MAX)
-#define HIGHS (ONES * (UCHAR_MAX/2+1))
-#define HASZERO(x) (((x)-ONES) & ~(x) & HIGHS)
+#define ONES ((size_t)-1 / UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
+#define HASZERO(x) (((x)-ONES) & ~(x)&HIGHS)
char *__strchrnul(const char *, int);
-char *__strchrnul(const char *s, int c)
+char *
+__strchrnul(const char *s, int c)
{
size_t *w, k;
c = (unsigned char)c;
- if (!c) return (char *)s + strlen(s);
+ if (!c)
+ return (char *)s + strlen(s);
for (; (uintptr_t)s % ALIGN; s++)
- if (!*s || *(unsigned char *)s == c) return (char *)s;
+ if (!*s || *(unsigned char *)s == c)
+ return (char *)s;
k = ONES * c;
- for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w^k); w++);
- for (s = (void *)w; *s && *(unsigned char *)s != c; s++);
+ for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
+ ;
+ for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
+ ;
return (char *)s;
}
Index: lib/libc/string/strcspn.c
===================================================================
--- lib/libc/string/strcspn.c
+++ lib/libc/string/strcspn.c
@@ -27,20 +27,25 @@
#include <string.h>
-#define BITOP(a,b,op) \
- ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
+#define BITOP(a, b, op) \
+ ((a)[(size_t)(b) / (8 * sizeof *(a))] op(size_t) 1 \
+ << ((size_t)(b) % (8 * sizeof *(a))))
char *__strchrnul(const char *, int);
-size_t strcspn(const char *s, const char *c)
+size_t
+strcspn(const char *s, const char *c)
{
const char *a = s;
- size_t byteset[32/sizeof(size_t)];
+ size_t byteset[32 / sizeof(size_t)];
- if (!c[0] || !c[1]) return __strchrnul(s, *c)-a;
+ if (!c[0] || !c[1])
+ return __strchrnul(s, *c) - a;
memset(byteset, 0, sizeof byteset);
- for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++);
- for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++);
- return s-a;
+ for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++)
+ ;
+ for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++)
+ ;
+ return s - a;
}

File Metadata

Mime Type
text/plain
Expires
Mon, May 18, 6:14 AM (7 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33235766
Default Alt Text
D26353.diff (2 KB)

Event Timeline