krb5 commit: Remove DEBUG_ERROR_LOCATIONS support

Greg Hudson ghudson at MIT.EDU
Thu Jun 5 11:34:31 EDT 2014


https://github.com/krb5/krb5/commit/ba2879ca8f8ba84d2431a9a40de4ac7ee1e758f8
commit ba2879ca8f8ba84d2431a9a40de4ac7ee1e758f8
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sat May 24 11:35:30 2014 -0400

    Remove DEBUG_ERROR_LOCATIONS support
    
    It wasn't being used and it added too much complexity to the
    error-handling functions.

 src/include/k5-err.h                          |   19 --------------
 src/include/k5-int.h                          |   12 ---------
 src/lib/krb5/krb/kerrs.c                      |   25 -------------------
 src/lib/krb5/libkrb5.exports                  |    1 -
 src/util/support/errors.c                     |   32 +------------------------
 src/util/support/libkrb5support-fixed.exports |    2 -
 6 files changed, 1 insertions(+), 90 deletions(-)

diff --git a/src/include/k5-err.h b/src/include/k5-err.h
index 083dee4..d929207 100644
--- a/src/include/k5-err.h
+++ b/src/include/k5-err.h
@@ -61,28 +61,9 @@ void k5_vset_error(struct errinfo *ep, long code, const char *fmt,
 #endif
     ;
 
-void k5_set_error_fl(struct errinfo *ep, long code, const char *file, int line,
-                     const char *fmt, ...)
-#if !defined(__cplusplus) && (__GNUC__ > 2)
-    __attribute__((__format__(__printf__, 5, 6)))
-#endif
-    ;
-
-void k5_vset_error_fl(struct errinfo *ep, long code, const char *file,
-                      int line, const char *fmt, va_list args)
-#if !defined(__cplusplus) && (__GNUC__ > 2)
-    __attribute__((__format__(__printf__, 5, 0)))
-#endif
-    ;
-
 const char *k5_get_error(struct errinfo *ep, long code);
 void k5_free_error(struct errinfo *ep, const char *msg);
 void k5_clear_error(struct errinfo *ep);
 void k5_set_error_info_callout_fn(const char *(KRB5_CALLCONV *f)(long));
 
-#ifdef DEBUG_ERROR_LOCATIONS
-#define k5_set_error(ep, code, ...)                             \
-    k5_set_error_fl(ep, code, __FILE__, __LINE__, __VA_ARGS__)
-#endif
-
 #endif /* K5_ERR_H */
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index 187d16d..3b6aa9c 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -2271,16 +2271,4 @@ krb5_boolean k5_etypes_contains(const krb5_enctype *list, krb5_enctype etype);
 void k5_change_error_message_code(krb5_context ctx, krb5_error_code oldcode,
                                   krb5_error_code newcode);
 
-#ifdef DEBUG_ERROR_LOCATIONS
-#define krb5_set_error_message(ctx, code, ...)                          \
-    krb5_set_error_message_fl(ctx, code, __FILE__, __LINE__, __VA_ARGS__)
-#endif
-void KRB5_CALLCONV_C
-krb5_set_error_message_fl(krb5_context ctx, krb5_error_code code,
-                          const char *file, int line, const char *fmt, ...)
-#ifdef __GNUC__
-    __attribute__((__format__(printf,5,6)))
-#endif
-    ;
-
 #endif /* _KRB5_INT_H */
diff --git a/src/lib/krb5/krb/kerrs.c b/src/lib/krb5/krb/kerrs.c
index f3e6c94..16e7267 100644
--- a/src/lib/krb5/krb/kerrs.c
+++ b/src/lib/krb5/krb/kerrs.c
@@ -35,7 +35,6 @@ static int error_message_debug = 0;
 #endif
 #endif
 
-#undef krb5_set_error_message
 void KRB5_CALLCONV_C
 krb5_set_error_message(krb5_context ctx, krb5_error_code code,
                        const char *fmt, ...)
@@ -60,30 +59,6 @@ krb5_set_error_message(krb5_context ctx, krb5_error_code code,
     va_end(args);
 }
 
-void KRB5_CALLCONV_C
-krb5_set_error_message_fl(krb5_context ctx, krb5_error_code code,
-                          const char *file, int line, const char *fmt, ...)
-{
-    va_list args;
-
-    if (ctx == NULL)
-        return;
-    va_start(args, fmt);
-#ifdef DEBUG
-    if (ERROR_MESSAGE_DEBUG()) {
-        fprintf(stderr,
-                "krb5_set_error_message(ctx=%p/err=%p, code=%ld, ...)\n",
-                ctx, &ctx->err, (long)code);
-    }
-#endif
-    k5_vset_error_fl(&ctx->err, code, file, line, fmt, args);
-#ifdef DEBUG
-    if (ERROR_MESSAGE_DEBUG())
-        fprintf(stderr, "->%s\n", ctx->err.msg);
-#endif
-    va_end(args);
-}
-
 void KRB5_CALLCONV
 krb5_vset_error_message(krb5_context ctx, krb5_error_code code,
                         const char *fmt, va_list args)
diff --git a/src/lib/krb5/libkrb5.exports b/src/lib/krb5/libkrb5.exports
index 2d0852d..c23fd1d 100644
--- a/src/lib/krb5/libkrb5.exports
+++ b/src/lib/krb5/libkrb5.exports
@@ -566,7 +566,6 @@ krb5_set_default_realm
 krb5_set_default_tgs_enctypes
 krb5_set_default_tgs_ktypes
 krb5_set_error_message
-krb5_set_error_message_fl
 krb5_set_password
 krb5_set_password_using_ccache
 krb5_set_principal_realm
diff --git a/src/util/support/errors.c b/src/util/support/errors.c
index d820873..74093a5 100644
--- a/src/util/support/errors.c
+++ b/src/util/support/errors.c
@@ -40,38 +40,19 @@ krb5int_err_init (void)
 #define lock()          k5_mutex_lock(&krb5int_error_info_support_mutex)
 #define unlock()        k5_mutex_unlock(&krb5int_error_info_support_mutex)
 
-#undef k5_set_error
 void
 k5_set_error(struct errinfo *ep, long code, const char *fmt, ...)
 {
     va_list args;
 
     va_start(args, fmt);
-    k5_vset_error_fl(ep, code, NULL, 0, fmt, args);
-    va_end(args);
-}
-
-void
-k5_set_error_fl(struct errinfo *ep, long code, const char *file, int line,
-                const char *fmt, ...)
-{
-    va_list args;
-
-    va_start(args, fmt);
-    k5_vset_error_fl(ep, code, file, line, fmt, args);
+    k5_vset_error(ep, code, fmt, args);
     va_end(args);
 }
 
 void
 k5_vset_error(struct errinfo *ep, long code, const char *fmt, va_list args)
 {
-    k5_vset_error_fl(ep, code, NULL, 0, fmt, args);
-}
-
-void
-k5_vset_error_fl(struct errinfo *ep, long code, const char *file, int line,
-                 const char *fmt, va_list args)
-{
     char *str, *slash;
 
     k5_clear_error(ep);
@@ -80,17 +61,6 @@ k5_vset_error_fl(struct errinfo *ep, long code, const char *file, int line,
     if (vasprintf(&str, fmt, args) < 0)
         return;
     ep->msg = str;
-
-    if (line) {
-        /* Try to add file and line suffix. */
-        slash = strrchr(file, '/');
-        if (slash)
-            file = slash + 1;
-        if (asprintf(&str, "%s (%s: %d)", ep->msg, file, line) > 0) {
-            free(ep->msg);
-            ep->msg = str;
-        }
-    }
 }
 
 static inline const char *
diff --git a/src/util/support/libkrb5support-fixed.exports b/src/util/support/libkrb5support-fixed.exports
index f5fbe9e..4a76eef 100644
--- a/src/util/support/libkrb5support-fixed.exports
+++ b/src/util/support/libkrb5support-fixed.exports
@@ -13,8 +13,6 @@ k5_buf_len
 k5_free_buf
 k5_set_error
 k5_vset_error
-k5_set_error_fl
-k5_vset_error_fl
 k5_get_error
 k5_free_error
 k5_clear_error


More information about the cvs-krb5 mailing list