Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-14 14:59:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-14 14:59:33 +0300
commit66d4e9300bd8b4be4f1d759146a92df7fd3230a1 (patch)
tree6840cefb264197a98d08d76545ce9461b70a3b95 /intern/clog
parent1c23b5c6ff5b3691a9e28d9576addce28b14a1a9 (diff)
Logging: replace 'fwrite' w/ 'write'
We're already buffing output, so use write directly.
Diffstat (limited to 'intern/clog')
-rw-r--r--intern/clog/clog.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/intern/clog/clog.c b/intern/clog/clog.c
index dfbd34d341a..b26105be351 100644
--- a/intern/clog/clog.c
+++ b/intern/clog/clog.c
@@ -68,7 +68,8 @@ typedef struct CLogContext {
bool use_basename;
/** Borrowed, not owned. */
- FILE *output;
+ int output;
+ FILE *output_file;
/** For new types. */
struct {
@@ -400,13 +401,12 @@ void CLG_log_str(
clg_str_append(&cstr, "\n");
/* could be optional */
- fwrite(cstr.data, cstr.len, 1, lg->ctx->output);
- fflush(lg->ctx->output);
+ write(lg->ctx->output, cstr.data, cstr.len);
clg_str_free(&cstr);
if (severity == CLG_SEVERITY_FATAL) {
- clg_ctx_fatal_action(lg->ctx, lg->ctx->output);
+ clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
}
}
@@ -432,13 +432,12 @@ void CLG_logf(
clg_str_append(&cstr, "\n");
/* could be optional */
- fwrite(cstr.data, cstr.len, 1, lg->ctx->output);
- fflush(lg->ctx->output);
+ write(lg->ctx->output, cstr.data, cstr.len);
clg_str_free(&cstr);
if (severity == CLG_SEVERITY_FATAL) {
- clg_ctx_fatal_action(lg->ctx, lg->ctx->output);
+ clg_ctx_fatal_action(lg->ctx, lg->ctx->output_file);
}
}
@@ -450,9 +449,10 @@ void CLG_logf(
static void CLG_ctx_output_set(CLogContext *ctx, void *file_handle)
{
- ctx->output = file_handle;
+ ctx->output_file = file_handle;
+ ctx->output = fileno(file_handle);
#if defined(__unix__)
- ctx->use_color = isatty(fileno(file_handle));
+ ctx->use_color = isatty(ctx->output);
#endif
}