Skip to content

Commit 6cbacda

Browse files
committed
Fix unused result warning - and use the localtime in logs
1 parent cb09d0a commit 6cbacda

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

phongo_compat.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,12 @@
9797
ctx = FG(default_context) ? FG(default_context) : php_stream_context_alloc(TSRMLS_C)
9898
#endif
9999

100+
101+
#ifndef php_ignore_value
102+
# if defined(__GNUC__) && __GNUC__ >= 4
103+
# define php_ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
104+
# else
105+
# define php_ignore_value(x) ((void) (x))
106+
# endif
107+
#endif
108+

php_phongo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void php_phongo_log(mongoc_log_level_t log_level, const char *log_domain,
212212

213213
#define PHONGO_DEBUG_LOG_FORMAT "[%s] %10s: %-8s> %s\n"
214214

215-
dt = php_format_date((char *)"Y-m-d\\TH:i:sP", strlen("Y-m-d\\TH:i:sP"), time(NULL), 0 TSRMLS_CC);
215+
dt = php_format_date((char *)"Y-m-d\\TH:i:sP", strlen("Y-m-d\\TH:i:sP"), time(NULL), 1 TSRMLS_CC);
216216
if (strcasecmp(MONGODB_G(debug_log), "stderr") == 0) {
217217
fprintf(stderr, PHONGO_DEBUG_LOG_FORMAT, dt, log_domain, mongoc_log_level_str(log_level), message);
218218
} else if (strcasecmp(MONGODB_G(debug_log), "stdout") == 0) {
@@ -225,7 +225,7 @@ static void php_phongo_log(mongoc_log_level_t log_level, const char *log_domain,
225225
#ifdef PHP_WIN32
226226
php_flock(fd, 2);
227227
#endif
228-
write(fd, tmp, len);
228+
php_ignore_value(write(fd, tmp, len));
229229
efree(tmp);
230230
close(fd);
231231
}

0 commit comments

Comments
 (0)