OSSP CVS Repository

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

Check-in Number: 1450
Date: 2001-Dec-22 23:18:34 (local)
2001-Dec-22 22:18:34 (UTC)
User:rse
Branch:
Comment: Fix l2_spec_error function and remove again the not really needed l2_env_verrorinfo function.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2.h.in      1.25 -> 1.26     0 inserted, 1 deleted
ossp-pkg/l2/l2_env.c      1.5 -> 1.6     2 inserted, 10 deleted
ossp-pkg/l2/l2_spec.c      1.6 -> 1.7     11 inserted, 2 deleted

ossp-pkg/l2/l2.h.in 1.25 -> 1.26

--- l2.h.in      2001/12/14 12:39:08     1.25
+++ l2.h.in      2001/12/22 22:18:34     1.26
@@ -208,7 +208,6 @@
 l2_result_t   l2_env_formatter      (l2_env_t *env, char id, l2_formatter_t cb, l2_context_t *ctx);
 l2_result_t   l2_env_handler        (l2_env_t *env, l2_handler_t *h);
 l2_result_t   l2_env_errorinfo      (l2_env_t *env, l2_result_t rv, const char *fmt, ...);
-l2_result_t   l2_env_verrorinfo     (l2_env_t *env, l2_result_t rv, const char *fmt, va_list ap);
 char         *l2_env_strerror       (l2_env_t *env, l2_result_t rv);
 l2_result_t   l2_env_settimer       (l2_env_t *env, int iInterval);
 


ossp-pkg/l2/l2_env.c 1.5 -> 1.6

--- l2_env.c     2001/12/14 12:39:08     1.5
+++ l2_env.c     2001/12/22 22:18:34     1.6
@@ -152,23 +152,15 @@
 {
     va_list ap;
 
-    /* remember error information */
-    va_start(ap, fmt);
-    l2_env_verrorinfo(env, rv, fmt, ap);
-    va_end(ap);
-
-    return L2_OK;
-}
-
-l2_result_t l2_env_verrorinfo(l2_env_t *env, l2_result_t rv, const char *fmt, va_list ap)
-{
     /* argument sanity check */
     if (env == NULL || rv == L2_OK || fmt == NULL)
         return L2_ERR_ARG;
 
     /* remember error information */
+    va_start(ap, fmt);
     l2_util_vsprintf(env->szErrorInfo, sizeof(env->szErrorInfo), fmt, ap);
     env->rvErrorInfo = rv;
+    va_end(ap);
 
     return L2_OK;
 }


ossp-pkg/l2/l2_spec.c 1.6 -> 1.7

--- l2_spec.c    2001/12/22 22:04:18     1.6
+++ l2_spec.c    2001/12/22 22:18:34     1.7
@@ -98,6 +98,7 @@
 /* remember a specification parsing error (used internally) */
 void l2_spec_error(l2_spec_ctx_t *ctx, l2_result_t rv, YYLTYPE *loc, const char *fmt, ...)
 {
+    va_list ap;
     const char *cpF, *cpL;
     const char *cpP, *cpE;
     int line, column;
@@ -143,8 +144,16 @@
     *cp++ = '\0';
 
     /* remember error */
-    l2_env_errorinfo(ctx->env, rv, "line %d, column %d: `%s'; %s",
-                     line, column, cpBuf, fmt);
+    va_start(ap, fmt);
+    if ((cp = l2_util_vasprintf(fmt, ap)) != NULL) {
+        l2_env_errorinfo(ctx->env, rv, "line %d, column %d: `%s'; %s",
+                         line, column, cpBuf, cp);
+        free(cp);
+    }
+    else
+        l2_env_errorinfo(ctx->env, rv, "line %d, column %d: `%s'; N.A.",
+                         line, column, cpBuf);
+    va_end(ap);
     ctx->rv = rv;
 
     /* cleanup */

CVSTrac 2.0.1