]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use our own strwordtok instead of strtok_r. Not only is it portable, but also underst...
authorhno <>
Tue, 22 Jan 2008 22:34:27 +0000 (22:34 +0000)
committerhno <>
Tue, 22 Jan 2008 22:34:27 +0000 (22:34 +0000)
configure.in
include/strtok_r.h [deleted file]
lib/strtok_r.c [deleted file]
src/cache_cf.cc
src/squid.h

index 824dbf0f2db76469b3178643e592dcd541fda822..fbeb6ecc0914057150001d4c32982b9d438684ca 100644 (file)
@@ -1,7 +1,7 @@
 
 dnl  Configuration input file for Squid
 dnl
-dnl  $Id: configure.in,v 1.495 2008/01/18 07:04:16 amosjeffries Exp $
+dnl  $Id: configure.in,v 1.496 2008/01/22 15:34:27 hno Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h)
 AC_CONFIG_AUX_DIR(cfgaux)
 AC_CONFIG_SRCDIR([src/main.cc])
 AM_INIT_AUTOMAKE([tar-ustar])
-AC_REVISION($Revision: 1.495 $)dnl
+AC_REVISION($Revision: 1.496 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -2619,7 +2619,6 @@ AC_REPLACE_FUNCS(\
        getaddrinfo \
        getnameinfo \
        strerror \
-       strtok_r \
        tempnam \
 )
 
diff --git a/include/strtok_r.h b/include/strtok_r.h
deleted file mode 100644 (file)
index 59bb2c4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Split string into tokens
-   Copyright (C) 2004-2005 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifndef STRTOK_R_H
-#define STRTOK_R_H
-
-/* Get strtok_r declaration, if available.  */
-#include <string.h>
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
-
-   This is a variant of strtok() that is multithread-safe.
-
-   For the POSIX documentation for this function, see:
-   http://www.opengroup.org/susv3xsh/strtok.html
-
-   Caveat: It modifies the original string.
-   Caveat: These functions cannot be used on constant strings.
-   Caveat: The identity of the delimiting character is lost.
-   Caveat: It doesn't work with multibyte strings unless all of the delimiter
-           characters are ASCII characters < 0x30.
-
-   See also strsep().
-*/
-SQUIDCEXTERN char *strtok_r(char *s, const char *sep, char **lasts);
-
-#endif /* STRTOK_R_H */
diff --git a/lib/strtok_r.c b/lib/strtok_r.c
deleted file mode 100644 (file)
index e06600d..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Reentrant string tokenizer.  Generic version.
-   Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#undef strtok_r
-#undef __strtok_r
-
-#ifndef _LIBC
-/* Get specification.  */
-# include "strtok_r.h"
-# define __strtok_r strtok_r
-# define __rawmemchr strchr
-#endif
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
-*/
-char *
-strtok_r (char *s, const char *delim, char **save_ptr)
-{
-  char *token;
-
-  if (s == NULL)
-    s = *save_ptr;
-
-  /* Scan leading delimiters.  */
-  s += strspn (s, delim);
-  if (*s == '\0')
-    {
-      *save_ptr = s;
-      return NULL;
-    }
-
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL)
-    /* This token finishes the string.  */
-    *save_ptr = __rawmemchr (token, '\0');
-  else
-    {
-      /* Terminate the token and make *SAVE_PTR point past it.  */
-      *s = '\0';
-      *save_ptr = s + 1;
-    }
-  return token;
-}
index 300005bb4713cb5e94bb89b076a5a4651ebc170f..5b419f19962d8f342fc9663073366fb6898a381a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.537 2008/01/19 07:11:34 amosjeffries Exp $
+ * $Id: cache_cf.cc,v 1.538 2008/01/22 15:34:28 hno Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -210,10 +210,10 @@ parseManyConfigFiles(char* files, int depth)
 {
     int error_count = 0;
     char* saveptr = NULL;
-    char* file = strtok_r(files, w_space, &saveptr);
+    char* file = strwordtok(files, &saveptr);
     while (file != NULL) {
         error_count += parseOneConfigFile(file, depth);
-        file = strtok_r(NULL, w_space, &saveptr);
+        file = strwordtok(NULL, &saveptr);
     }
     return error_count;
 }
index 9932e0d3a7acfe6ba2d0d50d844dec80264fabf7..646917cea6537efd7248420d2f0348e7001c1c58 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.270 2008/01/20 17:11:15 serassio Exp $
+ * $Id: squid.h,v 1.271 2008/01/22 15:34:28 hno Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -388,10 +388,6 @@ extern "C"
 #include "strtoll.h"
 #endif
 
-#if !HAVE_STRTOK_R
-#include "strtok_r.h"
-#endif
-
 #if !HAVE_INITGROUPS
 #include "initgroups.h"
 #endif