From: Mathieu Desnoyers Date: Tue, 21 Feb 2012 02:18:20 +0000 (-0500) Subject: snprintf: fix namespace of snprintf types for freebsd X-Git-Tag: v2.0.0-rc2~69 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=18d0b33ab9884b3f7bac0dd918993dc05a7c43fd;p=lttng-ust.git snprintf: fix namespace of snprintf types for freebsd Signed-off-by: Mathieu Desnoyers --- diff --git a/snprintf/fflush.c b/snprintf/fflush.c index fc52bb30..32cc6602 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(LFILE *fp) +int ust_safe_fflush(LTTNG_UST_LFILE *fp) { if (fp == NULL) @@ -50,7 +50,7 @@ int ust_safe_fflush(LFILE *fp) } int -__sflush(LFILE *fp) +__sflush(LTTNG_UST_LFILE *fp) { unsigned char *p; int n, t; diff --git a/snprintf/fileext.h b/snprintf/fileext.h index 2d070430..422cf823 100644 --- a/snprintf/fileext.h +++ b/snprintf/fileext.h @@ -32,12 +32,12 @@ /* * file extension */ -struct __sfileext { - struct __sbuf _ub; /* ungetc buffer */ +struct __lttng_ust_sfileext { + struct __lttng_ust_sbuf _ub; /* ungetc buffer */ struct wchar_io_data _wcio; /* wide char io status */ }; -#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base)) +#define _EXT(fp) ((struct __lttng_ust_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 62f713e0..fb075f1b 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(LFILE *fp, struct __suio *uio) +__sfvwrite(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio) { size_t len; char *p; - struct __siov *iov; + struct __lttng_ust_siov *iov; int w, s; char *nl; int nlknown, nldist; diff --git a/snprintf/fvwrite.h b/snprintf/fvwrite.h index 19b633db..65536212 100644 --- a/snprintf/fvwrite.h +++ b/snprintf/fvwrite.h @@ -35,14 +35,14 @@ /* * I/O descriptors for __sfvwrite(). */ -struct __siov { +struct __lttng_ust_siov { void *iov_base; size_t iov_len; }; -struct __suio { - struct __siov *uio_iov; +struct __lttng_ust_suio { + struct __lttng_ust_siov *uio_iov; int uio_iovcnt; int uio_resid; }; -extern int __sfvwrite(LFILE *, struct __suio *); +extern int __sfvwrite(LTTNG_UST_LFILE *, struct __lttng_ust_suio *); diff --git a/snprintf/local.h b/snprintf/local.h index c322cafc..d9251bf6 100644 --- a/snprintf/local.h +++ b/snprintf/local.h @@ -42,27 +42,27 @@ #include "wcio.h" #include "fileext.h" -int __sflush(LFILE *); -LFILE *__sfp(void); -int __srefill(LFILE *); +int __sflush(LTTNG_UST_LFILE *); +LTTNG_UST_LFILE *__sfp(void); +int __srefill(LTTNG_UST_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(LFILE *); -int __swhatbuf(LFILE *, size_t *, int *); -int _fwalk(int (*)(LFILE *)); -int __swsetup(LFILE *); +void __smakebuf(LTTNG_UST_LFILE *); +int __swhatbuf(LTTNG_UST_LFILE *, size_t *, int *); +int _fwalk(int (*)(LTTNG_UST_LFILE *)); +int __swsetup(LTTNG_UST_LFILE *); int __sflags(const char *, int *); -wint_t __fgetwc_unlock(LFILE *); +wint_t __fgetwc_unlock(LTTNG_UST_LFILE *); extern void __atexit_register_cleanup(void (*)(void)); extern int __sdidinit; /* - * Return true if the given LFILE cannot be written now. + * Return true if the given LTTNG_UST_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 b0ea5d3b..bbc66a07 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; - LFILE f; - struct __sfileext fext; + LTTNG_UST_LFILE f; + struct __lttng_ust_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 882f517e..30bedd04 100644 --- a/snprintf/various.h +++ b/snprintf/various.h @@ -35,7 +35,7 @@ #include -struct __sbuf { +struct __lttng_ust_sbuf { unsigned char *_base; int _size; }; @@ -64,13 +64,13 @@ struct __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 __sFILE { +typedef struct __lttng_ust_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 __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + struct __lttng_ust_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 __sFILE { int (*_write)(void *, const char *, int); /* extension data, to avoid further ABI breakage */ - struct __sbuf _ext; + struct __lttng_ust_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 __sFILE { unsigned char _nbuf[1]; /* guarantee a getc() buffer */ /* separate buffer for fgetln() when line crosses buffer boundary */ - struct __sbuf _lb; /* buffer for fgetln() */ + struct __lttng_ust_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 */ -} LFILE; +} LTTNG_UST_LFILE; #define __SLBF 0x0001 /* line buffered */ #define __SNBF 0x0002 /* unbuffered */ @@ -117,8 +117,8 @@ typedef struct __sFILE { #define __sferror(p) (((p)->_flags & __SERR) != 0) -extern int ust_safe_fflush(LFILE *fp); -extern int ust_safe_vfprintf(LFILE *fp, const char *fmt0, va_list ap); +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 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 1b8fba67..cedd4fb7 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(LFILE *fp, struct __suio *uio) +__sprint(LTTNG_UST_LFILE *fp, struct __lttng_ust_suio *uio) { int err; @@ -112,10 +112,10 @@ __sprint(LFILE *fp, struct __suio *uio) * worries about ungetc buffers and so forth. */ //static int -//__sbprintf(LFILE *fp, const char *fmt, va_list ap) +//__sbprintf(LTTNG_UST_LFILE *fp, const char *fmt, va_list ap) //{ // int ret; -// LFILE fake; +// LTTNG_UST_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(LFILE *fp, const char *fmt0, va_list ap) +int ust_safe_vfprintf(LTTNG_UST_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 __siov *iovp; /* for PRINT macro */ + struct __lttng_ust_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(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 __suio uio; /* output information: summary */ - struct __siov iov[NIOV];/* ... and individual io vectors */ + struct __lttng_ust_suio uio; /* output information: summary */ + struct __lttng_ust_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 433df298..a15b8eaa 100644 --- a/snprintf/wsetup.c +++ b/snprintf/wsetup.c @@ -42,7 +42,7 @@ * _wsetup returns 0 if OK to write, nonzero otherwise. */ int -__swsetup(LFILE *fp) +__swsetup(LTTNG_UST_LFILE *fp) { /* make sure stdio is set up */ // if (!__sdidinit)