diff options
author | marha <marha@users.sourceforge.net> | 2012-04-16 09:17:34 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-16 09:17:34 +0200 |
commit | d6d3999ccb2cb72d55820770260172eccbbb68d7 (patch) | |
tree | 568ce82dd1a8e2edbbe8cd4cb5ab5b14157f34f6 /xorg-server/os | |
parent | fffd436e9c2ec6f5aa501ee57d0e4ade7293ee60 (diff) | |
download | vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.gz vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.tar.bz2 vcxsrv-d6d3999ccb2cb72d55820770260172eccbbb68d7.zip |
libX11 xserver pixman mesa git update 16 Apr 2012
Diffstat (limited to 'xorg-server/os')
-rw-r--r-- | xorg-server/os/strcasecmp.c | 4 | ||||
-rw-r--r-- | xorg-server/os/strcasestr.c | 28 | ||||
-rw-r--r-- | xorg-server/os/strlcat.c | 117 | ||||
-rw-r--r-- | xorg-server/os/strndup.c | 18 |
4 files changed, 83 insertions, 84 deletions
diff --git a/xorg-server/os/strcasecmp.c b/xorg-server/os/strcasecmp.c index cf100baf4..2692f7f1e 100644 --- a/xorg-server/os/strcasecmp.c +++ b/xorg-server/os/strcasecmp.c @@ -38,7 +38,7 @@ int xstrcasecmp(const char *str1, const char *str2) { - const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2; + const u_char *us1 = (const u_char *) str1, *us2 = (const u_char *) str2; while (tolower(*us1) == tolower(*us2)) { if (*us1++ == '\0') @@ -55,7 +55,7 @@ int xstrncasecmp(const char *s1, const char *s2, size_t n) { if (n != 0) { - const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; + const u_char *us1 = (const u_char *) s1, *us2 = (const u_char *) s2; do { if (tolower(*us1) != tolower(*us2++)) diff --git a/xorg-server/os/strcasestr.c b/xorg-server/os/strcasestr.c index a20a6cc33..1ca2ad6bb 100644 --- a/xorg-server/os/strcasestr.c +++ b/xorg-server/os/strcasestr.c @@ -45,20 +45,20 @@ char * xstrcasestr(const char *s, const char *find) { - char c, sc; - size_t len; + char c, sc; + size_t len; - if ((c = *find++) != 0) { - c = tolower((unsigned char)c); - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return NULL; - } while ((char)tolower((unsigned char)sc) != c); - } while (strncasecmp(s, find, len) != 0); - s--; - } - return ((char *)s); + if ((c = *find++) != 0) { + c = tolower((unsigned char) c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return NULL; + } while ((char) tolower((unsigned char) sc) != c); + } while (strncasecmp(s, find, len) != 0); + s--; + } + return ((char *) s); } #endif diff --git a/xorg-server/os/strlcat.c b/xorg-server/os/strlcat.c index e374e2908..316dfa9d1 100644 --- a/xorg-server/os/strlcat.c +++ b/xorg-server/os/strlcat.c @@ -1,59 +1,58 @@ -/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE
- * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#include <string.h>
-#include "os.h"
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(src) + MIN(siz, strlen(initial dst)).
- * If retval >= siz, truncation occurred.
- */
-size_t
-strlcat(char *dst, const char *src, size_t siz)
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end */
- while (n-- != 0 && *d != '\0')
- d++;
- dlen = d - dst;
- n = siz - dlen;
-
- if (n == 0)
- return(dlen + strlen(s));
- while (*s != '\0') {
- if (n != 1) {
- *d++ = *s;
- n--;
- }
- s++;
- }
- *d = '\0';
-
- return(dlen + (s - src)); /* count does not include NUL */
-}
+/* + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE + * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <sys/types.h> +#include <string.h> +#include "os.h" + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) +{ + register char *d = dst; + register const char *s = src; + register size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return (dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return (dlen + (s - src)); /* count does not include NUL */ +} diff --git a/xorg-server/os/strndup.c b/xorg-server/os/strndup.c index bf8e982d4..b604b9bac 100644 --- a/xorg-server/os/strndup.c +++ b/xorg-server/os/strndup.c @@ -35,15 +35,15 @@ char * strndup(const char *str, size_t n) { - size_t len; - char *copy; + size_t len; + char *copy; - for (len = 0; len < n && str[len]; len++) - continue; + for (len = 0; len < n && str[len]; len++) + continue; - if ((copy = malloc(len + 1)) == NULL) - return (NULL); - memcpy(copy, str, len); - copy[len] = '\0'; - return (copy); + if ((copy = malloc(len + 1)) == NULL) + return (NULL); + memcpy(copy, str, len); + copy[len] = '\0'; + return (copy); } |