OSSP CVS Repository

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

Check-in Number: 1329
Date: 2001-Nov-14 12:11:01 (local)
2001-Nov-14 11:11:01 (UTC)
User:rse
Branch:
Comment: Rename the return codes VAR_XXX to VAR_ERR_XXX (except for VAR_OK) to be consistent with other OSSP libraries like L2.
Tickets:
Inspections:
Files:
ossp-pkg/var/var.c      1.13 -> 1.14     87 inserted, 87 deleted
ossp-pkg/var/var.h      1.6 -> 1.7     39 inserted, 38 deleted
ossp-pkg/var/var_test.c      1.8 -> 1.9     1 inserted, 1 deleted

ossp-pkg/var/var.c 1.13 -> 1.14

--- var.c        2001/11/14 09:47:02     1.13
+++ var.c        2001/11/14 11:11:01     1.14
@@ -187,7 +187,7 @@
     while (*desc != '\0') {
         if (desc[1] == '-' && desc[2] != '\0') {
             if (desc[0] > desc[2])
-                return VAR_INCORRECT_CLASS_SPEC;
+                return VAR_ERR_INCORRECT_CLASS_SPEC;
             expand_range(desc[0], desc[2], class);
             desc += 3;
         } else {
@@ -212,13 +212,13 @@
     unsigned char c;
 
     if (end - *src < 3)
-        return VAR_INCOMPLETE_OCTAL;
+        return VAR_ERR_INCOMPLETE_OCTAL;
     if (!isoct(**src) || !isoct((*src)[1]) || !isoct((*src)[2]))
-        return VAR_INVALID_OCTAL;
+        return VAR_ERR_INVALID_OCTAL;
 
     c = **src - '0';
     if (c > 3)
-        return VAR_OCTAL_TOO_LARGE;
+        return VAR_ERR_OCTAL_TOO_LARGE;
     c *= 8;
     ++(*src);
 
@@ -248,9 +248,9 @@
     unsigned char c = 0;
 
     if (end - *src < 2)
-        return VAR_INCOMPLETE_HEX;
+        return VAR_ERR_INCOMPLETE_HEX;
     if (!ishex(**src) || !ishex((*src)[1]))
-        return VAR_INVALID_HEX;
+        return VAR_ERR_INVALID_HEX;
 
     if (**src >= '0' && **src <= '9')
         c = **src - '0';
@@ -285,7 +285,7 @@
         ++(*src);
     }
     if (*src == end)
-        return VAR_INCOMPLETE_GROUPED_HEX;
+        return VAR_ERR_INCOMPLETE_GROUPED_HEX;
 
     return VAR_OK;
 }
@@ -293,7 +293,7 @@
 static var_rc_t expand_hex(const char **src, char **dst, const char *end)
 {
     if (*src == end)
-        return VAR_INCOMPLETE_HEX;
+        return VAR_ERR_INCOMPLETE_HEX;
     if (**src == '{') {
         ++(*src);
         return expand_grouped_hex(src, dst, end);
@@ -310,7 +310,7 @@
     while (src < end) {
         if (*src == '\\') {
             if (++src == end)
-                return VAR_INCOMPLETE_NAMED_CHARACTER;
+                return VAR_ERR_INCOMPLETE_NAMED_CHARACTER;
             switch (*src) {
             case '\\':
                 if (!unescape_all) {
@@ -375,7 +375,7 @@
     for (p = begin; p != end && *p != varinit; ++p) {
         if (*p == escape) {
             if (p + 1 == end)
-                return VAR_INCOMPLETE_QUOTED_PAIR;
+                return VAR_ERR_INCOMPLETE_QUOTED_PAIR;
             else
                 ++p;
         }
@@ -405,7 +405,7 @@
     for (p = begin; p != end && *p != config->varinit && *p != '/'; ++p) {
         if (*p == config->escape) {
             if (p + 1 == end)
-                return VAR_INCOMPLETE_QUOTED_PAIR;
+                return VAR_ERR_INCOMPLETE_QUOTED_PAIR;
             else
                 ++p;
         }
@@ -422,7 +422,7 @@
          && *p != ':'; ++p) {
         if (*p == config->escape) {
             if (p + 1 == end)
-                return VAR_INCOMPLETE_QUOTED_PAIR;
+                return VAR_ERR_INCOMPLETE_QUOTED_PAIR;
             else
                 ++p;
         }
@@ -457,7 +457,7 @@
         return 0;
 
     if (++p == end)
-        return VAR_INCOMPLETE_VARIABLE_SPEC;
+        return VAR_ERR_INCOMPLETE_VARIABLE_SPEC;
 
     /* Get the name of the variable to expand. The name may consist of
        an arbitrary number of VARNAMEs and VARIABLEs. */
@@ -468,7 +468,7 @@
             goto error_return;
         else if (rc > 0) {
             if (!tokenbuf_append(&name, p, rc)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             } else
                 p += rc;
@@ -480,7 +480,7 @@
             goto error_return;
         else if (rc > 0) {
             if (!tokenbuf_append(&name, tmp.begin, tmp.end - tmp.begin)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             } else
                 p += rc;
@@ -492,7 +492,7 @@
        do. */
 
     if (name.begin == name.end) {
-        rc = VAR_INCOMPLETE_VARIABLE_SPEC;
+        rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC;
         goto error_return;
     }
 
@@ -500,7 +500,7 @@
        expect an ENDDELIM here. */
 
     if (p == end || (*p != config->enddelim && *p != ':')) {
-        rc = VAR_INCOMPLETE_VARIABLE_SPEC;
+        rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC;
         goto error_return;
     } else
         ++p;
@@ -516,7 +516,7 @@
            force_expand flag. */
 
         if (force_expand) {
-            rc = VAR_UNDEFINED_VARIABLE;
+            rc = VAR_ERR_UNDEFINED_VARIABLE;
             goto error_return;
         } else {
             /* Initialize result to point back to the original text in
@@ -557,7 +557,7 @@
         }
 
         if (p == end || *p != config->enddelim) {
-            rc = VAR_INCOMPLETE_VARIABLE_SPEC;
+            rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC;
             goto error_return;
         }
         ++p;
@@ -601,7 +601,7 @@
         return 0;
 
     if (++p == end)
-        return VAR_INCOMPLETE_VARIABLE_SPEC;
+        return VAR_ERR_INCOMPLETE_VARIABLE_SPEC;
 
     /* Try to read the variable name. If that fails, we're parsing a
        complex expression. */
@@ -615,7 +615,7 @@
             return rc2;
         else if (rc2 == 0) {
             if (force_expand)
-                return VAR_UNDEFINED_VARIABLE;
+                return VAR_ERR_UNDEFINED_VARIABLE;
             else {
                 result->begin = begin;
                 result->end = begin + 1 + rc;
@@ -661,7 +661,7 @@
             goto error_return;
         else if (rc > 0) {
             if (!tokenbuf_append(result, p, rc)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             } else
                 p += rc;
@@ -675,7 +675,7 @@
             p += rc;
             if (!tokenbuf_append
                 (result, tmp.begin, tmp.end - tmp.begin)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             }
         }
@@ -713,7 +713,7 @@
             goto error_return;
         else if (rc > 0) {
             if (!tokenbuf_append(result, p, rc)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             } else
                 p += rc;
@@ -727,7 +727,7 @@
             p += rc;
             if (!tokenbuf_append
                 (result, tmp.begin, tmp.end - tmp.begin)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             }
         }
@@ -751,15 +751,15 @@
     while (p != src->end) {
         if ((src->end - p) >= 3 && p[1] == '-') {
             if (*p > p[2])
-                return VAR_INCORRECT_TRANSPOSE_CLASS_SPEC;
+                return VAR_ERR_INCORRECT_TRANSPOSE_CLASS_SPEC;
             for (c = *p, d = p[2]; c <= d; ++c) {
                 if (!tokenbuf_append(dst, (char *) &c, 1))
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
             }
             p += 3;
         } else {
             if (!tokenbuf_append(dst, p, 1))
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             else
                 ++p;
         }
@@ -784,11 +784,11 @@
         goto error_return;
 
     if (srcclass.begin == srcclass.end) {
-        rc = VAR_EMPTY_TRANSPOSE_CLASS;
+        rc = VAR_ERR_EMPTY_TRANSPOSE_CLASS;
         goto error_return;
     }
     if ((srcclass.end - srcclass.begin) != (dstclass.end - dstclass.begin)) {
-        rc = VAR_TRANSPOSE_CLASSES_MISMATCH;
+        rc = VAR_ERR_TRANSPOSE_CLASSES_MISMATCH;
         goto error_return;
     }
 
@@ -796,7 +796,7 @@
         tokenbuf_t tmp;
         if (!tokenbuf_assign
             (&tmp, data->begin, data->end - data->begin)) {
-            rc = VAR_OUT_OF_MEMORY;
+            rc = VAR_ERR_OUT_OF_MEMORY;
             goto error_return;
         }
         tokenbuf_move(&tmp, data);
@@ -834,7 +834,7 @@
     /* Determine begin of result string. */
 
     if ((data->end - data->begin) < num1)
-        return VAR_OFFSET_OUT_OF_BOUNDS;
+        return VAR_ERR_OFFSET_OUT_OF_BOUNDS;
     else
         p = data->begin + num1;
 
@@ -842,21 +842,21 @@
 
     if (num2 == 0) {
         if (!tokenbuf_assign(&res, p, data->end - p))
-            return VAR_OUT_OF_MEMORY;
+            return VAR_ERR_OUT_OF_MEMORY;
     } else {                    /* OK, then use num2. */
 
         if (isrange) {
             if ((p + num2) > data->end)
-                return VAR_RANGE_OUT_OF_BOUNDS;
+                return VAR_ERR_RANGE_OUT_OF_BOUNDS;
             if (!tokenbuf_assign(&res, p, num2))
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
         } else {
             if (num2 < num1)
-                return VAR_OFFSET_LOGIC_ERROR;
+                return VAR_ERR_OFFSET_LOGIC;
             if ((data->begin + num2) > data->end)
-                return VAR_RANGE_OUT_OF_BOUNDS;
+                return VAR_ERR_RANGE_OUT_OF_BOUNDS;
             if (!tokenbuf_assign(&res, p, (data->begin + num2) - p))
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
         }
     }
     tokenbuf_free(data);
@@ -876,36 +876,36 @@
         if (*p == '\\') {
             if (orig->end - p <= 1) {
                 tokenbuf_free(expanded);
-                return VAR_INCOMPLETE_QUOTED_PAIR;
+                return VAR_ERR_INCOMPLETE_QUOTED_PAIR;
             } else
                 ++p;
             if (*p == '\\') {
                 if (!tokenbuf_append(expanded, p, 1)) {
                     tokenbuf_free(expanded);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 }
                 ++p;
                 continue;
             }
             if (!isdigit((int)*p)) {
                 tokenbuf_free(expanded);
-                return VAR_UNKNOWN_QUOTED_PAIR_IN_REPLACE;
+                return VAR_ERR_UNKNOWN_QUOTED_PAIR_IN_REPLACE;
             }
             i = *p - '0';
             ++p;
             if (pmatch[i].rm_so == -1) {
                 tokenbuf_free(expanded);
-                return VAR_SUBMATCH_OUT_OF_RANGE;
+                return VAR_ERR_SUBMATCH_OUT_OF_RANGE;
             }
             if (!tokenbuf_append(expanded, data + pmatch[i].rm_so,
                                     pmatch[i].rm_eo - pmatch[i].rm_so)) {
                 tokenbuf_free(expanded);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
         } else {
             if (!tokenbuf_append(expanded, p, 1)) {
                 tokenbuf_free(expanded);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
             ++p;
         }
@@ -924,7 +924,7 @@
     int rc;
 
     if (search->begin == search->end)
-        return VAR_EMPTY_SEARCH_STRING;
+        return VAR_ERR_EMPTY_SEARCH_STRING;
 
     for (p = flags->begin; p != flags->end; ++p) {
         switch (tolower(*p)) {
@@ -938,7 +938,7 @@
             no_regex = 1;
             break;
         default:
-            return VAR_UNKNOWN_REPLACE_FLAG;
+            return VAR_ERR_UNKNOWN_REPLACE_FLAG;
         }
     }
 
@@ -956,7 +956,7 @@
             if (rc != 0) {      /* no match, copy character */
                 if (!tokenbuf_append(&tmp, p, 1)) {
                     tokenbuf_free(&tmp);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 }
                 ++p;
             } else {
@@ -966,7 +966,7 @@
                 if (!global) {
                     if (!tokenbuf_append(&tmp, p, data->end - p)) {
                         tokenbuf_free(&tmp);
-                        return VAR_OUT_OF_MEMORY;
+                        return VAR_ERR_OUT_OF_MEMORY;
                     }
                     break;
                 }
@@ -988,11 +988,11 @@
 
         if (!tokenbuf_assign
             (&tmp, search->begin, search->end - search->begin))
-            return VAR_OUT_OF_MEMORY;
+            return VAR_ERR_OUT_OF_MEMORY;
         if (!tokenbuf_assign
             (&mydata, data->begin, data->end - data->begin)) {
             tokenbuf_free(&tmp);
-            return VAR_OUT_OF_MEMORY;
+            return VAR_ERR_OUT_OF_MEMORY;
         }
 
         /* Compile the pattern. */
@@ -1002,7 +1002,7 @@
         tokenbuf_free(&tmp);
         if (rc != 0) {
             tokenbuf_free(&mydata);
-            return VAR_INVALID_REGEX_IN_REPLACE;
+            return VAR_ERR_INVALID_REGEX_IN_REPLACE;
         }
 
         /* Match the pattern and create the result string in the tmp
@@ -1033,7 +1033,7 @@
                     tokenbuf_free(&tmp);
                     tokenbuf_free(&mydata);
                     tokenbuf_free(&myreplace);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 } else {
                     p += (pmatch[0].rm_eo > 0) ? pmatch[0].rm_eo : 1;
                     tokenbuf_free(&myreplace);
@@ -1062,7 +1062,7 @@
     int i;
 
     if (fill->begin == fill->end)
-        return VAR_EMPTY_PADDING_FILL_STRING;
+        return VAR_ERR_EMPTY_PADDING_FILL_STRING;
 
     tokenbuf_init(&result);
 
@@ -1073,13 +1073,13 @@
             while (i > 0) {
                 if (!tokenbuf_append
                     (data, fill->begin, fill->end - fill->begin))
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 --i;
             }
             i = (width - (data->end - data->begin)) % (fill->end -
                                                        fill->begin);
             if (!tokenbuf_append(data, fill->begin, i))
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
         }
     } else if (position == 'r') {
         i = width - (data->end - data->begin);
@@ -1089,7 +1089,7 @@
                 if (!tokenbuf_append
                     (&result, fill->begin, fill->end - fill->begin)) {
                     tokenbuf_free(&result);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 }
                 --i;
             }
@@ -1097,12 +1097,12 @@
                                                        fill->begin);
             if (!tokenbuf_append(&result, fill->begin, i)) {
                 tokenbuf_free(&result);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
             if (!tokenbuf_append
                 (&result, data->begin, data->end - data->begin)) {
                 tokenbuf_free(&result);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
 
             tokenbuf_free(data);
@@ -1118,7 +1118,7 @@
                 if (!tokenbuf_append
                     (&result, fill->begin, fill->end - fill->begin)) {
                     tokenbuf_free(&result);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 }
                 --i;
             }
@@ -1126,7 +1126,7 @@
                                                              fill->begin);
             if (!tokenbuf_append(&result, fill->begin, i)) {
                 tokenbuf_free(&result);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
 
             /* Append the actual data string. */
@@ -1134,7 +1134,7 @@
             if (!tokenbuf_append
                 (&result, data->begin, data->end - data->begin)) {
                 tokenbuf_free(&result);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
 
             /* Append the suffix. */
@@ -1145,14 +1145,14 @@
                 if (!tokenbuf_append
                     (&result, fill->begin, fill->end - fill->begin)) {
                     tokenbuf_free(&result);
-                    return VAR_OUT_OF_MEMORY;
+                    return VAR_ERR_OUT_OF_MEMORY;
                 }
                 --i;
             }
             i = width - (result.end - result.begin);
             if (!tokenbuf_append(&result, fill->begin, i)) {
                 tokenbuf_free(&result);
-                return VAR_OUT_OF_MEMORY;
+                return VAR_ERR_OUT_OF_MEMORY;
             }
 
             /* Move string from temporary buffer to data buffer. */
@@ -1197,7 +1197,7 @@
             if (data->buffer_size == 0) {
                 if (!tokenbuf_assign
                     (data, data->begin, data->end - data->begin)) {
-                    rc = VAR_OUT_OF_MEMORY;
+                    rc = VAR_ERR_OUT_OF_MEMORY;
                     goto error_return;
                 }
             }
@@ -1213,7 +1213,7 @@
             if (data->buffer_size == 0) {
                 if (!tokenbuf_assign
                     (data, data->begin, data->end - data->begin)) {
-                    rc = VAR_OUT_OF_MEMORY;
+                    rc = VAR_ERR_OUT_OF_MEMORY;
                     goto error_return;
                 }
             }
@@ -1227,7 +1227,7 @@
         ++p;
         rc = number(p, end);
         if (rc == 0) {
-            rc = VAR_MISSING_START_OFFSET;
+            rc = VAR_ERR_MISSING_START_OFFSET;
             goto error_return;
         } else {
             number1.begin = p;
@@ -1243,7 +1243,7 @@
             isrange = 1;
             ++p;
         } else {
-            rc = VAR_INVALID_OFFSET_DELIMITER;
+            rc = VAR_ERR_INVALID_OFFSET_DELIMITER;
             goto error_return;
         }
 
@@ -1265,7 +1265,7 @@
             sprintf(buf, "%d", data->end - data->begin);
             tokenbuf_free(data);
             if (!tokenbuf_assign(data, buf, strlen(buf))) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             }
         }
@@ -1279,7 +1279,7 @@
         if (rc < 0)
             goto error_return;
         else if (rc == 0) {
-            rc = VAR_MISSING_PARAMETER_IN_COMMAND;
+            rc = VAR_ERR_MISSING_PARAMETER_IN_COMMAND;
             goto error_return;
         } else
             p += rc;
@@ -1296,7 +1296,7 @@
         if (rc < 0)
             goto error_return;
         else if (rc == 0) {
-            rc = VAR_MISSING_PARAMETER_IN_COMMAND;
+            rc = VAR_ERR_MISSING_PARAMETER_IN_COMMAND;
             goto error_return;
         } else
             p += rc;
@@ -1319,7 +1319,7 @@
         if (rc < 0)
             goto error_return;
         else if (rc == 0) {
-            rc = VAR_MISSING_PARAMETER_IN_COMMAND;
+            rc = VAR_ERR_MISSING_PARAMETER_IN_COMMAND;
             goto error_return;
         } else
             p += rc;
@@ -1335,7 +1335,7 @@
         ++p;
 
         if (*p != '/')
-            return VAR_MALFORMATTED_REPLACE;
+            return VAR_ERR_MALFORMATTED_REPLACE;
         else
             ++p;
 
@@ -1347,7 +1347,7 @@
             p += rc;
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_REPLACE;
+            rc = VAR_ERR_MALFORMATTED_REPLACE;
             goto error_return;
         } else
             ++p;
@@ -1360,7 +1360,7 @@
             p += rc;
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_REPLACE;
+            rc = VAR_ERR_MALFORMATTED_REPLACE;
             goto error_return;
         } else
             ++p;
@@ -1386,7 +1386,7 @@
         ++p;
 
         if (*p != '/')
-            return VAR_MALFORMATTED_TRANSPOSE;
+            return VAR_ERR_MALFORMATTED_TRANSPOSE;
         else
             ++p;
 
@@ -1398,7 +1398,7 @@
             p += rc;
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_TRANSPOSE;
+            rc = VAR_ERR_MALFORMATTED_TRANSPOSE;
             goto error_return;
         } else
             ++p;
@@ -1411,7 +1411,7 @@
             p += rc;
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_TRANSPOSE;
+            rc = VAR_ERR_MALFORMATTED_TRANSPOSE;
             goto error_return;
         } else
             ++p;
@@ -1428,13 +1428,13 @@
         ++p;
 
         if (*p != '/')
-            return VAR_MALFORMATTED_PADDING;
+            return VAR_ERR_MALFORMATTED_PADDING;
         else
             ++p;
 
         rc = number(p, end);
         if (rc == 0) {
-            rc = VAR_MISSING_PADDING_WIDTH;
+            rc = VAR_ERR_MISSING_PADDING_WIDTH;
             goto error_return;
         } else {
             number1.begin = p;
@@ -1444,7 +1444,7 @@
         }
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_PADDING;
+            rc = VAR_ERR_MALFORMATTED_PADDING;
             goto error_return;
         } else
             ++p;
@@ -1457,13 +1457,13 @@
             p += rc;
 
         if (*p != '/') {
-            rc = VAR_MALFORMATTED_PADDING;
+            rc = VAR_ERR_MALFORMATTED_PADDING;
             goto error_return;
         } else
             ++p;
 
         if (*p != 'l' && *p != 'c' && *p != 'r') {
-            rc = VAR_MALFORMATTED_PADDING;
+            rc = VAR_ERR_MALFORMATTED_PADDING;
             goto error_return;
         } else
             ++p;
@@ -1476,7 +1476,7 @@
         break;
 
     default:
-        return VAR_UNKNOWN_COMMAND_CHAR;
+        return VAR_ERR_UNKNOWN_COMMAND_CHAR;
     }
 
     /* Exit gracefully. */
@@ -1515,7 +1515,7 @@
         rc = text(begin, end, config->varinit, config->escape);
         if (rc > 0) {
             if (!tokenbuf_append(output, begin, rc)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             }
             begin += rc;
@@ -1527,7 +1527,7 @@
         if (rc > 0) {
             if (!tokenbuf_append
                 (output, result.begin, result.end - result.begin)) {
-                rc = VAR_OUT_OF_MEMORY;
+                rc = VAR_ERR_OUT_OF_MEMORY;
                 goto error_return;
             } else
                 begin += rc;
@@ -1537,7 +1537,7 @@
     while (rc > 0);
 
     if (begin != end) {
-        rc = VAR_INPUT_ISNT_TEXT_NOR_VARIABLE;
+        rc = VAR_ERR_INPUT_ISNT_TEXT_NOR_VARIABLE;
         goto error_return;
     }
 
@@ -1572,7 +1572,7 @@
         nameclass[(int) config->startdelim] ||
         nameclass[(int) config->enddelim] ||
         nameclass[(int) config->escape])
-        return VAR_INVALID_CONFIGURATION;
+        return VAR_ERR_INVALID_CONFIGURATION;
 
     /* Call the parser. */
 


ossp-pkg/var/var.h 1.6 -> 1.7

--- var.h        2001/11/14 11:04:12     1.6
+++ var.h        2001/11/14 11:11:01     1.7
@@ -27,49 +27,49 @@
 **  var.h: VAR library API
 */
 
-#ifndef LIB_OSSP_VAR_H
-#define LIB_OSSP_VAR_H
+#ifndef __VAR_H__
+#define __VAR_H__
 
 #include <stdlib.h>
 
 /* Error codes returned by the varexp library. */
 
 typedef enum {
-    VAR_CALLBACK_ERROR = -64,
-    VAR_SUBMATCH_OUT_OF_RANGE = -34,
-    VAR_UNKNOWN_QUOTED_PAIR_IN_REPLACE = -33,
-    VAR_EMPTY_PADDING_FILL_STRING = -32,
-    VAR_MISSING_PADDING_WIDTH = -31,
-    VAR_MALFORMATTED_PADDING = -30,
-    VAR_INCORRECT_TRANSPOSE_CLASS_SPEC = -29,
-    VAR_EMPTY_TRANSPOSE_CLASS = -28,
-    VAR_TRANSPOSE_CLASSES_MISMATCH = -27,
-    VAR_MALFORMATTED_TRANSPOSE = -26,
-    VAR_OFFSET_LOGIC_ERROR = -25,
-    VAR_OFFSET_OUT_OF_BOUNDS = -24,
-    VAR_RANGE_OUT_OF_BOUNDS = -23,
-    VAR_INVALID_OFFSET_DELIMITER = -22,
-    VAR_MISSING_START_OFFSET = -21,
-    VAR_EMPTY_SEARCH_STRING = -20,
-    VAR_MISSING_PARAMETER_IN_COMMAND = -19,
-    VAR_INVALID_REGEX_IN_REPLACE = -18,
-    VAR_UNKNOWN_REPLACE_FLAG = -17,
-    VAR_MALFORMATTED_REPLACE = -16,
-    VAR_UNKNOWN_COMMAND_CHAR = -14,
-    VAR_INPUT_ISNT_TEXT_NOR_VARIABLE = -13,
-    VAR_UNDEFINED_VARIABLE = -12,
-    VAR_INCOMPLETE_VARIABLE_SPEC = -11,
-    VAR_OUT_OF_MEMORY = -10,
-    VAR_INVALID_CONFIGURATION = -9,
-    VAR_INCORRECT_CLASS_SPEC = -8,
-    VAR_INCOMPLETE_GROUPED_HEX = -7,
-    VAR_INCOMPLETE_OCTAL = -6,
-    VAR_INVALID_OCTAL = -5,
-    VAR_OCTAL_TOO_LARGE = -4,
-    VAR_INVALID_HEX = -3,
-    VAR_INCOMPLETE_HEX = -2,
-    VAR_INCOMPLETE_NAMED_CHARACTER = -1,
-    VAR_INCOMPLETE_QUOTED_PAIR = -1,
+    VAR_ERR_CALLBACK = -64,
+    VAR_ERR_SUBMATCH_OUT_OF_RANGE = -34,
+    VAR_ERR_UNKNOWN_QUOTED_PAIR_IN_REPLACE = -33,
+    VAR_ERR_EMPTY_PADDING_FILL_STRING = -32,
+    VAR_ERR_MISSING_PADDING_WIDTH = -31,
+    VAR_ERR_MALFORMATTED_PADDING = -30,
+    VAR_ERR_INCORRECT_TRANSPOSE_CLASS_SPEC = -29,
+    VAR_ERR_EMPTY_TRANSPOSE_CLASS = -28,
+    VAR_ERR_TRANSPOSE_CLASSES_MISMATCH = -27,
+    VAR_ERR_MALFORMATTED_TRANSPOSE = -26,
+    VAR_ERR_OFFSET_LOGIC = -25,
+    VAR_ERR_OFFSET_OUT_OF_BOUNDS = -24,
+    VAR_ERR_RANGE_OUT_OF_BOUNDS = -23,
+    VAR_ERR_INVALID_OFFSET_DELIMITER = -22,
+    VAR_ERR_MISSING_START_OFFSET = -21,
+    VAR_ERR_EMPTY_SEARCH_STRING = -20,
+    VAR_ERR_MISSING_PARAMETER_IN_COMMAND = -19,
+    VAR_ERR_INVALID_REGEX_IN_REPLACE = -18,
+    VAR_ERR_UNKNOWN_REPLACE_FLAG = -17,
+    VAR_ERR_MALFORMATTED_REPLACE = -16,
+    VAR_ERR_UNKNOWN_COMMAND_CHAR = -14,
+    VAR_ERR_INPUT_ISNT_TEXT_NOR_VARIABLE = -13,
+    VAR_ERR_UNDEFINED_VARIABLE = -12,
+    VAR_ERR_INCOMPLETE_VARIABLE_SPEC = -11,
+    VAR_ERR_OUT_OF_MEMORY = -10,
+    VAR_ERR_INVALID_CONFIGURATION = -9,
+    VAR_ERR_INCORRECT_CLASS_SPEC = -8,
+    VAR_ERR_INCOMPLETE_GROUPED_HEX = -7,
+    VAR_ERR_INCOMPLETE_OCTAL = -6,
+    VAR_ERR_INVALID_OCTAL = -5,
+    VAR_ERR_OCTAL_TOO_LARGE = -4,
+    VAR_ERR_INVALID_HEX = -3,
+    VAR_ERR_INCOMPLETE_HEX = -2,
+    VAR_ERR_INCOMPLETE_NAMED_CHARACTER = -1,
+    VAR_ERR_INCOMPLETE_QUOTED_PAIR = -1,
     VAR_OK = 0
 } var_rc_t;
 
@@ -154,4 +154,5 @@
     var_cb_t lookup, void *lookup_context,
     const var_config_t * config, int force_expand);
 
-#endif                /* !defined(LIB_OSSP_VAR_H) */
+#endif /* __VAR_H__ */
+


ossp-pkg/var/var_test.c 1.8 -> 1.9

--- var_test.c   2001/11/14 10:47:17     1.8
+++ var_test.c   2001/11/14 11:11:01     1.9
@@ -14,7 +14,7 @@
     /* Callback can't expand variable names longer than
        sizeof(tmp) characters. */
 
-    return VAR_CALLBACK_ERROR;
+        return VAR_ERR_CALLBACK;
     }
     memcpy(tmp, varname, name_len);
     tmp[name_len] = '\0';

CVSTrac 2.0.1