[lttng-dev] [PATCH babeltrace 4/4] Cleanup: bt namespace for compat memstream.h

Michael Jeanson mjeanson at efficios.com
Thu Sep 15 00:32:30 UTC 2016


Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 formats/ctf/ctf.c                     |  6 +++---
 formats/lttng-live/lttng-live-comm.c  | 10 +++++-----
 include/babeltrace/compat/memstream.h | 16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
index 597e8d2..475d6f7 100644
--- a/formats/ctf/ctf.c
+++ b/formats/ctf/ctf.c
@@ -1415,7 +1415,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
 	 * because its size includes garbage at the end (after final
 	 * \0). This is the allocated size, not the actual string size.
 	 */
-	out = babeltrace_open_memstream(buf, &size);
+	out = bt_open_memstream(buf, &size);
 	if (out == NULL) {
 		perror("Metadata open_memstream");
 		return -errno;
@@ -1431,7 +1431,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
 		}
 	}
 	/* close to flush the buffer */
-	ret = babeltrace_close_memstream(buf, &size, out);
+	ret = bt_close_memstream(buf, &size, out);
 	if (ret < 0) {
 		int closeret;
 
@@ -1453,7 +1453,7 @@ int ctf_trace_metadata_stream_read(struct ctf_trace *td, FILE **fp,
 		*fp = NULL;
 		return -ENOENT;
 	}
-	*fp = babeltrace_fmemopen(*buf, buflen, "rb");
+	*fp = bt_fmemopen(*buf, buflen, "rb");
 	if (!*fp) {
 		perror("Metadata fmemopen");
 		return -errno;
diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
index cd146d7..19f2ea8 100644
--- a/formats/lttng-live/lttng-live-comm.c
+++ b/formats/lttng-live/lttng-live-comm.c
@@ -408,7 +408,7 @@ int open_metadata_fp_write(struct lttng_live_viewer_stream *stream,
 	int ret = 0;
 
 	stream->metadata_fp_write =
-		babeltrace_open_memstream(metadata_buf, size);
+		bt_open_memstream(metadata_buf, size);
 	if (!stream->metadata_fp_write) {
 		perror("Metadata open_memstream");
 		ret = -1;
@@ -610,7 +610,7 @@ int append_metadata(struct lttng_live_ctx *ctx,
 
 	metadata = viewer_stream->ctf_trace->metadata_stream;
 	metadata->ctf_trace->metadata_fp =
-		babeltrace_fmemopen(metadata_buf,
+		bt_fmemopen(metadata_buf,
 				metadata->metadata_len, "rb");
 	if (!metadata->ctf_trace->metadata_fp) {
 		perror("Metadata fmemopen");
@@ -944,9 +944,9 @@ int get_new_metadata(struct lttng_live_ctx *ctx,
 		}
 	} while (ret > 0 || !len_read);
 
-	if (babeltrace_close_memstream(metadata_buf, &size,
+	if (bt_close_memstream(metadata_buf, &size,
 			metadata_stream->metadata_fp_write)) {
-		perror("babeltrace_close_memstream");
+		perror("bt_close_memstream");
 	}
 	metadata_stream->metadata_fp_write = NULL;
 
@@ -1432,7 +1432,7 @@ int add_one_trace(struct lttng_live_ctx *ctx,
 				goto end_free;
 			}
 
-			trace->metadata_fp = babeltrace_fmemopen(metadata_buf,
+			trace->metadata_fp = bt_fmemopen(metadata_buf,
 					stream->metadata_len, "rb");
 			if (!trace->metadata_fp) {
 				perror("Metadata fmemopen");
diff --git a/include/babeltrace/compat/memstream.h b/include/babeltrace/compat/memstream.h
index 8689aa7..38b6e3f 100644
--- a/include/babeltrace/compat/memstream.h
+++ b/include/babeltrace/compat/memstream.h
@@ -31,7 +31,7 @@
 #include <stdio.h>
 
 static inline
-FILE *babeltrace_fmemopen(void *buf, size_t size, const char *mode)
+FILE *bt_fmemopen(void *buf, size_t size, const char *mode)
 {
 	return fmemopen(buf, size, mode);
 }
@@ -46,7 +46,7 @@ FILE *babeltrace_fmemopen(void *buf, size_t size, const char *mode)
  * temporary file, and use that file as FILE * input.
  */
 static inline
-FILE *babeltrace_fmemopen(void *buf, size_t size, const char *mode)
+FILE *bt_fmemopen(void *buf, size_t size, const char *mode)
 {
 	char tmpname[PATH_MAX];
 	size_t len;
@@ -108,13 +108,13 @@ error_unlink:
 #include <stdio.h>
 
 static inline
-FILE *babeltrace_open_memstream(char **ptr, size_t *sizeloc)
+FILE *bt_open_memstream(char **ptr, size_t *sizeloc)
 {
 	return open_memstream(ptr, sizeloc);
 }
 
 static inline
-int babeltrace_close_memstream(char **buf, size_t *size, FILE *fp)
+int bt_close_memstream(char **buf, size_t *size, FILE *fp)
 {
 	return fclose(fp);
 }
@@ -126,12 +126,12 @@ int babeltrace_close_memstream(char **buf, size_t *size, FILE *fp)
 
 /*
  * Fallback for systems which don't have open_memstream. Create FILE *
- * with babeltrace_open_memstream, but require call to
- * babeltrace_close_memstream to flush all data written to the FILE *
+ * with bt_open_memstream, but require call to
+ * bt_close_memstream to flush all data written to the FILE *
  * into the buffer (which we allocate).
  */
 static inline
-FILE *babeltrace_open_memstream(char **ptr, size_t *sizeloc)
+FILE *bt_open_memstream(char **ptr, size_t *sizeloc)
 {
 	char tmpname[PATH_MAX];
 	int ret;
@@ -167,7 +167,7 @@ error_unlink:
 
 /* Get file size, allocate buffer, copy. */
 static inline
-int babeltrace_close_memstream(char **buf, size_t *size, FILE *fp)
+int bt_close_memstream(char **buf, size_t *size, FILE *fp)
 {
 	size_t len, n;
 	long pos;
-- 
2.7.4



More information about the lttng-dev mailing list