From: Mathieu Desnoyers Date: Wed, 22 Feb 2012 22:10:30 +0000 (-0500) Subject: Revert "snprintf: fix namespace of snprintf types for freebsd" X-Git-Tag: v2.0.0-rc2~24 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c9e31458c3a4813f13c9d3339071d0f924f89347;p=lttng-ust.git Revert "snprintf: fix namespace of snprintf types for freebsd" This reverts commit 18d0b33ab9884b3f7bac0dd918993dc05a7c43fd. Signed-off-by: Mathieu Desnoyers --- diff --git a/snprintf/fflush.c b/snprintf/fflush.c index 32cc6602..fc52bb30 100644 --- a/snprintf/fflush.c +++ b/snprintf/fflush.c @@ -36,7 +36,7 @@ #include "local.h" /* Flush a single file, or (if fp is NULL) all files. */ -int ust_safe_fflush(LTTNG_UST_LFILE *fp) +int ust_safe_fflush(LFILE *fp) { if (fp == NULL) @@ -50,7 +50,7 @@ int ust_safe_fflush(LTTNG_UST_LFILE *fp) } int -__sflush(LTTNG_UST_LFILE *fp) +__sflush(LFILE *fp) { unsigned char *p; int n, t; diff --git a/snprintf/fileext.h b/snprintf/fileext.h index 422cf823..2d070430 100644 --- a/snprintf/fileext.h +++ b/snprintf/fileext.h @@ -32,12 +32,12 @@ /* * file extension */ -struct __lttng_ust_sfileext { - struct __lttng_ust_sbuf _ub; /* ungetc buffer */ +struct __sfileext { + struct __sbuf _ub; /* ungetc buffer */ struct wchar_io_data _wcio; /* wide char io status */ }; -#define _EXT(fp) ((struct __lttng_ust_sfileext *)((fp)->_ext._base)) +#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base)) #define _UB(fp) _EXT(fp)->_ub #define _FILEEXT_INIT(fp) \ diff --git a/snprintf/fvwrite.c b/snprintf/fvwrite.c index fb075f1b..62f713e0 100644 --- a/snprintf/fvwrite.c +++ b/snprintf/fvwrite.c @@ -46,11 +46,11 @@ * to the three different kinds of output buffering is handled here. */ int -__sfvwrite(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio) +__sfvwrite(LFILE *fp, struct __suio *uio) { size_t len; char *p; - struct __lttng_ust_siov *iov; + struct __siov *iov; int w, s; char *nl; int nlknown, nldist; diff --git a/snprintf/fvwrite.h b/snprintf/fvwrite.h index 65536212..19b633db 100644 --- a/snprintf/fvwrite.h +++ b/snprintf/fvwrite.h @@ -35,14 +35,14 @@ /* * I/O descriptors for __sfvwrite(). */ -struct __lttng_ust_siov { +struct __siov { void *iov_base; size_t iov_len; }; -struct __lttng_ust_suio { - struct __lttng_ust_siov *uio_iov; +struct __suio { + struct __siov *uio_iov; int uio_iovcnt; int uio_resid; }; -extern int __sfvwrite(LTTNG_UST_LFILE *, struct __lttng_ust_suio *); +extern int __sfvwrite(LFILE *, struct __suio *); diff --git a/snprintf/local.h b/snprintf/local.h index d9251bf6..c322cafc 100644 --- a/snprintf/local.h +++ b/snprintf/local.h @@ -42,27 +42,27 @@ #include "wcio.h" #include "fileext.h" -int __sflush(LTTNG_UST_LFILE *); -LTTNG_UST_LFILE *__sfp(void); -int __srefill(LTTNG_UST_LFILE *); +int __sflush(LFILE *); +LFILE *__sfp(void); +int __srefill(LFILE *); int __sread(void *, char *, int); int __swrite(void *, const char *, int); fpos_t __sseek(void *, fpos_t, int); int __sclose(void *); void __sinit(void); void _cleanup(void); -void __smakebuf(LTTNG_UST_LFILE *); -int __swhatbuf(LTTNG_UST_LFILE *, size_t *, int *); -int _fwalk(int (*)(LTTNG_UST_LFILE *)); -int __swsetup(LTTNG_UST_LFILE *); +void __smakebuf(LFILE *); +int __swhatbuf(LFILE *, size_t *, int *); +int _fwalk(int (*)(LFILE *)); +int __swsetup(LFILE *); int __sflags(const char *, int *); -wint_t __fgetwc_unlock(LTTNG_UST_LFILE *); +wint_t __fgetwc_unlock(LFILE *); extern void __atexit_register_cleanup(void (*)(void)); extern int __sdidinit; /* - * Return true if the given LTTNG_UST_LFILE cannot be written now. + * Return true if the given LFILE cannot be written now. */ #define cantwrite(fp) \ ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ diff --git a/snprintf/snprintf.c b/snprintf/snprintf.c index bbc66a07..b0ea5d3b 100644 --- a/snprintf/snprintf.c +++ b/snprintf/snprintf.c @@ -42,8 +42,8 @@ int ust_safe_vsnprintf(char *str, size_t n, const char *fmt, va_list ap) { int ret; char dummy; - LTTNG_UST_LFILE f; - struct __lttng_ust_sfileext fext; + LFILE f; + struct __sfileext fext; /* While snprintf(3) specifies size_t stdio uses an int internally */ if (n > INT_MAX) diff --git a/snprintf/various.h b/snprintf/various.h index 30bedd04..882f517e 100644 --- a/snprintf/various.h +++ b/snprintf/various.h @@ -35,7 +35,7 @@ #include -struct __lttng_ust_sbuf { +struct __sbuf { unsigned char *_base; int _size; }; @@ -64,13 +64,13 @@ struct __lttng_ust_sbuf { * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. */ -typedef struct __lttng_ust_sFILE { +typedef struct __sFILE { unsigned char *_p; /* current position in (some) buffer */ int _r; /* read space left for getc() */ int _w; /* write space left for putc() */ short _flags; /* flags, below; this FILE is free if 0 */ short _file; /* fileno, if Unix descriptor, else -1 */ - struct __lttng_ust_sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ int _lbfsize; /* 0 or -_bf._size, for inline putc */ /* operations */ @@ -81,7 +81,7 @@ typedef struct __lttng_ust_sFILE { int (*_write)(void *, const char *, int); /* extension data, to avoid further ABI breakage */ - struct __lttng_ust_sbuf _ext; + struct __sbuf _ext; /* data for long sequences of ungetc() */ unsigned char *_up; /* saved _p when _p is doing ungetc data */ int _ur; /* saved _r when _r is counting ungetc data */ @@ -91,12 +91,12 @@ typedef struct __lttng_ust_sFILE { unsigned char _nbuf[1]; /* guarantee a getc() buffer */ /* separate buffer for fgetln() when line crosses buffer boundary */ - struct __lttng_ust_sbuf _lb; /* buffer for fgetln() */ + struct __sbuf _lb; /* buffer for fgetln() */ /* Unix stdio files get aligned to block boundaries on fseek() */ int _blksize; /* stat.st_blksize (may be != _bf._size) */ fpos_t _offset; /* current lseek offset */ -} LTTNG_UST_LFILE; +} LFILE; #define __SLBF 0x0001 /* line buffered */ #define __SNBF 0x0002 /* unbuffered */ @@ -117,8 +117,8 @@ typedef struct __lttng_ust_sFILE { #define __sferror(p) (((p)->_flags & __SERR) != 0) -extern int ust_safe_fflush(LTTNG_UST_LFILE *fp); -extern int ust_safe_vfprintf(LTTNG_UST_LFILE *fp, const char *fmt0, va_list ap); +extern int ust_safe_fflush(LFILE *fp); +extern int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap); extern size_t ust_safe_mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); diff --git a/snprintf/vfprintf.c b/snprintf/vfprintf.c index cedd4fb7..1b8fba67 100644 --- a/snprintf/vfprintf.c +++ b/snprintf/vfprintf.c @@ -92,7 +92,7 @@ static int __grow_type_table(unsigned char **typetable, int *tablesize); * then reset it so that it can be reused. */ static int -__sprint(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio) +__sprint(LFILE *fp, struct __suio *uio) { int err; @@ -112,10 +112,10 @@ __sprint(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio) * worries about ungetc buffers and so forth. */ //static int -//__sbprintf(LTTNG_UST_LFILE *fp, const char *fmt, va_list ap) +//__sbprintf(LFILE *fp, const char *fmt, va_list ap) //{ // int ret; -// LTTNG_UST_LFILE fake; +// LFILE fake; // struct __sfileext fakeext; // unsigned char buf[BUFSIZ]; // @@ -189,13 +189,13 @@ static int exponent(char *, int, int); #define CHARINT 0x0800 /* 8 bit integer */ #define MAXINT 0x1000 /* largest integer size (intmax_t) */ -int ust_safe_vfprintf(LTTNG_UST_LFILE *fp, const char *fmt0, va_list ap) +int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap) { char *fmt; /* format string */ int ch; /* character from fmt */ int n, n2; /* handy integers (short term usage) */ char *cp; /* handy char pointer (short term usage) */ - struct __lttng_ust_siov *iovp; /* for PRINT macro */ + struct __siov *iovp; /* for PRINT macro */ int flags; /* flags as above */ int ret; /* return value accumulator */ int width; /* width from format (%8d), or 0 */ @@ -241,8 +241,8 @@ int ust_safe_vfprintf(LTTNG_UST_LFILE *fp, const char *fmt0, va_list ap) int size; /* size of converted field or string */ const char *xdigs = NULL; /* digits for %[xX] conversion */ #define NIOV 8 - struct __lttng_ust_suio uio; /* output information: summary */ - struct __lttng_ust_siov iov[NIOV];/* ... and individual io vectors */ + struct __suio uio; /* output information: summary */ + struct __siov iov[NIOV];/* ... and individual io vectors */ char buf[BUF]; /* buffer with space for digits of uintmax_t */ char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */ union arg *argtable; /* args, built due to positional arg */ diff --git a/snprintf/wsetup.c b/snprintf/wsetup.c index a15b8eaa..433df298 100644 --- a/snprintf/wsetup.c +++ b/snprintf/wsetup.c @@ -42,7 +42,7 @@ * _wsetup returns 0 if OK to write, nonzero otherwise. */ int -__swsetup(LTTNG_UST_LFILE *fp) +__swsetup(LFILE *fp) { /* make sure stdio is set up */ // if (!__sdidinit)