OSSP CVS Repository

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

ossp-pkg/var/var.c 1.18 -> 1.19

--- var.c        2001/11/14 12:57:56     1.18
+++ var.c        2001/11/15 15:36:05     1.19
@@ -75,7 +75,7 @@
 static int tokenbuf_assign(tokenbuf_t *buf, const char *data, size_t len)
 {
     char *p;
-    
+
     if ((p = malloc(len + 1)) == NULL)
         return 0;
     memcpy(p, data, len);
@@ -153,7 +153,7 @@
 {
     const char *p;
     size_t num;
-    
+
     num = 0;
     for (p = number->begin; p != number->end; ++p) {
         num *= 10;
@@ -164,7 +164,9 @@
 
 /* Routines for the expansion of quoted-pair expressions. */
 
-static void expand_range(char a, char b, char class[256])
+typedef char char_class_t[256]; /* 256 == 2 ^ sizeof(unsigned char)*8 */
+
+static void expand_range(char a, char b, char_class_t class)
 {
     do {
         class[(int)a] = 1;
@@ -172,7 +174,7 @@
     while (++a <= b);
 }
 
-static var_rc_t expand_character_class(const char *desc, char class[256])
+static var_rc_t expand_character_class(const char *desc, char_class_t class)
 {
     size_t i;
 
@@ -364,9 +366,9 @@
 /* The recursive-descent parser for variable expressions. */
 
 static int variable(const char *, const char *, const var_config_t *,
-                    const char[256], var_cb_t, void *, int, tokenbuf_t *);
+                    const char_class_t, var_cb_t, void *, int, tokenbuf_t *);
 static int command(const char *, const char *, const var_config_t *,
-                   const char[256], var_cb_t, void *, int, tokenbuf_t *);
+                   const char_class_t, var_cb_t, void *, int, tokenbuf_t *);
 
 static int text(const char *begin, const char *end, char varinit,
                 char escape)
@@ -384,7 +386,7 @@
 }
 
 static int varname(const char *begin, const char *end,
-                   const char nameclass[256])
+                   const char_class_t nameclass)
 {
     const char *p;
     for (p = begin; p != end && nameclass[(int) *p]; ++p);
@@ -433,7 +435,7 @@
 
 static int expression(const char *begin, const char *end,
                       const var_config_t *config,
-                      const char nameclass[256], var_cb_t lookup,
+                      const char_class_t nameclass, var_cb_t lookup,
                       void *lookup_context, int force_expand,
                       tokenbuf_t *result)
 {
@@ -581,7 +583,7 @@
 }
 
 static int variable(const char *begin, const char *end,
-                    const var_config_t *config, const char nameclass[256],
+                    const var_config_t *config, const char_class_t nameclass,
                     var_cb_t lookup, void *lookup_context,
                     int force_expand, tokenbuf_t *result)
 {
@@ -641,7 +643,7 @@
 
 static int exptext_or_variable(const char *begin, const char *end,
                                const var_config_t *config,
-                               const char nameclass[256], var_cb_t lookup,
+                               const char_class_t nameclass, var_cb_t lookup,
                                void *lookup_context, int force_expand,
                                tokenbuf_t *result)
 {
@@ -693,7 +695,7 @@
 
 static int substext_or_variable(const char *begin, const char *end,
                                 const var_config_t *config,
-                                const char nameclass[256], var_cb_t lookup,
+                                const char_class_t nameclass, var_cb_t lookup,
                                 void *lookup_context, int force_expand,
                                 tokenbuf_t *result)
 {
@@ -1166,7 +1168,7 @@
 }
 
 static int command(const char *begin, const char *end,
-                   const var_config_t *config, const char nameclass[256],
+                   const var_config_t *config, const char_class_t nameclass,
                    var_cb_t lookup, void *lookup_context, int force_expand,
                    tokenbuf_t *data)
 {
@@ -1502,7 +1504,7 @@
 
 static var_rc_t input(const char *begin, const char *end,
                       const var_config_t *config,
-                      const char nameclass[256], var_cb_t lookup,
+                      const char_class_t nameclass, var_cb_t lookup,
                       void *lookup_context, int force_expand,
                       tokenbuf_t *output)
 {
@@ -1553,12 +1555,12 @@
                     var_cb_t lookup, void *lookup_context,
                     const var_config_t *config, int force_expand)
 {
-    char nameclass[256];
+    char_class_t nameclass;
     var_rc_t rc;
     tokenbuf_t output;
 
     /* Argument sanity checks */
-    if (input_buf == NULL || input_len == 0 || 
+    if (input_buf == NULL || input_len == 0 ||
         result == NULL || result_len == NULL ||
         lookup == NULL)
         return VAR_ERR_INVALID_ARGUMENT;

CVSTrac 2.0.1