OSSP CVS Repository

ossp - Check-in [1365]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1365
Date: 2001-Nov-19 16:56:17 (local)
2001-Nov-19 15:56:17 (UTC)
User:thl
Branch:
Comment: THLs review
Tickets:
Inspections:
Files:
ossp-pkg/var/var.c      1.22 -> 1.23     16 inserted, 15 deleted
ossp-pkg/var/var.h      1.10 -> 1.11     3 inserted, 0 deleted

ossp-pkg/var/var.c 1.22 -> 1.23

--- var.c        2001/11/19 15:15:31     1.22
+++ var.c        2001/11/19 15:56:17     1.23
@@ -615,25 +615,22 @@
     rc = varname(p, end, nameclass);
     if (rc < 0)
         return rc;
-    else if (rc > 0) {
+    if (rc > 0) {
         rc2 = (*lookup) (lookup_context, p, rc, &data, &len, &buffer_size);
         if (rc2 < 0)
             return rc2;
-        else if (rc2 == 0) {
+        if (rc2 == 0) {
             if (force_expand)
                 return VAR_ERR_UNDEFINED_VARIABLE;
-            else {
-                result->begin = begin;
-                result->end = begin + 1 + rc;
-                result->buffer_size = 0;
-                return 1 + rc;
-            }
-        } else {
-            result->begin = data;
-            result->end = data + len;
-            result->buffer_size = buffer_size;
+            result->begin = begin;
+            result->end = begin + 1 + rc;
+            result->buffer_size = 0;
             return 1 + rc;
         }
+        result->begin = data;
+        result->end = data + len;
+        result->buffer_size = buffer_size;
+        return 1 + rc;
     }
 
     /* OK, we're dealing with a complex expression here. */
@@ -1536,9 +1533,10 @@
                 (output, result.begin, result.end - result.begin)) {
                 rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
-            } else
-                begin += rc;
-        } else if (rc < 0)
+            }
+            begin += rc;
+        }
+        if (rc < 0)
             goto error_return;
     }
     while (rc > 0);
@@ -1591,9 +1589,12 @@
     if (nameclass[(int)config->varinit] ||
         nameclass[(int)config->startdelim] ||
         nameclass[(int)config->enddelim] ||
+//FIXME THL: if(config->varinit == ':' ...any must not be colon > ERROR, varname() will fail
         nameclass[(int)config->escape])
         return VAR_ERR_INVALID_CONFIGURATION;
 
+//FIXME THL: if(config->varinit == config->startdelimit || ...any with any...
+
     /* Call the parser. */
     tokenbuf_init(&output);
     rc = input(input_buf, input_buf + input_len, config, nameclass,


ossp-pkg/var/var.h 1.10 -> 1.11

--- var.h        2001/11/14 15:55:09     1.10
+++ var.h        2001/11/19 15:56:17     1.11
@@ -118,6 +118,7 @@
 typedef int (*var_cb_t) (void *context,
     const char *varname, size_t name_len,
     const char **data, size_t *data_len,
+//FIXME THL: description "malloced_buffer" vs. prototype "size_t *buffer_size"
     size_t *buffer_size);
 
 /*
@@ -138,6 +139,7 @@
     char enddelim;       /* '}' */
     char escape;         /* '\' */
     char *namechars;     /* 'a-zA-Z0-9_' */
+//FIXME THL: should we support namechars with different first char, i.e. [a-z][a-z0-9]*
 } var_config_t;
 extern const var_config_t var_config_default;
 
@@ -154,6 +156,7 @@
     char **result, size_t *result_len,
     var_cb_t lookup, void *lookup_context,
     const var_config_t *config, int force_expand);
+//FIXME THL: "force_expand" used here but described and unused above in "var_config_t"
 
 #endif /* __VAR_H__ */
 

CVSTrac 2.0.1