OSSP CVS Repository

ossp - Difference in ossp-pkg/str/str_parse.c versions 1.19 and 1.20
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/str/str_parse.c 1.19 -> 1.20

--- str_parse.c  2002/04/01 08:32:54     1.19
+++ str_parse.c  2003/01/06 19:13:47     1.20
@@ -1,9 +1,9 @@
 /*
 **  OSSP str - String Handling
-**  Copyright (c) 1999-2002 Ralf S. Engelschall <rse@engelschall.com>
-**  Copyright (c) 1999-2002 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 1999-2003 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 1999-2003 The OSSP Project <http://www.ossp.org/>
 **
-**  This file is part of OSSP str, a string handling and manipulation 
+**  This file is part of OSSP str, a string handling and manipulation
 **  library which can be found at http://www.ossp.org/pkg/lib/str/.
 **
 **  Permission to use, copy, modify, and distribute this software for
@@ -24,18 +24,18 @@
 **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 **  SUCH DAMAGE.
 **
-**  str_parse.c: parsing functions 
+**  str_parse.c: parsing functions
 */
 
 #include "str_p.h"
 
 /* compile a regular expression pattern from string into internal format */
-static int 
+static int
 pattern_compile(
-    const char *ptr, 
-    int len, 
-    int opt, 
-    pcre **p_pcre, 
+    const char *ptr,
+    int len,
+    int opt,
+    pcre **p_pcre,
     pcre_extra **p_pcre_extra)
 {
     const char *err_str;
@@ -99,7 +99,7 @@
 static int hash_initialized = FALSE;
 
 /* initialize cache hash table */
-static void 
+static void
 hash_init(void)
 {
     int i;
@@ -109,7 +109,7 @@
 }
 
 /* destroy cache hash table */
-static void 
+static void
 hash_destroy(void)
 {
     int i;
@@ -130,9 +130,9 @@
 }
 
 /* the hashing function: a popular `times 33' hash */
-static unsigned int 
+static unsigned int
 hash_func(
-    const char *key, 
+    const char *key,
     int keylen)
 {
     unsigned int h;
@@ -145,11 +145,11 @@
 }
 
 /* cache a pattern */
-static void 
+static void
 pattern_cache(
-    const char *key, 
-    int keylen, 
-    pcre *p_pcre, 
+    const char *key,
+    int keylen,
+    pcre *p_pcre,
     pcre_extra *p_pcre_extra)
 {
     int h;
@@ -179,11 +179,11 @@
 }
 
 /* lookup a pattern */
-static void 
+static void
 pattern_lookup(
-    const char *key, 
-    int keylen, 
-    pcre **p_pcre, 
+    const char *key,
+    int keylen,
+    pcre **p_pcre,
     pcre_extra **p_pcre_extra)
 {
     int h;
@@ -206,32 +206,32 @@
     return;
 }
 
-static int 
+static int
 str_parse_flush_nop(
     str_vformat_t *sf)
-{   
+{
     sf->data[2].i = sf->data[2].i + sf->data[1].i;
     sf->curpos = (char *)sf->data[0].p;
     return 0;
-}   
+}
 
-static int 
+static int
 str_parse_flush_str(
     str_vformat_t *sf)
-{   
+{
     return -1;
-}   
+}
 
 static char *
 str_parse_format(
     str_vformat_t *sf,
     char *cpPrefix,
-    char *cpPad, 
+    char *cpPad,
     int *ipStrLen,
-    char *cpBuf, 
-    int nBufLen, 
-    char *cpExtinfo, 
-    int cFmt, 
+    char *cpBuf,
+    int nBufLen,
+    char *cpExtinfo,
+    int cFmt,
     va_list ap)
 {
     char *pStr;
@@ -239,7 +239,7 @@
     int *cap_vec;
     int cap_num;
     char *string;
-   
+
     pStr = NULL;
     if (cFmt == 'R') {
         if (cpExtinfo != NULL && str_isdigit(cpExtinfo[0]) && cpExtinfo[1] == NUL) {
@@ -273,7 +273,7 @@
 {
     pcre *p_pcre = NULL;
     pcre_extra *p_pcre_extra = NULL;
-    const char *match_ptr; 
+    const char *match_ptr;
     int match_len;
     int match_opt;
     int match_once;
@@ -313,13 +313,13 @@
         return 0;
     }
 
-    /* 
-     * Check input parameters 
+    /*
+     * Check input parameters
      */
     if (string == NULL || pattern == NULL)
         return -1;
 
-    /* 
+    /*
      * Parse pattern
      */
     match_ptr     = NULL;
@@ -341,7 +341,7 @@
     if (!ismop)
         if (*pattern == 's' && str_len(pattern) >= 4)
             if ((cp = str_span(pattern, 0, "imsxo", STR_RIGHT)) > pattern+1)
-                if ((cb[0] = *cp, cb[1] = NUL, 
+                if ((cb[0] = *cp, cb[1] = NUL,
                      cp2 = str_span(pattern, cp-pattern, cb, STR_RIGHT|STR_COMPLEMENT)) > pattern+1)
                     if (*(pattern+1) == *cp && *(pattern+1) == *cp2)
                         issop = TRUE;
@@ -390,7 +390,7 @@
         ismop = TRUE;
     }
 
-    /* 
+    /*
      * Compile pattern into internal PCRE structure
      */
     if (match_once) {
@@ -409,8 +409,8 @@
             return -1;
     }
 
-    /* 
-     * Allocate storage for offset table of captured substrings 
+    /*
+     * Allocate storage for offset table of captured substrings
      */
     cap_vec = NULL;
     cap_len = 0;
@@ -426,7 +426,7 @@
         }
     }
 
-    /* 
+    /*
      * Perform the matching operation
      */
     n = pcre_exec(p_pcre, p_pcre_extra, string, str_len(string), 0, 0, cap_vec, cap_len);
@@ -446,8 +446,8 @@
      * Create either matching or substitution result
      */
     if (ismop && cap_num > 0) {
-        /* 
-         * extract captured substrings into caller provided pointer variables 
+        /*
+         * extract captured substrings into caller provided pointer variables
          */
         if (match_1resbuf) {
             /* use a single result buffer */
@@ -507,7 +507,7 @@
         }
     }
     else if (issop) {
-        /* 
+        /*
          * create a substitutional string with optional expansions
          */
 
@@ -553,7 +553,7 @@
         /* remove output argument from varargs */
         cpp = va_arg(ap, char **);
 
-        /* calculate output buffer requirement */ 
+        /* calculate output buffer requirement */
         sf.curpos    = buf2;
         sf.endpos    = buf2 + sizeof(buf2) - 1;
         sf.flush     = str_parse_flush_nop;

CVSTrac 2.0.1