OSSP CVS Repository

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

Check-in Number: 1249
Date: 2001-Nov-04 14:45:03 (local)
2001-Nov-04 13:45:03 (UTC)
User:rse
Branch:
Comment: Cleanup formatting stuff by making stand-alone.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_p.h      1.26 -> 1.27     16 inserted, 58 deleted
ossp-pkg/l2/l2_ut_format.c      1.3 -> 1.4     1 inserted, 2 deleted
ossp-pkg/l2/l2_ut_format.h      added-> 1.1

ossp-pkg/l2/l2_p.h 1.26 -> 1.27

--- l2_p.h       2001/11/04 13:21:17     1.26
+++ l2_p.h       2001/11/04 13:45:03     1.27
@@ -29,24 +29,35 @@
 #ifndef __L2_P_H__
 #define __L2_P_H__
 
+/* include standard headers */
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 
-#ifndef DEBUG
-#define NDEBUG
-#endif
-#include <assert.h>
-
+/* include private headers */
 #include "l2.h"
 #include "l2_config.h"
+#include "l2_ut_format.h"
 #include "l2_ut_pcre.h"
 #include "l2_ut_sa.h"
 
+/* assertion and tracing support */
+#ifndef DEBUG
+#define NDEBUG
+#endif
+#include <assert.h>
+#ifndef NDEBUG
+#define TRACE(str)  fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, str)
+#else
+#define TRACE(expr) ((void)0)
+#endif
+
+/* memory debugging support */
 #if defined(HAVE_DMALLOC_H) && defined(WITH_DMALLOC)
 #include "dmalloc.h"
 #endif
 
+/* handy cleanup macros */
 #define cu(value) \
     do { rv = value; \
          goto cus; } while (0)
@@ -54,18 +65,6 @@
     if (expr) \
         cu(value)
 
-#ifndef NDEBUG
-#define TRACE(str)\
-        do {\
-            fprintf(stderr, "%s:%d: ", __FILE__, __LINE__);\
-            fprintf(stderr, str);\
-            fputc('\n', stderr);\
-        }\
-        while (0)
-#else
-#define TRACE(expr) ((void)0)
-#endif
-
 #define L2_MAX_MSGSIZE    4096
 #define L2_MAX_CHANNELS    128
 #define L2_MAX_FORMATTERS  128
@@ -122,46 +121,5 @@
 #define _va_type_cast_voidptr void *
 #define va_get(ap,type) (_va_type_cast_##type)va_arg((ap),_va_type_recv_##type)
 
-struct l2_util_format_st {
-
-    /* the output buffer */
-    char *curpos;                        /* start of output buffer (first pos) */
-    char *endpos;                        /* end   of output buffer (last pos)  */
-
-    /* callback for flushing the output buffer */
-    int (*flush)(
-        struct l2_util_format_st *spec   /* this l2_util_format_t specification */
-    );
-
-    /* callback for formatting unknown %-constructs */
-    void (*format)(
-        struct l2_util_format_st *spec,  /* this l2_util_format_t specification */
-        char *prefix_char,               /* output arg: prefix character */
-        char *pad_char,                  /* output arg: padding character */
-        char **s_buf,                    /* output arg: string buffer */
-        size_t *s_len,                   /* output arg: string len */
-        char *num_buf,                   /* input  arg: temporary buffer */
-        int num_buf_size,                /* input  arg: temporary buffer len */
-        char *extinfo,                   /* input  arg: extension information */
-        char fmt_char,                   /* input  arg: current formatting character */ 
-        va_list *ap                      /* in/out arg: variable argument pointer */
-    );
-
-    /* arbitrary passed-through application data */
-    union { 
-        int i;                        
-        long l; 
-        double d; 
-        void *vp; 
-    } data[6];                           
-};
-typedef struct l2_util_format_st l2_util_format_t;
-
-int   l2_util_format     (l2_util_format_t *vbuff, const char *fmt, va_list ap);
-int   l2_util_vsprintf   (char *s, size_t n, const char *fmt, va_list ap);
-char *l2_util_vasprintf  (const char *fmt, va_list ap);
-int   l2_util_sprintf    (char *s, size_t n, const char *fmt, ...);
-char *l2_util_asprintf   (const char *fmt, ...);
-
 #endif /* __L2_P_H__ */
 


ossp-pkg/l2/l2_ut_format.c 1.3 -> 1.4

--- l2_ut_format.c       2001/09/08 22:06:54     1.3
+++ l2_ut_format.c       2001/11/04 13:45:03     1.4
@@ -97,8 +97,7 @@
 #include <ctype.h>
 #include <math.h>
 
-#include "l2.h"
-#include "l2_p.h"
+#include "l2_ut_format.h"
 
 /* types which are locally use */
 typedef long                 long_int;


ossp-pkg/l2/l2_ut_format.h -> 1.1

*** /dev/null    Sat Nov 23 01:01:46 2024
--- -    Sat Nov 23 01:01:58 2024
***************
*** 0 ****
--- 1,74 ----
+ /*
+ **  L2 - OSSP Logging Library
+ **  Copyright (c) 2001 Cable & Wireless Deutschland GmbH
+ **
+ **  This file is part of OSSP L2, a flexible logging library which
+ **  can be found at http://www.ossp.org/pkg/l2/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  l2_ut_format.h: printf(3)-style formatting API
+ */
+ 
+ #ifndef __L2_UT_FORMAT_H__
+ #define __L2_UT_FORMAT_H__
+ 
+ struct l2_util_format_st {
+     /* the output buffer */
+     char *curpos;                        /* start of output buffer (first pos) */
+     char *endpos;                        /* end   of output buffer (last pos)  */
+ 
+     /* callback for flushing the output buffer */
+     int (*flush)(
+         struct l2_util_format_st *spec   /* this l2_util_format_t specification */
+     );
+ 
+     /* callback for formatting unknown %-constructs */
+     void (*format)(
+         struct l2_util_format_st *spec,  /* this l2_util_format_t specification */
+         char *prefix_char,               /* output arg: prefix character */
+         char *pad_char,                  /* output arg: padding character */
+         char **s_buf,                    /* output arg: string buffer */
+         size_t *s_len,                   /* output arg: string len */
+         char *num_buf,                   /* input  arg: temporary buffer */
+         int num_buf_size,                /* input  arg: temporary buffer len */
+         char *extinfo,                   /* input  arg: extension information */
+         char fmt_char,                   /* input  arg: current formatting character */ 
+         va_list *ap                      /* in/out arg: variable argument pointer */
+     );
+ 
+     /* arbitrary passed-through application data */
+     union { 
+         int i;                        
+         long l; 
+         double d; 
+         void *vp; 
+     } data[6];                           
+ };
+ 
+ typedef struct l2_util_format_st l2_util_format_t;
+ 
+ int   l2_util_format    (l2_util_format_t *vbuff, const char *fmt, va_list ap);
+ int   l2_util_vsprintf  (char *s, size_t n, const char *fmt, va_list ap);
+ char *l2_util_vasprintf (const char *fmt, va_list ap);
+ int   l2_util_sprintf   (char *s, size_t n, const char *fmt, ...);
+ char *l2_util_asprintf  (const char *fmt, ...);
+ 
+ #endif /* __L2_UT_FORMAT_H__ */
+ 

CVSTrac 2.0.1