Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 4fee333

Browse files
authored
Fix windows build error on gettimeofday and other warnings (#88)
1 parent 446b9f8 commit 4fee333

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

ext/opencensus_trace.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,20 @@
1919
#include "opencensus_trace_span.h"
2020
#include "opencensus_trace_context.h"
2121
#include "opencensus_trace_annotation.h"
22+
#include "opencensus_trace_link.h"
23+
#include "opencensus_trace_message_event.h"
24+
#include "Zend/zend_builtin_functions.h"
2225
#include "Zend/zend_compile.h"
2326
#include "Zend/zend_closures.h"
27+
#include "Zend/zend_exceptions.h"
2428
#include "zend_extensions.h"
2529
#include "standard/php_math.h"
30+
#include "ext/standard/info.h"
2631

2732
#if PHP_VERSION_ID < 70100
2833
#include "standard/php_rand.h"
2934
#endif
3035

31-
#ifdef _WIN32
32-
#include "win32/time.h"
33-
#else
34-
#include <sys/time.h>
35-
#endif
36-
3736
/**
3837
* True globals for storing the original zend_execute_ex and
3938
* zend_execute_internal function pointers

ext/opencensus_trace_context.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,14 @@ ZEND_END_ARG_INFO();
5858
*/
5959
static PHP_METHOD(OpenCensusTraceContext, __construct) {
6060
zval *v;
61-
ulong idx;
6261
zend_string *k;
6362
HashTable *context_options;
6463

6564
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "h", &context_options) == FAILURE) {
6665
return;
6766
}
6867

69-
ZEND_HASH_FOREACH_KEY_VAL(context_options, idx, k, v) {
68+
ZEND_HASH_FOREACH_STR_KEY_VAL(context_options, k, v) {
7069
zend_update_property(opencensus_trace_context_ce, getThis(), ZSTR_VAL(k), strlen(ZSTR_VAL(k)), v);
7170
} ZEND_HASH_FOREACH_END();
7271
}

ext/opencensus_trace_span.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static int opencensus_trace_update_time_events(opencensus_trace_span_t *span, zv
503503
opencensus_trace_time_event_to_zval(event, &zv);
504504
add_next_index_zval(return_value, &zv);
505505
} ZEND_HASH_FOREACH_END();
506+
return SUCCESS;
506507
}
507508

508509
static int opencensus_trace_update_links(opencensus_trace_span_t *span, zval *return_value)
@@ -513,6 +514,7 @@ static int opencensus_trace_update_links(opencensus_trace_span_t *span, zval *re
513514
opencensus_trace_link_to_zval(link, &zv);
514515
add_next_index_zval(return_value, &zv);
515516
} ZEND_HASH_FOREACH_END();
517+
return SUCCESS;
516518
}
517519

518520
/* Fill the provided span with the provided data from the internal span representation */

ext/php_opencensus.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
#include "php.h"
2525
#include "opencensus_trace.h"
2626

27+
#ifdef _WIN32
28+
#include "win32/time.h"
29+
#else
30+
#include <sys/time.h>
31+
#endif
32+
2733
#define PHP_OPENCENSUS_VERSION "0.0.4"
2834
#define PHP_OPENCENSUS_EXTNAME "opencensus"
2935

0 commit comments

Comments
 (0)